Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat t269.cu
- #include <stdio.h>
- struct matl1
- {
- static const double cond;
- };
- const double matl1::cond = 420.5;
- __global__ void kernel(matl1* d_matl1)
- {
- double cond = d_matl1->cond;
- printf("cond = %lf\n", cond);
- }
- int main(){
- matl1 * h_matl1 = (matl1*)malloc(sizeof(matl1));
- matl1 * d_matl1;
- cudaMalloc((void**)&d_matl1, sizeof(matl1));
- cudaMemcpy(d_matl1, h_matl1, sizeof(matl1), cudaMemcpyHostToDevice);
- kernel<<<1,1>>>(d_matl1);
- cudaDeviceSynchronize();
- return 0;
- }
- $ nvcc -arch=sm_20 -o t269 t269.cu
- $ ./t269
- cond = 420.500000
- $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement