Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0467cb5

Browse files
committed
Switched to cudaMemcpyToArray() to cudaMemcpy() due to the former was deprecated in CUDA 11
1 parent a0c6a8b commit 0467cb5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Chapter02/02_memory_overview/05_image_scaling/image_scaling.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, char*argv[])
4141

4242
//Allocate CUDA Array
4343
returnValue = cudaMallocArray( &cu_array, &channelDesc, width, height);
44-
returnValue = (cudaError_t)(returnValue | cudaMemcpyToArray( cu_array, 0, 0, data, height*width*sizeof(unsigned char), cudaMemcpyHostToDevice));
44+
returnValue = (cudaError_t)(returnValue | cudaMemcpy( cu_array, data, height * width * sizeof(unsigned char), cudaMemcpyHostToDevice));
4545

4646
if(returnValue != cudaSuccess)
4747
printf("\n Got error while running CUDA API Array Copy");

Chapter07/07_parallel_programming_pattern/08_histogram/image_histogram.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int main(int argc, char*argv[])
6969

7070
//Allocate CUDA Array
7171
returnValue = cudaMallocArray( &cu_array, &channelDesc, width, height);
72-
returnValue = (cudaError_t)(returnValue | cudaMemcpyToArray( cu_array, 0, 0, data, height*width*sizeof(unsigned char), cudaMemcpyHostToDevice));
72+
returnValue = (cudaError_t)(returnValue | cudaMemcpy( cu_array, data, height * width * sizeof(unsigned char), cudaMemcpyHostToDevice));
7373

7474
if(returnValue != cudaSuccess) printf("\n Got error while running CUDA API Array Copy");
7575

0 commit comments

Comments
 (0)