Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify CMakeLists to allow using MPI instead of OpenMP #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,35 @@ SET(CMAKE_CXX_STANDARD_REQUIRED ON)

PROJECT(FDPS_SPH)

#Bring the headers, such as Student.h into the project
#Bring the headers into the project
INCLUDE_DIRECTORIES(src FDPS/src)

SET(DEFAULT_BUILD_TYPE "Release")

IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
MESSAGE(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
SET(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF()

SET(CMAKE_CXX_FLAGS "-DPARTICLE_SIMULATOR_THREAD_PARALLEL -fopenmp -DPARTICLE_SIMULATOR_ALL_64BIT_PRECISION -DFAST_COMM_FOR_2ND_EXCHANGE")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -funroll-loops")
SET(CMAKE_CXX_FLAGS "-DPARTICLE_SIMULATOR_ALL_64BIT_PRECISION -DFAST_COMM_FOR_2ND_EXCHANGE -lm" CACHE STRING "compile flags" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -funroll-loops" CACHE STRING "compile flags release mode" FORCE)

SET(FDPS_USE_MPI OFF CACHE BOOL "Use MPI for parallelization.")

IF(FDPS_USE_MPI)
SET(CMAKE_CXX_FLAGS "-DPARTICLE_SIMULATOR_MPI_PARALLEL ${CMAKE_CXX_FLAGS}" CACHE STRING "compile flags release model" FORCE)
ELSE()
SET(CMAKE_CXX_FLAGS "-DPARTICLE_SIMULATOR_THREAD_PARALLEL -fopenmp ${CMAKE_CXX_FLAGS}" CACHE STRING "compile flags release model" FORCE)
ENDIF()

MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
MESSAGE(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
MESSAGE(STATUS "FDPS_USE_MPI: ${FDPS_USE_MPI}")

ADD_EXECUTABLE(sph.out src/main.cpp)