mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2024-11-24 17:19:16 +08:00
update sample cudaNvSci
This commit is contained in:
parent
bf8c6dd043
commit
9d4c014f60
|
@ -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);
|
||||||
|
|
|
@ -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));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user