Description: 用于CUDA方案的程序码说明,提供的练习有:
cudaMallocAndMemcpy
myFirstKernel
reverseArray_singleblock
reverseArray_multiblock
reverseArray_multiblock_fast(Skeletons and solutions for hands-on CUDA codes, they are listed as the followings:
cudaMallocAndMemcpy
myFirstKernel
reverseArray_singleblock
reverseArray_multiblock
reverseArray_multiblock_fast) Platform: |
Size: 2434048 |
Author:p-yang
|
Hits:
Description: 在主机和设备之间复制--从“cudaMallocAndMemcpy”模板开始。
第1部分:为设备上的指标 d_a 和 d_b 分配内存。
第2部分:将主机上的h_a复制到设备上的 d_a。
第3部分:将设备从 d_a复制到 d_b。
第4部分:将设备上的 d_b 复制回主机上的 h_a。
第5部分:在主机上释放 d_a 和 d_b。
额外部分:用cudaMallocHost代替malloc来分配h_a。(Copy between host and device -- start with the cudaMallocAndMemcpy template.
The first part allocates memory for the indexes d_a and d_b on the device.
The second part: copy the h_a on the host to the d_a on the device.
The third part: copy the device from d_a to d_b.
The fourth part: copy the d_b from the device back to the h_a on the host.
The fifth part: release d_a and d_b on the host.) Platform: |
Size: 6144 |
Author:p-yang
|
Hits: