From ed91f1d15c15211f7fc098c5f869e8e9572c3d4e Mon Sep 17 00:00:00 2001 From: Patrick Vogler Date: Fri, 28 Jun 2024 11:28:34 +0200 Subject: [PATCH] Added the option to enable OpenMP parallelization during debug --- .gitignore | 14 +++++++------- CMakeLists.txt | 3 ++- Makefile | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index b8d6944..61533a3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,6 @@ # Prerequisites *.d -# Data Files -*.bwc -*.eas - # Object files *.o *.ko @@ -135,9 +131,13 @@ share/python-wheels/ MANIFEST # Files and Archives -.eas -.npz -.zip +*.eas +*.npz +*.zip +*.bwc + +# Profiling assets +valgrind-out.txt # PyInstaller # Usually these files are written by a python script from a template diff --git a/CMakeLists.txt b/CMakeLists.txt index b03f1c7..2af498b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,8 @@ message(STATUS "Compiling with C++ standard: ${CMAKE_CXX_STANDARD}") # Check if the OpenMP package is available for the current # # setup and set the appropriate C/C++ flags. # #----------------------------------------------------------# -if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR ${OMP}) + message(STATUS "Enable OpenMP parallelization") find_package(OpenMP) if (OPENMP_FOUND) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") diff --git a/Makefile b/Makefile index e21ea6e..ddab9ce 100755 --- a/Makefile +++ b/Makefile @@ -54,6 +54,7 @@ .PHONY: tool .PHONY: profiling +.PHONY: omp .PHONY: eas3 .PHONY: netCDF @@ -80,6 +81,8 @@ BUILD_TOOL="False" BUILD_PROF="False" +BUILD_OMP="False" + BUILD_EAS3="False" BUILD_NETCDF="False" @@ -138,6 +141,8 @@ help: @echo "" @echo " profiling Enable Profiling." @echo "" + @echo " omp Enable OpenMP parallelization." + @echo "" @echo " eas3 Adds support for the eas3 file format to the com-" @echo " mand line tool." @echo "" @@ -166,11 +171,17 @@ tool: $(eval BUILD_TOOL="True") #*--------------------------------------------------------*# -# Define target used to activate command line tool build. # +# Define target used to activate profiling. # #*--------------------------------------------------------*# profiling: $(eval BUILD_PROF="True") +#*--------------------------------------------------------*# +# Define target used to activate OpenMP parallelization. # +#*--------------------------------------------------------*# +omp: + $(eval BUILD_OMP="True") + #*--------------------------------------------------------*# # Define targets used to activate file format support. # #*--------------------------------------------------------*# @@ -222,7 +233,7 @@ display: # Define the main compile command targets. # #*--------------------------------------------------------*# build_bwc: - mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DPROF=${BUILD_PROF}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j + mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DPROF=${BUILD_PROF}" "-DOMP=${BUILD_OMP}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j clean: - /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public \ No newline at end of file