4
在MacOS中使用OpenMP
source link: https://itlanyan.com/using-openmp-on-macos/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
在MacOS中使用OpenMP
CMake 3.9对 OpenMP 的支持有了很大的提升,但是根据Modern CMake中的教程,如下配置可能不会生效:
find_package(OpenMP) if(OpenMP_CXX_FOUND) target_link_libraries(MyTarget PUBLIC OpenMP::OpenMP_CXX) endif()
而是可能出现如下提示:
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
解决办法为:
1. 先安装 libomp
:
brew install libomp
2. 如果安装后再运行CMake无错误提示,那就直接可以用。如果还是报同样的错误,则需要继续设置环境变量:
export OpenMP_ROOT=$(brew --prefix)/opt/libomp
AD:【国外VPS推荐】 搬瓦工三网回程CN2 GIA VPS,季付46.87$
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK