Skip to content

Commit

Permalink
update sample cudaNvSci
Browse files Browse the repository at this point in the history
  • Loading branch information
Ru7w1k committed Jan 25, 2022
1 parent b9063ab commit 7db525e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Samples/4_CUDA_Libraries/cudaNvSci/cudaNvSci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ class cudaNvSciSignal {
"%d.%d\n\n",
m_cudaDeviceId, _ConvertSMVer2ArchName(major, minor), major, minor);

#ifdef cuDeviceGetUuid_v2
CUresult res = cuDeviceGetUuid_v2(&m_devUUID, m_cudaDeviceId);
#else
CUresult res = cuDeviceGetUuid(&m_devUUID, m_cudaDeviceId);
#endif

if (res != CUDA_SUCCESS) {
fprintf(stderr, "Driver API error = %04d \n", res);
exit(EXIT_FAILURE);
Expand Down Expand Up @@ -387,7 +392,11 @@ class cudaNvSciWait {
checkCudaErrors(cudaSetDevice(m_cudaDeviceId));
checkCudaErrors(
cudaStreamCreateWithFlags(&streamToRun, cudaStreamNonBlocking));
#ifdef cuDeviceGetUuid_v2
CUresult res = cuDeviceGetUuid_v2(&m_devUUID, m_cudaDeviceId);
#else
CUresult res = cuDeviceGetUuid(&m_devUUID, m_cudaDeviceId);
#endif
if (res != CUDA_SUCCESS) {
fprintf(stderr, "Driver API error = %04d \n", res);
exit(EXIT_FAILURE);
Expand Down
2 changes: 1 addition & 1 deletion Samples/4_CUDA_Libraries/cudaNvSci/imageKernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void launchGrayScaleKernel(unsigned int *d_rgbaImage,
d_rgbaImage, imageWidth, imageHeight);

unsigned int *outputData;
checkCudaErrors(cudaMallocHost(&outputData, sizeof(unsigned int) * imageWidth * imageHeight));
checkCudaErrors(cudaMallocHost((void**)&outputData, sizeof(unsigned int) * imageWidth * imageHeight));
checkCudaErrors(cudaMemcpyAsync(
outputData, d_rgbaImage, sizeof(unsigned int) * imageWidth * imageHeight,
cudaMemcpyDeviceToHost, stream));
Expand Down

0 comments on commit 7db525e

Please sign in to comment.