Skip to content

Commit

Permalink
Fixing shutdown bug for Python+opencl for new python 3.12+ support
Browse files Browse the repository at this point in the history
The PerfStubs support should not call Tau_exit from the ps_tool_finalize
implementation, because the GPU activity gets ignored for some reason.
The easiest fix is to let normal TAU shutdown happen at exit.


Former-commit-id: 2a4568438a18ea35365c0ff113ead086244aa122
  • Loading branch information
khuck committed Feb 18, 2025
1 parent 7382481 commit 364a3ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/Profile/TauGenericAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ void ps_tool_register_thread(void) {
void Tau_profile_exit_all_threads();

void ps_tool_finalize(void) {
#ifndef TAU_MPI
//Tau_destructor_trigger();
//Tau_profile_exit_all_threads();
Tau_exit("stub exiting");
#endif
// Do nothing! it's tempting to call Tau_exit() here, but with GPU
// support we not get handled correctly. instead, just let the TAU
// main wrapper handle the exit.
}

void ps_tool_pause_measurement(void) {
Expand Down
16 changes: 12 additions & 4 deletions src/Profile/TauGpuAdapterOpenCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,20 @@ OpenCLGpuEvent * Tau_opencl_retrieve_gpu(cl_command_queue q)
if (err != CL_SUCCESS)
{ printf("error in clGetCommandQueueInfo CONTEXT.\n"); }

//err = clGetDeviceInfo(id, CL_DEVICE_VENDOR_ID, sizeof(cl_uint), &vendor, NULL);
char deviceName[256];
char deviceVendor[256];

err = clGetDeviceInfo(id, CL_DEVICE_NAME, 256, deviceName, NULL);
if (err != CL_SUCCESS)
{ printf("error in clGetDeviceInfo CL_DEVICE_NAME.\n"); }

err = clGetDeviceInfo(id, CL_DEVICE_VENDOR, 256, deviceVendor, NULL);
if (err != CL_SUCCESS)
{ printf("error in clGetDeviceInfo CL_DEVICE_VENDOR.\n"); }

printf("device id: %d.\n", id);
printf("command id: %lld.\n", q);
printf("vendor id: %d.\n", vendor);
printf("device name: %s\n", deviceName);
printf("vendor name: %s\n", deviceVendor);
printf("command id: %lld\n", q);
double sync_offset = Tau_opencl_sync_clocks(q, context);
#if defined(PTHREADS) || defined(TAU_OPENMP)
// Create a virtual thread for this command queue
Expand Down

0 comments on commit 364a3ac

Please sign in to comment.