CUDAåå¼·ä¸ CUDA by Exampleããã®ã¡ã¢ï¼ #define N 1024 __global__ void add(int *a, int *b, int *c){ //int tid = threadIdx.x; if(tid < N){ c[tid] = a[tid] + b[tid]; } } ã¨ãã£ããã¯ãã«ã®å ç®ãããã¤ã¹ã«ããããã¨ãã«ãã©ããããã¯ãã¹ã¬ãããåããã°ãããã æå ã®ç°å¢ï¼QuadroK5000ï¼ã ã¨ãæ大ãããã¯æ°65535ãæ大ã¹ã¬ãã/ãããã¯æ°ã¯1024 é·ãN:1024ã®ãã¯ãã«ãè¨ç®ããå ´å add<<<N,1>>>(dev_a, dev_b, dev_c); ã¨ãããã¯ãå¢ããã¦1ãããã¯ããã1ã¹ã¬ããã§ãã add<<<1,N>>>(dev_a, dev_b, dev_c); ã¨ãã¦ã1ãããã¯Nã¹ã¬ããã§ãåãã é·ãN:10
{{#tags}}- {{label}}
{{/tags}}