update sample cudaNvSci

This commit is contained in:
Rutwik Choughule 2022-01-25 17:22:31 +05:30
parent bf8c6dd043
commit 9d4c014f60
2 changed files with 10 additions and 1 deletions

View File

@ -113,7 +113,12 @@ class cudaNvSciSignal {
"%d.%d\n\n", "%d.%d\n\n",
m_cudaDeviceId, _ConvertSMVer2ArchName(major, minor), major, minor); 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); CUresult res = cuDeviceGetUuid(&m_devUUID, m_cudaDeviceId);
#endif
if (res != CUDA_SUCCESS) { if (res != CUDA_SUCCESS) {
fprintf(stderr, "Driver API error = %04d \n", res); fprintf(stderr, "Driver API error = %04d \n", res);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -387,7 +392,11 @@ class cudaNvSciWait {
checkCudaErrors(cudaSetDevice(m_cudaDeviceId)); checkCudaErrors(cudaSetDevice(m_cudaDeviceId));
checkCudaErrors( checkCudaErrors(
cudaStreamCreateWithFlags(&streamToRun, cudaStreamNonBlocking)); cudaStreamCreateWithFlags(&streamToRun, cudaStreamNonBlocking));
#ifdef cuDeviceGetUuid_v2
CUresult res = cuDeviceGetUuid_v2(&m_devUUID, m_cudaDeviceId);
#else
CUresult res = cuDeviceGetUuid(&m_devUUID, m_cudaDeviceId); CUresult res = cuDeviceGetUuid(&m_devUUID, m_cudaDeviceId);
#endif
if (res != CUDA_SUCCESS) { if (res != CUDA_SUCCESS) {
fprintf(stderr, "Driver API error = %04d \n", res); fprintf(stderr, "Driver API error = %04d \n", res);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

View File

@ -93,7 +93,7 @@ void launchGrayScaleKernel(unsigned int *d_rgbaImage,
d_rgbaImage, imageWidth, imageHeight); d_rgbaImage, imageWidth, imageHeight);
unsigned int *outputData; unsigned int *outputData;
checkCudaErrors(cudaMallocHost(&outputData, sizeof(unsigned int) * imageWidth * imageHeight)); checkCudaErrors(cudaMallocHost((void**)&outputData, sizeof(unsigned int) * imageWidth * imageHeight));
checkCudaErrors(cudaMemcpyAsync( checkCudaErrors(cudaMemcpyAsync(
outputData, d_rgbaImage, sizeof(unsigned int) * imageWidth * imageHeight, outputData, d_rgbaImage, sizeof(unsigned int) * imageWidth * imageHeight,
cudaMemcpyDeviceToHost, stream)); cudaMemcpyDeviceToHost, stream));