关于openmp并行可以看这个文档
https://tildesites.bowdoin.edu/~ltoma/teaching/cs3225-GIS/fall17/Lectures/openmp.html
操作非常简单:
在你需要并行化的for前面,加上
#pragma omp parallel for
然后在cmake中加上
set(CMAKE_CXX_FLAGS "${CAMKE_CXX_FLAGS} -O3 -fopenmp")
重新执行cmake ..
然后编译即可。
上面的-O3也可以提速。
This post has received 1 vote up.
-
This reply was modified 2 years, 9 months ago by suicca.