summaryrefslogtreecommitdiff
path: root/cuda/memcpy.cu
blob: e2d57817d4ddd13c5b119c0251594e24b6711683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

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;
}