Skip to content
Snippets Groups Projects
Commit 9d88bc82 authored by cmaffeo2's avatar cmaffeo2
Browse files

Merge branch 'feat/cmake'

parents f45995af 695ba965
No related branches found
No related tags found
No related merge requests found
## Specify the project
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
if(NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 70 75)
endif()
# option(USE_CUDA "Use CUDA" ON)
set(USE_CUDA ON)
if(USE_CUDA)
# set the project name and version
project(arbd VERSION 1.2 LANGUAGES CXX CUDA)
project(arbd VERSION 1.2 LANGUAGES CXX CUDA)
else(USE_CUDA)
project(arbd VERSION 1.2 LANGUAGES CXX)
project(arbd VERSION 1.2 LANGUAGES CXX)
endif()
# specify the C++ standard
## specify the C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_VERBOSE_MAKEFILE True)
# Set a default build type if none was specified
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" "RelWithDebInfo" "MinSizeRel")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
## Some CMake versions use -O2 for release; replace with -O3
string(REPLACE "-O2" "-O3" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
string(REPLACE "-O2" "-O3" CMAKE_CUDA_FLAGS_RELEASE ${CMAKE_CUDA_FLAGS_RELEASE})
endif()
## OPTIONS
option(USE_NCCL "Use NCCL for single node GPU peer communication" ON)
option(USE_NCCL "Use NCCL for single node GPU peer communication" False)
option(USE_NVTX "Build with NVTX profiling ranges" False)
option(DEBUG "Build with debug flags" False)
# (not yet optional) message(STATUS "USE_CUDA: ${USE_CUDA}")
message(STATUS "USE_NCCL: ${USE_NCCL}")
message(STATUS "USE_NVTX: ${USE_NVTX}")
message(STATUS "DEBUG: ${DEBUG}")
## Set flags before adding executable
# configure_file(TutorialConfig.h.in TutorialConfig.h)
message(STATUS "USE_CUDA: ${USE_CUDA}")
if(USE_CUDA)
add_definitions(-DUSE_CUDA)
## CUDA_INCLUDE_DIRS wasn't getting set on my system with cmake 3.14.1, so check if in env
if(DEFINED ENV{CUDA_INCLUDE_DIRS})
add_definitions(-DUSE_CUDA)
## CUDA_INCLUDE_DIRS wasn't getting set on my system with cmake 3.14.1, so check if in env
if(DEFINED ENV{CUDA_INCLUDE_DIRS})
set(CUDA_INCLUDE_DIRS $ENV{CUDA_INCLUDE_DIRS})
endif()
message(STATUS "CUDA_INC: ${CUDA_INCLUDE_DIRS}")
include_directories(${CUDA_INCLUDE_DIRS})
endif()
# message(STATUS "CUDA_INC: ${CUDA_INCLUDE_DIRS}")
include_directories(${CUDA_INCLUDE_DIRS})
endif()
if(USE_NVTX)
add_definitions(-DUSE_NVTX)
endif()
if(USE_NCCL)
add_definitions(-DUSE_NCCL)
target_link_libraries(arbd PRIVATE nccl)
endif()
## Two lines below needed?
......@@ -45,47 +85,51 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_MACOSX_RPATH 1) # Unsure if this works for CMAKE_BUIlD_RPATH, or just CMAKE_INSTALL_RPATH
set(CMAKE_BUILD_RPATH "${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}")
# set(CMAKE_VERBOSE_MAKEFILE True)
add_executable(arbd arbd.cpp
Configuration.cpp
FlowForce.cpp
GPUManager.cpp
Scatter.cpp
SignalManager.cpp
WKFUtils.cpp
Angle.cu
BaseGrid.cu
BrownianParticle.cu
BrownianParticleType.cpp
RigidBodyController.cu
RigidBody.cu
RigidBodyGrid.cu
RigidBodyType.cu
CellDecomposition.cu
ComputeForce.cuh
ComputeForce.cu
ComputeGridGrid.cuh
ComputeGridGrid.cu
CudaUtil.cu
CudaUtil.cuh
Dihedral.cu
Exclude.cu
GrandBrownTown.cu
GrandBrownTown.cuh
imd.cpp
vmdsock.cpp
JamesBond.cu
RandomCUDA.cu
Reservoir.cu
TabulatedAngle.cu
TabulatedDihedral.cu
TabulatedMethods.cuh
TabulatedPotential.cu
useful.cu
)
target_link_libraries(arbd PRIVATE curand)
message(STATUS "Run: ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS")
## target_link_libraries(ARBD PUBLIC) MPI::MPI_CXX)
Configuration.cpp
FlowForce.cpp
GPUManager.cpp
Scatter.cpp
SignalManager.cpp
WKFUtils.cpp
Angle.cu
BaseGrid.cu
BrownianParticle.cu
BrownianParticleType.cpp
RigidBodyController.cu
RigidBody.cu
RigidBodyGrid.cu
RigidBodyType.cu
CellDecomposition.cu
ComputeForce.cuh
ComputeForce.cu
ComputeGridGrid.cuh
ComputeGridGrid.cu
CudaUtil.cu
CudaUtil.cuh
Dihedral.cu
Exclude.cu
GrandBrownTown.cu
GrandBrownTown.cuh
imd.cpp
vmdsock.cpp
JamesBond.cu
RandomCUDA.cu
Reservoir.cu
TabulatedAngle.cu
TabulatedDihedral.cu
TabulatedMethods.cuh
TabulatedPotential.cu
useful.cu
)
## Add optional libraries
if(USE_CUDA)
target_link_libraries(arbd PRIVATE curand)
endif()
if(USE_NCCL)
target_link_libraries(arbd PRIVATE nccl)
endif()
install(TARGETS arbd)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment