Cool Programmer
Cool Programmer

Reputation: 31

about cudaMemcpy() function about whether both the source and destination pointers can be null

In cudaMemcpy(), can the both source and destination pointers be null? I am a beginner in CUDA. so please any help will be appreciated.

Upvotes: 0

Views: 266

Answers (1)

Robert Crovella
Robert Crovella

Reputation: 152249

It is not valid to do so.

The pointers passed to cudaMemcpy should be properly allocated pointers. NULL is not a properly allocated pointer.

If you do proper CUDA error checking, I think the API will return an error (invalid parameter) with NULL pointers when it is expecting a proper device pointer.

Upvotes: 5

Related Questions