Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created July 2, 2015 09:01
Show Gist options
  • Save kaityo256/050752d1fba11cfc0afa to your computer and use it in GitHub Desktop.
Save kaityo256/050752d1fba11cfc0afa to your computer and use it in GitHub Desktop.
CUDA sample
#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