提交 aa253ffa 编写于 作者: K Ken He

Ken He

上级 9ecac332
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [ "export": [
"helloworld.json" "GPU_arch.json"
], ],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
......
# GPU硬件平台
以下介绍GPU硬件平台 ***错误*** 的是?
## 答案
GPU(Graphics Processing Unit)最多可以同时执行几十个线程.
## 选项
### A
GPU(Graphics Processing Unit) 专门用于高度并行计算,因此设计时更多的晶体管用于数据处理.
### B
GPU(Graphics Processing Unit)可以通过计算隐藏内存访问延迟,而不是依靠大数据缓存和复杂的流控制来避免长时间的内存访问延迟.
### C
GPU(Graphics Processing Unit)在相同的价格和功率范围内,比CPU提供更高的指令吞吐量和内存带宽.
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-8acef8aa3f7b479d90b7eaf77ff752eb", "node_id": "cuda-8acef8aa3f7b479d90b7eaf77ff752eb",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"GPU_Platform.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 环境安装配置
以下介绍关于GPU环境安装配置 ***错误***的是?
## 答案
我可以在没有NVIDIA GPU的系统上使用CUDA
## 选项
### A
CUDA可以安装在Windows操作系统中.
### B
CUDA可以安装在Linux系统中.
### C
CUDA可以安装在Jetson系统上
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-f15df586747c4e648b6c6824c6b9b3e1", "node_id": "cuda-f15df586747c4e648b6c6824c6b9b3e1",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"Install.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# CUDA编译
以下哪个编译器可以用来编译CUDA程序?
## 答案
nvcc
## 选项
### A
gcc
### B
g++
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-25c9eacb75e64d00bff3d14ffdec7ea7", "node_id": "cuda-25c9eacb75e64d00bff3d14ffdec7ea7",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"CUDA_compiler.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# CUDA线程
在以下形式代码中调用kernel函数方式正确的是?
## 答案
```C++
kernel<<<gridDim, blockDim>>>(a,b,c)
```
## 选项
### A
```C++
kernel(a,b,c)
```
### B
```C++
kernel<<<gridDim>>>(a,b,c)
```
### C
```C++
kernel(a,b,c)<<<gridDim, blockDim>>>
```
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-4756f243773643fd8064aa5b4ffdb789", "node_id": "cuda-4756f243773643fd8064aa5b4ffdb789",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"CUDA_thread.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# CPU和GPU的通讯
以下说法中错误的是
## 答案
\_\_device\_\_标注的函数可以在host端调用,并在host上执行
## 选项
### A
\_\_global\_\_标注的函数可以在host端调用,并在device上执行
### B
\_\_device\_\_标注的函数可以在device端调用,并在device上执行
### C
在最新的GPU架构上, \_\_global\_\_标注的函数可以在device端调用,并在device上执行.
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-bf38379916ce44978c6bfa3ef3487c71", "node_id": "cuda-bf38379916ce44978c6bfa3ef3487c71",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"communication.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-8c79c6a5e3ca441a9cee430f312407bf", "node_id": "cuda-8c79c6a5e3ca441a9cee430f312407bf",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"multi_thread.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 使用多个线程的核函数
以下说法错误的是?
## 答案
每个block内可以设置无限多个thread.
## 选项
### A
核函数会被你设置的每一个线程执行.
### B
CUDA中的grid和block可以是一维, 二维或者三维.
### C
在host端代码中需要通常需要显示或者隐式的设置同步命令, 让CPU知道GPU中的线程执行完毕.
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-b7fb5b2b91234dd89968918460ae506f", "node_id": "cuda-b7fb5b2b91234dd89968918460ae506f",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"thread_index.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# CUDA线程
在以下形式代码中调用kernel函数的前提下, 那每个线程的全局索引正确的是?
```C++
dim3 gridDim = blocksPerGrid;
dim3 blockDim = threadsPerBlock;
....
kernel<<<gridDim, blockDim>>>(a,b,c)
....
```
## 答案
```C++
index = threadIdx.x + blockIdx.x * blockDim;
```
## 选项
### A
```C++
index = threadIdx.x + blockDim;
```
### B
```C++
index = threadIdx.x * threadDim;
```
### C
```C++
index = blockIdx.x * blockDim;
```
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-ec664e92f8e2410b88226408d9bb9a9f", "node_id": "cuda-ec664e92f8e2410b88226408d9bb9a9f",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"multi_dim.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 多维网格
以下代码调用kernel函数, 对于多维Grid中每个线程在***全局***中的索引(x, y)正确的是?
```C++
dim3 gridDim = (blocksPerGrid, blocksPerGrid);
dim3 blockDim = (threadsPerBlock, threadsPerBlock);
....
kernel<<<gridDim, blockDim>>>(a,b,c)
....
```
## 答案
```C++
x = threadIdx.x + blockIdx.x * blockDim.x;
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 ;
```
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-70b301e021ef435f92c0f07b22adaa09", "node_id": "cuda-70b301e021ef435f92c0f07b22adaa09",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"grid_block.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 网格和线程块
以下说法不正确的是?
## 答案
一个kernel调用的所有线程肯定运行在同一个GPU上
## 选项
### A
同一个Block中的线程一定会运行在同一个SM中
### B
一个Grid可以包含多个线程block
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-5f99fc5469cf4907ba3ebe615287a6e9", "node_id": "cuda-5f99fc5469cf4907ba3ebe615287a6e9",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem1.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# GPU 存储单元
以下关于GPU存储单元说法正确的是?
## 答案
在CPU上初始化的数据需要显式或者隐式的传输到GPU存储单元, 然后才能被CUDA线程读取.
## 选项
### A
CUDA线程可以直接访问CPU中的内存设备.
### B
CPU不可以对GPU中的Global Memory读写.
### C
GPU内存读写带宽只与CUDA版本有关.
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-f336472c4c244a68b4a2ee80dac8fdd0", "node_id": "cuda-f336472c4c244a68b4a2ee80dac8fdd0",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem2.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# GPU的存储单元
下面关于GPU存储单元说法错误的是?
## 答案
CUDA线程有对所有类型的存储类型的读写权限
## 选项
### A
同一个Block内的线程可以通过 shared memory来进行协作
### B
CPU可以对GPU中的global memory, constant memory 和 texture memory进行读写
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-3443edc2ea5140b0a39f690382bf91e2", "node_id": "cuda-3443edc2ea5140b0a39f690382bf91e2",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem3.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# GPU存储单元的分配与释放
下面关于GPU存储单元的分配与释放的说法错误的是?
## 答案
可以使用`cudaMemcpy(d_m, h_m, sizeof(int)*m*m, cudaMemcpyHostToDevice)` 的形式将数据从GPU传输给CPU
## 选项
### A
可是使用`cudaMalloc()`函数来分配GPU存储空间
### B
可以使用`cudaFree()`函数来释放显存
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-2244dd4b61cc478094ba7013770f1f29", "node_id": "cuda-2244dd4b61cc478094ba7013770f1f29",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem4.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 数据传输
对于CUDA中的数据传输函数`cudaMemcpy(void *dst, const void *src, size_t count, cudaMemcpyKind kind)
`,以下说法错误的是?
## 答案
count可以无限大
## 选项
### A
dst可以是由cudaMalloc()分配的,指向GPU内存的地址.
### B
dst也可以是指向CPU内存的地址
### C
kind指的是数据传输方向
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-3fa4ca2a53d74b9d92a11ba6a7f23306", "node_id": "cuda-3fa4ca2a53d74b9d92a11ba6a7f23306",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem5.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 数据存储单元与线程之间的对应关系
以下说法正确的是?
## 答案
所有的线程都可以访问global memory
## 选项
### A
每个线程都有自己的寄存器, 其他线程无法访问.
### B
所有的线程都可以访问一个shared memory
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-73f87372510e4546a282aea26e371e53", "node_id": "cuda-73f87372510e4546a282aea26e371e53",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem6.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# CUDA中的多种存储单元类型
下面关于CUDA中的多种存储单元说法错误的是?
## 答案
Register和Shared memory有很多, 每个线程更多的占用它们,可以让更多的block驻留在SM中
## 选项
### A
GPU上有onchip和onboard的存储单元类型
### B
Onchip的存储单元包括Register 和 Shared memory
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-3347d61cb34745a4adbe216f6eca305c", "node_id": "cuda-3347d61cb34745a4adbe216f6eca305c",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem7.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# CUDA中的多种存储单元
下面关于GPU中多种存储单元的说法错误的是?
## 答案
内核无法使用多于可用寄存器数量的任何变量(这也称为寄存器溢出)
## 选项
### A
寄存器变量是每个线程私有的,一旦thread执行结束,寄存器变量就会失效
### B
同一个Block中的线程共享一块Shared Memory
### C
在同一个编译单元,constant对所有kernel可见
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-73179a76ecd34f5dbf8e53b3a1e84228", "node_id": "cuda-73179a76ecd34f5dbf8e53b3a1e84228",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem8.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# CUDA中的多种存储单元
下面对于CUDA中的多种存储单元说法错误的是?
## 答案
Texture Memory驻留在onchip Memory中,并且使用一个只读cache.
## 选项
### A
当一个warp中所有thread都从同一个Constant Memory地址读取数据时,Constant Memory表现会非常好,会触发广播机制.
### B
Texture Mmeory是专门为那些在内存访问模式中存在大量空间局部性(Spatial Locality)的图形应用程序而设计的.
### C
Global Memory驻留在Device memory中.
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-8965afc1396c4aad8fa3eaa203b6e3ac", "node_id": "cuda-8965afc1396c4aad8fa3eaa203b6e3ac",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem8.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 共享内存
下面关于共享内存的说法错误的是?
## 答案
Shared Memory可以被设置成512KB,1024KB ,2048KB…剩下的给L1缓存
## 选项
### A
有可能会出现同时有很多线程访问Shared Memory上的数据
### B
为了克服这个同时访问的瓶颈,Shared Memory被分成32个逻辑块(banks)
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-3c183e532dcd44d88311a778f6958916", "node_id": "cuda-3c183e532dcd44d88311a778f6958916",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem9.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
# 共享内存
下面关于共享内存说法错误的是?
## 答案
同一个warp 内多个线程访问同一个bank的同一个地址时,会出现bank冲突.
## 选项
### A
同常量内存一样,当一个 warp 中的所有线程访问同一地址的共享内存时,会触发一个广播(broadcast)机制到 warp 中所有线程.
### B
同一个warp 内多个线程访问同一个bank的不同地址时,会出现bank冲突.
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"node_id": "cuda-6560fcc5a5c9465b84aa0f15b9576b79", "node_id": "cuda-6560fcc5a5c9465b84aa0f15b9576b79",
"keywords": [], "keywords": [],
"children": [], "children": [],
"export": [], "export": [
"mem10.md"
],
"keywords_must": [], "keywords_must": [],
"keywords_forbid": [] "keywords_forbid": []
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册