Advertisement
Guest User

Untitled

a guest
Nov 20th, 2013
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. $ cat t269.cu
  2. #include <stdio.h>
  3.  
  4. struct matl1
  5. {
  6. static const double cond;
  7. };
  8.  
  9. const double matl1::cond = 420.5;
  10.  
  11. __global__ void kernel(matl1* d_matl1)
  12. {
  13. double cond = d_matl1->cond;
  14. printf("cond = %lf\n", cond);
  15. }
  16.  
  17.  
  18. int main(){
  19.  
  20. matl1 * h_matl1 = (matl1*)malloc(sizeof(matl1));
  21. matl1 * d_matl1;
  22. cudaMalloc((void**)&d_matl1, sizeof(matl1));
  23. cudaMemcpy(d_matl1, h_matl1, sizeof(matl1), cudaMemcpyHostToDevice);
  24. kernel<<<1,1>>>(d_matl1);
  25. cudaDeviceSynchronize();
  26. return 0;
  27. }
  28. $ nvcc -arch=sm_20 -o t269 t269.cu
  29. $ ./t269
  30. cond = 420.500000
  31. $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement