你好,我测试了OpenACC和OpenMP对什么都没有,但是我得到了奇怪的结果。
1. I use subsystem Ubuntu for windows 10 ([https://learn.microsoft.com/en-us/windows/wsl/install-win10](https://learn.microsoft.com/en-us/windows/wsl/install-win10) ) and GCC 7.1(C compiler) and get following result: Nothing = OpenMP(correct result in about 5 sec) ; OpenACC faster, but gave wrong result(0 vs 1 000 000 000)
2. I use VMware with Ubuntu and result is: Nothing gave nothing(program executing infinitely and I just close terminal); OpenACC showed result faster then OpenMP, but showed wrong result again.
3. If I use Intel C++ compiler from console with OpenMP I get about 1.3sec vs ~5 sec in Ubuntu
该怎么办呢?
发布于 2018-02-25 10:13:21
您有多个不同的线程覆盖sum,因此得到的结果是错误的。你得告诉它这是个“减价”
#pragma omp parallel for reduction(+:sum)或
#pragma acc parallel loop reduction(+:sum)发布于 2018-05-18 21:12:11
谷歌的“竞赛条件”--事实上,较新版本的PGI OpenACC --足够聪明地检测到给定变量的减少。这并不意味着您应该编写潜在的错误代码。
https://stackoverflow.com/questions/48972219
复制相似问题