Hi again Jeannie,
CMake can output to many build systems, including make. Setting the BEAGLE_OMP_MODE value to STATIC and DYNAMIC does more than setting the -fopenmp flag to GCC. There are some C preprocessor flags and compilier options set, and the classes OpenMP and RandomizerMulti are compiled with the main library. I would advice you to look at this snippet of CMake configuration below for the BEAGLE_OMP_MODE option in the CMakeList.txt file of Open BEAGLE 4.0-alpha2 to figure out what is done (the syntax is quite direct, you should be able to understand what is happenning).
Best,
Christian
if(OPENMP_FOUND)
message(STATUS "++ OpenMP found")
if(NOT DEFINED BEAGLE_OMP_MODE)
message(STATUS "++ If you want to enable OpenMP, set BEAGLE_OMP_MODE to STATIC or DYNAMIC, depending in which mode scheduler should work.")
set(BEAGLE_OMP_MODE "NONE" CACHE STRING "OpenMP scheduler modes : NONE (do not use OpenMP at all), STATIC (reproducible results), DYNAMIC (non-reproducible results)")
endif(NOT DEFINED BEAGLE_OMP_MODE)
string(TOUPPER ${BEAGLE_OMP_MODE} BEAGLE_OMP_MODE)
if(BEAGLE_OMP_MODE MATCHES "NONE")
message(STATUS "++ OpenMP is not enabled, set BEAGLE_OMP_MODE to STATIC | DYNAMIC to enable it.")
set(BEAGLE_USE_OMP_R False)
set(BEAGLE_USE_OMP_NR False)
elseif(BEAGLE_OMP_MODE MATCHES "STATIC")
message(STATUS "++ OpenMP enabled, scheduler set to static mode.")
set(BEAGLE_USE_OMP_R True)
set(BEAGLE_USE_OMP_NR False)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
elseif(BEAGLE_OMP_MODE MATCHES "DYNAMIC")
message(STATUS "++ OpenMP enabled, scheduler set to dynamic mode.")
set(BEAGLE_USE_OMP_NR True)
set(BEAGLE_USE_OMP_R False)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else(BEAGLE_OMP_MODE MATCHES "NONE")
message(STATUS "++ Invalid value for BEAGLE_OMP_MODE : NONE | STATIC | DYNAMIC expected, but found ${BEAGLE_OMP_MODE}; OpenMP is disabled.")
set(BEAGLE_OMP_MODE "NONE" CACHE STRING "OpenMP scheduler modes : NONE (do not use OpenMP at all), STATIC (reproducible results), DYNAMIC (non-reproducible results)")
set(BEAGLE_USE_OMP_R False)
set(BEAGLE_USE_OMP_NR False)
endif(BEAGLE_OMP_MODE MATCHES "NONE")
if(NOT BEAGLE_OMP_MODE MATCHES "NONE")
set(BEAGLE_HAVE_OPENMP 1)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "++ Compiling with GNU, parallel version of STL algorithms will be used if they are available.")
execute_process(COMMAND gcc -dumpversion OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION)
if(CMAKE_CXX_COMPILER_VERSION MATCHES "4?\\.[3-9]?\\.[0-9]")
message(STATUS "GCC ${CMAKE_CXX_COMPILER_VERSION} found, enabling parallel STL")
set(CMAKE_REQUIRED_FLAGS "-L${PACC_LIB_FOUND_DIR} -I${PACC_INCLUDE_FOUND_DIR} -lpacc -fopenmp -D_GLIBCXX_PARALLEL")
message(STATUS "++ Check if PACC has been compiled with parallel STL...")
PerformTest(PACC_HAVE_PARALLEL_STL)
if(NOT PACC_HAVE_PARALLEL_STL)
message("!! Warning : your PACC library has not been compiled with parallel version of STL, forced to disable parallel STL for beagle too...")
else(NOT PACC_HAVE_PARALLEL_STL)
message(STATUS "++ PACC parallel STL ok...")
add_definitions(-D_GLIBCXX_PARALLEL)
endif(NOT PACC_HAVE_PARALLEL_STL)
set(CMAKE_REQUIRED_FLAGS) # Unset modified CMake variables
else(CMAKE_CXX_COMPILER_VERSION MATCHES "4?\\.[3-9]?\\.[0-9]")
message(STATUS "Parallel STL requires GCC >= 4.3, you are using ${CMAKE_CXX_COMPILER_VERSION}")
endif(CMAKE_CXX_COMPILER_VERSION MATCHES "4?\\.[3-9]?\\.[0-9]")
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif(NOT BEAGLE_OMP_MODE MATCHES "NONE")
mark_as_advanced(BEAGLE_USE_OMP_R BEAGLE_USE_OMP_NR)
else(OPENMP_FOUND)
message(STATUS "++ OpenMP not found")
endif(OPENMP_FOUND)
if(NOT BEAGLE_USE_OMP_NR AND NOT BEAGLE_USE_OMP_R)
set(BEAGLE_OPENMP_FILES "OpenMP.cpp RandomizerMulti.cpp")
else(NOT BEAGLE_USE_OMP_NR AND NOT BEAGLE_USE_OMP_R)
set(BEAGLE_OPENMP_FILES "null")
endif(NOT BEAGLE_USE_OMP_NR AND NOT BEAGLE_USE_OMP_R)