Skip to content

Commit

Permalink
Merge pull request #1698 from CEED/jeremy/debug-cleanup
Browse files Browse the repository at this point in the history
Truncate jit output
  • Loading branch information
jeremylt authored Oct 25, 2024
2 parents e3ae47f + 26ef7cd commit de84fe5
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 24 deletions.
3 changes: 0 additions & 3 deletions backends/cuda-gen/ceed-cuda-gen-operator-build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,6 @@ extern "C" int CeedOperatorBuildKernel_Cuda_gen(CeedOperator op) {
code << "// -----------------------------------------------------------------------------\n\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated Operator Kernels:\n");
CeedDebug(ceed, code.str().c_str());

CeedCallBackend(CeedCompile_Cuda(ceed, code.str().c_str(), &data->module, 1, "T_1D", CeedIntMax(Q_1d, data->max_P_1d)));
CeedCallBackend(CeedGetKernel_Cuda(ceed, data->module, operator_name.c_str(), &data->op));
CeedCallBackend(CeedOperatorSetSetupDone(op));
Expand Down
4 changes: 0 additions & 4 deletions backends/cuda-ref/ceed-cuda-ref-qfunction-load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ extern "C" int CeedQFunctionBuildKernel_Cuda_ref(CeedQFunction qf) {
code << " }\n";
code << "}\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated QFunction Kernels:\n");
CeedDebug(ceed, code.str().c_str());

// Compile kernel
CeedCallBackend(CeedCompile_Cuda(ceed, code.str().c_str(), &data->module, 0));
CeedCallBackend(CeedGetKernel_Cuda(ceed, data->module, kernel_name.c_str(), &data->QFunction));
Expand Down
6 changes: 3 additions & 3 deletions backends/cuda/ceed-cuda-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const Ceed
CeedCallNvrtc(ceed, nvrtcCreateProgram(&prog, code.str().c_str(), NULL, 0, NULL, NULL));

// Compile kernel
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- ATTEMPTING TO COMPILE JIT SOURCE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- END OF JIT SOURCE ----------\n");
nvrtcResult result = nvrtcCompileProgram(prog, num_opts + num_jit_source_dirs + num_jit_defines, opts);

for (CeedInt i = 0; i < num_jit_source_dirs; i++) {
Expand All @@ -134,9 +137,6 @@ int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const Ceed
char *log;
size_t log_size;

CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedCallNvrtc(ceed, nvrtcGetProgramLogSize(prog, &log_size));
CeedCallBackend(CeedMalloc(log_size, &log));
CeedCallNvrtc(ceed, nvrtcGetProgramLog(prog, log));
Expand Down
4 changes: 0 additions & 4 deletions backends/hip-gen/ceed-hip-gen-operator-build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,6 @@ extern "C" int CeedOperatorBuildKernel_Hip_gen(CeedOperator op) {
code << "}\n";
code << "// -----------------------------------------------------------------------------\n\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated Operator Kernels:\n");
CeedDebug(ceed, code.str().c_str());

CeedInt block_sizes[3] = {0, 0, 0};
CeedInt num_elem;

Expand Down
4 changes: 0 additions & 4 deletions backends/hip-ref/ceed-hip-ref-qfunction-load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ extern "C" int CeedQFunctionBuildKernel_Hip_ref(CeedQFunction qf) {
code << " }\n";
code << "}\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated QFunction Kernels:\n");
CeedDebug(ceed, code.str().c_str());

// Compile kernel
CeedCallBackend(CeedCompile_Hip(ceed, code.str().c_str(), &data->module, 1, "BLOCK_SIZE", ceed_Hip->opt_block_size));
CeedCallBackend(CeedGetKernel_Hip(ceed, data->module, kernel_name.c_str(), &data->QFunction));
Expand Down
1 change: 0 additions & 1 deletion backends/hip-ref/ceed-hip-ref-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ static inline int CeedElemRestrictionSetupCompile_Hip(CeedElemRestriction rstr)
"// AtPoints restriction source\n#include <ceed/jit-source/hip/hip-ref-restriction-at-points.h>\n\n"
"// Standard restriction source\n#include <ceed/jit-source/hip/hip-ref-restriction-offset.h>\n";

CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "----- Loading Restriction Kernel Source Complete! -----\n");
CeedCallBackend(CeedCompile_Hip(ceed, restriction_kernel_source, &impl->module, 6, "RSTR_ELEM_SIZE", elem_size, "RSTR_NUM_ELEM", num_elem,
"RSTR_NUM_COMP", num_comp, "RSTR_NUM_NODES", impl->num_nodes, "RSTR_COMP_STRIDE", comp_stride,
"USE_DETERMINISTIC", is_deterministic ? 1 : 0));
Expand Down
6 changes: 3 additions & 3 deletions backends/hip/ceed-hip-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const Ce
CeedCallHiprtc(ceed, hiprtcCreateProgram(&prog, code.str().c_str(), NULL, 0, NULL, NULL));

// Compile kernel
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- ATTEMPTING TO COMPILE JIT SOURCE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- END OF JIT SOURCE ----------\n");
hiprtcResult result = hiprtcCompileProgram(prog, num_opts + num_jit_source_dirs + num_jit_defines, opts);

for (CeedInt i = 0; i < num_jit_source_dirs; i++) {
Expand All @@ -136,9 +139,6 @@ int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const Ce
size_t log_size;
char *log;

CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedChk_hiprtc(ceed, hiprtcGetProgramLogSize(prog, &log_size));
CeedCallBackend(CeedMalloc(log_size, &log));
CeedCallHiprtc(ceed, hiprtcGetProgramLog(prog, log));
Expand Down
2 changes: 0 additions & 2 deletions interface/ceed-jit-tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ int CeedLoadSourceToInitializedBuffer(Ceed ceed, const char *source_file_path, C
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- Ceed JiT ----------\n");
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Current source file: ");
CeedDebug(ceed, "%s\n", source_file_path);
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Current buffer:\n");
CeedDebug(ceed, "%s\n", *buffer);

// Read file to temporary buffer
source_file = fopen(source_file_path, "rb");
Expand Down

0 comments on commit de84fe5

Please sign in to comment.