-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add the uammd_setup_target cmake function * Update UAMMDSetup.cmake * test * test * test * test * test * cleanup * Tweak * Update * update * Update * Update findUAMMD and UAMMDSetup * Update examples * Remove old code * Update some CMakeLists.txt * Update * Try CI fix * Disable CUDA 10
- Loading branch information
1 parent
ad96364
commit 068b3a9
Showing
23 changed files
with
113 additions
and
584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
include_guard(GLOBAL) | ||
|
||
function(uammd_setup_target target_name) | ||
if (NOT CMAKE_CUDA_COMPILER) | ||
message(FATAL_ERROR "CUDA is required but not enabled! \ | ||
You must call enable_language(CUDA) in your main CMakeLists.txt BEFORE calling uammd_setup_target().") | ||
endif() | ||
if (NOT TARGET BLAS::BLAS) | ||
message(FATAL_ERROR "BLAS is required but not enabled! \ | ||
You must call find_package(BLAS) in your main CMakeLists.txt BEFORE calling uammd_setup_target().") | ||
endif() | ||
# Ensure the target has C++ and CUDA standards | ||
target_compile_features(${target_name} PUBLIC cxx_std_14) | ||
target_compile_features(${target_name} PUBLIC cuda_std_14) | ||
|
||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") | ||
target_compile_options(${target_name} PRIVATE --expt-relaxed-constexpr -extended-lambda) | ||
endif() | ||
|
||
# Find and link necessary libraries | ||
if(BLAS_FOUND) | ||
message(DEBUG "MKL environment detected") | ||
target_compile_definitions(${target_name} PUBLIC USE_MKL) | ||
target_link_libraries(${target_name} PUBLIC BLAS::BLAS) | ||
find_path(BLAS_INCLUDE_DIRS mkl.h PATHS $ENV{CONDA_PREFIX}/include /usr/include /usr/local/include $ENV{MKLROOT}/include $ENV{BLAS_HOME}/include) | ||
else() | ||
unset(BLA_VENDOR) | ||
find_package(LAPACK REQUIRED) | ||
find_package(LAPACKE REQUIRED) | ||
target_link_libraries(${target_name} PUBLIC ${LAPACK_LIBRARIES} ${LAPACKE_LIBRARIES}) | ||
endif() | ||
|
||
# Set include paths | ||
target_include_directories(${target_name} PUBLIC ${BLAS_INCLUDE_DIRS} ${LAPACKE_INCLUDE_DIRS}) | ||
target_link_libraries(${target_name} PUBLIC ${CUDA_LIBRARY} cufft cublas cusolver curand) | ||
if (NOT DEFINED UAMMD_INCLUDE_DIRS) | ||
if (DEFINED uammd_SOURCE_DIR) | ||
set(UAMMD_INCLUDE_DIRS "${uammd_SOURCE_DIR}/src" "${uammd_SOURCE_DIR}/src/third_party") | ||
else() | ||
find_path(UAMMD_INCLUDE_DIR | ||
NAMES uammd.h | ||
PATHS ${CMAKE_INSTALL_PREFIX}/include ${CMAKE_PREFIX_PATH}/include | ||
NO_DEFAULT_PATH | ||
) | ||
if (UAMMD_INCLUDE_DIR) | ||
set(UAMMD_INCLUDE_DIRS "${UAMMD_INCLUDE_DIR}") | ||
else() | ||
message(FATAL_ERROR "Could not find UAMMD include directories! \ | ||
Make sure UAMMD is installed or fetched correctly.") | ||
endif() | ||
endif() | ||
endif() | ||
target_include_directories(${target_name} PUBLIC ${UAMMD_INCLUDE_DIRS}) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.