Skip to content

Commit

Permalink
gpujpegtool: call cudaDeviceReset with the lib
Browse files Browse the repository at this point in the history
hide the cudaDeviceReset() behind GPUJPEG API

Inside the gpujpegtool, no cudart is called directly so keep this
isolation also for the device reset.
  • Loading branch information
MartinPulec committed Aug 13, 2024
1 parent 4c00176 commit 4f5791e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions libgpujpeg/gpujpeg_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,10 @@ gpujpeg_pixel_format_get_name(enum gpujpeg_pixel_format pixel_format);
GPUJPEG_API int
gpujpeg_pixel_format_is_planar(enum gpujpeg_pixel_format pixel_format);

/** Calls cudaDeviceReset() */
GPUJPEG_API void
gpujpeg_device_reset(void);

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/gpujpeg_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,4 +2029,10 @@ float gpujpeg_custom_timer_get_duration(cudaEvent_t start, cudaEvent_t stop) {
return elapsedTime;
}

void
gpujpeg_device_reset(void)
{
cudaDeviceReset();
}

/* vi: set expandtab sw=4 : */
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ main(int argc, char *argv[])
}

#ifdef DEBUG
cudaDeviceReset(); // to allow "cuda-memcheck --leak-check full"
gpujpeg_device_reset(); // to allow "cuda-memcheck --leak-check full"
#endif // defined DEBUG

return ret;
Expand Down

0 comments on commit 4f5791e

Please sign in to comment.