From 39b9b499602b0591fd01fffc5acabd5a7b4cbbf1 Mon Sep 17 00:00:00 2001 From: feilong Date: Mon, 18 Apr 2022 16:34:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multi_dim.md" | 4 ++++ 1 file changed, 4 insertions(+) diff --git "a/data/1.CUDA\345\205\245\351\227\250\345\210\235\351\230\266/2.\345\210\235\350\257\206CUDA/6.\345\244\232\347\273\264\347\275\221\347\273\234/multi_dim.md" "b/data/1.CUDA\345\205\245\351\227\250\345\210\235\351\230\266/2.\345\210\235\350\257\206CUDA/6.\345\244\232\347\273\264\347\275\221\347\273\234/multi_dim.md" index 10e7862..348c7ab 100644 --- "a/data/1.CUDA\345\205\245\351\227\250\345\210\235\351\230\266/2.\345\210\235\350\257\206CUDA/6.\345\244\232\347\273\264\347\275\221\347\273\234/multi_dim.md" +++ "b/data/1.CUDA\345\205\245\351\227\250\345\210\235\351\230\266/2.\345\210\235\350\257\206CUDA/6.\345\244\232\347\273\264\347\275\221\347\273\234/multi_dim.md" @@ -10,6 +10,7 @@ kernel<<>>(a,b,c) ``` ## 答案 + ```C++ x = threadIdx.x + blockIdx.x * blockDim.x; y = threadIdx.y + blockIdx.y * blockDim.y; @@ -18,18 +19,21 @@ y = threadIdx.y + blockIdx.y * blockDim.y; ## 选项 ### A + ```C++ x = threadIdx.x + blockIdx.x ; y = threadIdx.y + blockIdx.y ; ``` ### B + ```C++ x = threadIdx.x * blockDim.x ; y = threadIdx.y * blockDim.y ; ``` ### C + ```C++ x = threadIdx.x ; y = threadIdx.y ; -- GitLab