Replies: 21 comments 1 reply
-
I have parallelize part of following functions in a new branch
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html |
Beta Was this translation helpful? Give feedback.
-
https://stackoverflow.com/questions/49816206/cmake-find-package-specify-path |
Beta Was this translation helpful? Give feedback.
-
使用cmake自带的FindOpenMP.cmake进行配置,在system_lib_loading.cmake内修改
set(OpenMP_ROOT /Users/chongran/lib/lib-omp)
find_package(OpenMP REQUIRED)
include_directories(${OpenMP_CXX_INCLUDE_DIR})
set(EXTRA_LINK_LIBS ${EXTRA_LINK_LIBS} ${OpenMP_CXX_LIBRARIES})
if(OPENMP_CXX_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
if( ${CMAKE_BUILD_TYPE} MATCHES "Release" )
set(CMAKE_CXX_FLAGS " -O3 -Wall ")
else( ${CMAKE_BUILD_TYPE} MATCHES "Release" )
set(CMAKE_CXX_FLAGS " -DENABLE_TEST -O0 -Wall ")
endif( ${CMAKE_BUILD_TYPE} MATCHES "Release" ) 变为 if( ${CMAKE_BUILD_TYPE} MATCHES "Release" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall ")
else( ${CMAKE_BUILD_TYPE} MATCHES "Release" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_TEST -O0 -Wall ")
endif( ${CMAKE_BUILD_TYPE} MATCHES "Release" ) |
Beta Was this translation helpful? Give feedback.
-
Conditional use of OpenMP https://stackoverflow.com/questions/56717411/control-conditional-openmp-in-define-macro |
Beta Was this translation helpful? Give feedback.
-
https://stackoverflow.com/questions/45477355/difference-between-pragma-and-pragma-in-c |
Beta Was this translation helpful? Give feedback.
-
https://www.dealii.org/current/doxygen/deal.II/config_8h_source.html |
Beta Was this translation helpful? Give feedback.
-
我们或许可以调控对每个exeutable文件的编译flag,参考这个 @ZhaoChongran |
Beta Was this translation helpful? Give feedback.
-
@ZhaoChongran |
Beta Was this translation helpful? Give feedback.
-
我将OpenMP的配置转移到了gosh_to_vtk的CMakeLists.txt中,并且通过测试,对于Preprocess的单独链接,可以等到Preprocess改完之后再进行调整。 |
Beta Was this translation helpful? Give feedback.
-
我在Sys_Tools.hpp中加入了一个宏用于设置线程数的大小,并且在GmshIO的构造函数中调用了设置线程数的函数: |
Beta Was this translation helpful? Give feedback.
-
不知道是否有根据系统来设置线程数的手段 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
由于openmp在Sys_Tool.hpp的头文件中,而cmake貌似无法对hpp文件指定编译选项,暂时只能修改全局的编译选项。 |
Beta Was this translation helpful? Give feedback.
-
已完成的预处理并行化:
|
Beta Was this translation helpful? Give feedback.
-
OpenMP detail
OpenMP Performance Test设备信息:
gmsh_to_vtk
单位:秒(s) preprocess
单位:秒(s) 注:目前 |
Beta Was this translation helpful? Give feedback.
-
@ZhaoChongran 我做的改动是在每个example的cmake的最后添加了一个对openmp的链接指令。包括使用特定的编译指令(SET_TARGET_PROPERTIES), 添加头文件的地址(TARGET_INCLUDE_DIRECTORIES),链接库(TARGET_LINK_LIBRARIES)。这一动作保证了仅对特定的库和可执行文件进行openmp的链接。 相应的,在tools/gmsh_to_vtk中,我也改动了cmake文件。可以编译。但我手头没有合适的测试文件。你可以跑一下。 |
Beta Was this translation helpful? Give feedback.
-
In at least two parts, the procedure can be accelerated by an OpenMP type parallelization:
Beta Was this translation helpful? Give feedback.
All reactions