From 869e1c86d80dee01b39d447e741f9498d917a418 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 9 Dec 2015 11:24:07 +0100 Subject: cuda --- cuda/memcpy.cu | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 cuda/memcpy.cu (limited to 'cuda/memcpy.cu') diff --git a/cuda/memcpy.cu b/cuda/memcpy.cu new file mode 100644 index 0000000..e2d5781 --- /dev/null +++ b/cuda/memcpy.cu @@ -0,0 +1,17 @@ +#include + +using namespace std; + +int main(void) +{ + void* ptr = NULL; + float* f = new float[1]; + cudaMalloc(&ptr, sizeof(float)*1); + int r = cudaMemcpy(ptr, f, sizeof(float) * 1, cudaMemcpyHostToDevice); + cout << r << endl; + cout << cudaSuccess << endl; + cout << cudaErrorInvalidValue << endl; + cout << cudaErrorInvalidDevicePointer << endl; + cout << cudaErrorInvalidMemcpyDirection << endl; +} + -- cgit v1.2.3