Skip to content

Commit

Permalink
feat: add note about printf in 2.apsp.md
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverYoung2001 committed May 10, 2024
1 parent 1297656 commit 9c39819
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/exp/2.apsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ for (int k = p * b; k < (p + 1) * b; k++)
利用这种分块的方式,你可以将部分数据放入大小有限的共享内存或寄存器中,以提升程序执行效率。

## 编程提示和优化技巧

- 调试时你可以直接在设备函数上使用printf,此printf是CUDA特殊支持的函数,但又一些使用上的限制,具体可见[CUDA编程指南](https://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_C_Programming_Guide.pdf)的Appendix B.16;
- 使用分块算法时,矩阵底部和右侧的块可能是不完整的,在程序中可能需要边界判断;
- 使用指针时,请注意数据在 GPU 上还是主存上:本实验的输入输出均在 GPU 上,调试时你可能需要将其手动拷贝到主存上;
- 记得在适当位置添加 `__syncthreads()`(潜在优化点:最短路算法的某一步中,就算访问旧的 shared memory 值,也可证明答案是正确的,此时可以不做同步;如实现此项优化,鼓励在报告中提供证明);
Expand Down

0 comments on commit 9c39819

Please sign in to comment.