Skip to content

Commit

Permalink
add the ability print warnings from GPU (#1629)
Browse files Browse the repository at this point in the history
this is enabled with USE_GPU_PRINTF
  • Loading branch information
zingale authored Jul 26, 2024
1 parent 997a426 commit ecbc595
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/good_defines.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ALLOW_GPU_PRINTF
ALLOW_JACOBIAN_CACHING
AMREX_USE_CUDA
AMREX_USE_GPU
Expand Down
4 changes: 4 additions & 0 deletions Make.Microphysics
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ endif
# Require C++17
CXXSTD := c++17

ifeq ($(USE_GPU_PRINTF),TRUE)
DEFINES += -DALLOW_GPU_PRINTF
endif

include $(AMREX_HOME)/Tools/GNUMake/Make.defs

MICROPHYSICS_AUTO_SOURCE_DIR := $(TmpBuildDir)/microphysics_sources/$(optionsSuffix).EXE
Expand Down
4 changes: 4 additions & 0 deletions integration/integrator_setup_sdc.H
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <AMReX_REAL.H>
#include <AMReX_ANSIEscCode.H>
#include <AMReX_GpuPrint.H>

#include <iomanip>

Expand Down Expand Up @@ -261,6 +262,9 @@ void integrator_cleanup (IntegratorT& int_state, BurnT& state,
}
std::cout << std::endl;
#endif
#elif defined(ALLOW_GPU_PRINTF)
AMREX_DEVICE_PRINTF("[ERROR] integration failed in net, istate = %d, time = %g, dt = %g, dens_start = %g, temp_start = %g\n",
istate, state.time, dt, state.rho_orig, state_save.T_in);
#endif
} else {
#ifndef AMREX_USE_GPU
Expand Down
4 changes: 4 additions & 0 deletions integration/integrator_setup_strang.H
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <AMReX_REAL.H>
#include <AMReX_ANSIEscCode.H>
#include <AMReX_GpuPrint.H>

#include <iomanip>

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

0 comments on commit ecbc595

Please sign in to comment.