Skip to content

Commit ecbc595

Browse files
authored
add the ability print warnings from GPU (AMReX-Astro#1629)
this is enabled with USE_GPU_PRINTF
1 parent 997a426 commit ecbc595

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

.github/workflows/good_defines.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ALLOW_GPU_PRINTF
12
ALLOW_JACOBIAN_CACHING
23
AMREX_USE_CUDA
34
AMREX_USE_GPU

Make.Microphysics

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ endif
3535
# Require C++17
3636
CXXSTD := c++17
3737

38+
ifeq ($(USE_GPU_PRINTF),TRUE)
39+
DEFINES += -DALLOW_GPU_PRINTF
40+
endif
41+
3842
include $(AMREX_HOME)/Tools/GNUMake/Make.defs
3943

4044
MICROPHYSICS_AUTO_SOURCE_DIR := $(TmpBuildDir)/microphysics_sources/$(optionsSuffix).EXE

integration/integrator_setup_sdc.H

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <AMReX_REAL.H>
55
#include <AMReX_ANSIEscCode.H>
6+
#include <AMReX_GpuPrint.H>
67

78
#include <iomanip>
89

@@ -261,6 +262,9 @@ void integrator_cleanup (IntegratorT& int_state, BurnT& state,
261262
}
262263
std::cout << std::endl;
263264
#endif
265+
#elif defined(ALLOW_GPU_PRINTF)
266+
AMREX_DEVICE_PRINTF("[ERROR] integration failed in net, istate = %d, time = %g, dt = %g, dens_start = %g, temp_start = %g\n",
267+
istate, state.time, dt, state.rho_orig, state_save.T_in);
264268
#endif
265269
} else {
266270
#ifndef AMREX_USE_GPU

integration/integrator_setup_strang.H

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <AMReX_REAL.H>
55
#include <AMReX_ANSIEscCode.H>
6+
#include <AMReX_GpuPrint.H>
67

78
#include <iomanip>
89

@@ -217,6 +218,9 @@ void integrator_cleanup (IntegratorT& int_state, BurnT& state,
217218
}
218219
std::cout << std::endl;
219220
std::cout << "energy generated = " << state.e << std::endl;
221+
#elif defined(ALLOW_GPU_PRINTF)
222+
AMREX_DEVICE_PRINTF("[ERROR] integration failed in net, istate = %d, time = %g, dt = %g, dens = %g, temp_start = %g\n",
223+
istate, int_state.t, dt, state.rho, state_save.T_in);
220224
#endif
221225
} else {
222226
#ifndef AMREX_USE_GPU

0 commit comments

Comments
 (0)