Created
July 2, 2015 09:01
-
-
Save kaityo256/050752d1fba11cfc0afa to your computer and use it in GitHub Desktop.
CUDA sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <cuda.h> | |
| __global__ void | |
| func(void){ | |
| printf("%d %d %d\n",blockIdx.x, blockDim.x, threadIdx.x); | |
| } | |
| int | |
| main(void){ | |
| cudaSetDeviceFlags(cudaDeviceMapHost); | |
| int const n_thread = 3; | |
| int const n_block = 4; | |
| func<<<n_block,n_thread>>>(); | |
| printf("Version = %d\n",CUDA_VERSION); | |
| //cudaThreadSynchronize(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment