Commit de43788d authored by April Novak's avatar April Novak
Browse files

Merge branch 'next6' into cardinal-update-8-2

parents 097ea8ee 51d5bf5f
Pipeline #13947 failed with stages
......@@ -2,3 +2,6 @@ build/
CMakeFiles
*.tgz
.vscode/
# From AMGX
plugin_config.cu
......@@ -11,6 +11,8 @@ env:
- OCCA_CUDA_ENABLED=0
- OCCA_HIP_ENABLED=0
- OCCA_OPENCL_ENABLED=0
- NEKRS_OCCA_MODE_DEFAULT=SERIAL
- NEKRS_CI=1
cache:
directories:
......@@ -27,7 +29,7 @@ jobs:
include:
- stage: prepare
name: "install"
script: rm -rf $NEKRS_HOME && cd $TRAVIS_BUILD_DIR && rm -rf build && ./makenrs
script: rm -rf $NEKRS_HOME && cd $TRAVIS_BUILD_DIR && rm -rf build && ./nrsconfig && cmake --build build --target install -j 2
- stage: warmup
name: "warm-up"
script: cd $NEKRS_EXAMPLES/ethier && rm -rf .cache && nrspre ethier 1
......@@ -43,9 +45,21 @@ jobs:
- stage: test
name: "ethier (block) velocity and pressure projection with subcycling"
script: cd $NEKRS_EXAMPLES/ethier && nrsmpi ethier 2 4
- stage: test
name: "ethier default + moving mesh"
script: cd $NEKRS_EXAMPLES/ethier && nrsmpi ethier 2 5
- stage: test
name: "ethier subcycle + moving mesh"
script: cd $NEKRS_EXAMPLES/ethier && nrsmpi ethier 2 6
- stage: test
name: "lowMach default"
script: cd $NEKRS_EXAMPLES/lowMach && nrsmpi lowMach 2 1
- stage: test
name: "mv_cyl"
script: cd $NEKRS_EXAMPLES/mv_cyl && nrsmpi mv_cyl 2 1
- stage: test
name: "mv_cyl + subcycling"
script: cd $NEKRS_EXAMPLES/mv_cyl && nrsmpi mv_cyl 2 2
- stage: test
name: "conj_ht"
script: cd $NEKRS_EXAMPLES/conj_ht && nrsmpi conj_ht 2 1
......
.DS_Store
/build*/
.logamgx
*.cmake
plugin_config.cu
*.sublime-project
*.sublime-workspace
core/src/version.cu
ci/docker/
\ No newline at end of file
CHANGELIST
===============================================================
v2.2.0
---------------------------------------------------------------
- Fixing GPU Direct support (now correct results and better perf)
- Fixing latency hiding (general perf and couple bugfixes in some specific cases)
- Tunings for Volta for agg and classical setup phase
- Gauss-siedel perf improvements on Volta+
- Ampere support
- Minor bugfixes and enhancements including reported/requested by community
Tested configurations:
- Linux x86-64:
-- Ubuntu 20.04, Ubuntu 18.04
-- gcc 7.4.0, gcc 9.3.0
-- OpenMPI 4.0.x
-- CUDA 10.2, 11.0, 11.2
- Windows 10 x86-64:
-- MS Visual Studio 2019 (msvc 19.28)
-- MS MPI v10.1.2
-- CUDA 10.2, 11.0
===============================================================
v2.1.0
---------------------------------------------------------------
- Added new API that allows user to provide distributed matrix partitioning information in a new way - offset to the partition's first row in a matrix. Works only if partitions own continuous rows in matrix.
- Added example case for this new API (see examples/amgx_mpi_capi_cla.c)
- Distributed code improvements
===============================================================
v2.0.0
---------------------------------------------------------------
Initial open source release
\ No newline at end of file
# Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required (VERSION 2.8.10)
# the project
project (AMG)
#disable in-place builds
if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
MESSAGE(FATAL_ERROR "Error: In-place builds are not supported. Please create a separate build directory")
endif(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# set the path to extra modules.
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cuda" ${CMAKE_MODULE_PATH})
# declare the supported configurations
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Profile;RelWithTraces" CACHE STRING "Avaialble Configuration Types" FORCE)
# make sure a build type has been chosen!!!
IF(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are Debug Release Profile RelWithTraces" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# update/define the compilation flags.
IF(WIN32)
set(CMAKE_C_FLAGS "/DWIN32 /D_WINDOWS /W3 /bigobj" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Zl /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL "/D_DEBUG /Zl /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /O2 /Ob2 /D NDEBUG" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /DNOMINMAX /W3 /GR /EHsc /bigobj" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Zl /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "/D_DEBUG /Zl /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG" CACHE STRING "Force flags. /Zl is used to remove deps" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /O2 /Ob2 /DNDEBUG" CACHE STRING "Force flags. /Zl is used to remove deps" FORCE)
ENDIF(WIN32)
# disabling specific warnings
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
# we throw in ~Matrix(), we assume any error fatal so std::terminate call is ok
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-terminate")
endif()
endif()
# min compiler requirements
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.2)
message(
FATAL_ERROR
"AmgX requires GCC >= 4.8.2 but GCC version is \"${CMAKE_CXX_COMPILER_VERSION}\""
)
#else()
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc")
endif()
endif()
FIND_PACKAGE(OpenMP)
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING "")
set(CMAKE_C_FLAGS_RELWITHTRACES "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHTRACES "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHTRACES "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHTRACES "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING "" FORCE)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
# install paths
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ".." CACHE PATH "Path where AMGX will be installed" FORCE)
endif()
# add CMAKE_INSTALL_PREFIX/lib to the RPATH to be used when installing,
# but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# ignore rpath completely, if requested:
set(AMGX_NO_RPATH False CACHE BOOL "Don't build RPATH")
if (${AMGX_NO_RPATH})
set(CMAKE_SKIP_RPATH TRUE)
endif (${AMGX_NO_RPATH})
if (DEFINED ENV{CRAY_MPICH2_DIR})
set(MPI_C_LIBRARIES "$ENV{CRAY_MPICH2_DIR}/lib/libmpich.so")
set(MPI_C_INCLUDE_PATH "$ENV{CRAY_MPICH2_DIR}/include")
endif(DEFINED ENV{CRAY_MPICH2_DIR})
# Thrust:
set (THRUST_DIR "${PROJECT_SOURCE_DIR}/../../thrust")
if (DEFINED ENV{THRUST_ROOT})
set (THRUST_DIR $ENV{THRUST_ROOT})
endif(DEFINED ENV{THRUST_ROOT})
set(AMGX_INCLUDE_EXTERNAL True CACHE BOOL "Include external 3rd party libraries")
if (${AMGX_INCLUDE_EXTERNAL})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRAPIDJSON_DEFINED")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRAPIDJSON_DEFINED")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/external/rapidjson/include")
endif (${AMGX_INCLUDE_EXTERNAL})
set(CMAKE_NO_MPI false CACHE BOOL "Force non-MPI build")
FIND_PACKAGE(MPI)
if (${CMAKE_NO_MPI})
message("Non-MPI build has been forced")
set(MPI_FOUND false)
else (${CMAKE_NO_MPI})
if(${MPI_FOUND})
include_directories(${MPI_INCLUDE_PATH})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DAMGX_WITH_MPI")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAMGX_WITH_MPI")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOMPI_IMPORTS")
endif(WIN32)
endif(${MPI_FOUND})
endif (${CMAKE_NO_MPI})
message ("This is a MPI build:" ${MPI_FOUND})
# enable source level parallel builds in visual studio
#IF(CMAKE_GENERATOR MATCHES "Visual Studio")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /M2 /MP")
#ENDIF (CMAKE_GENERATOR MATCHES "Visual Studio")
# Enable NVTX ranges on Linux
if(NOT WIN32)
set(NVTXRANGE_FLAG "-DNVTX_RANGES;")
endif()
#Configuration specific nvcc flags
GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_NAME "${CMAKE_CXX_COMPILER}" NAME)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_NAME MATCHES "clang")
set(CUDA_NVCC_FLAGS_DEBUG "-g;-G;-std=c++14;--Werror cross-execution-space-call;${NVTXRANGE_FLAG}" CACHE STRING "Debug compiler flags")
set(CUDA_NVCC_FLAGS_RELEASE "-O3;-DNDEBUG;-std=c++14;--Werror cross-execution-space-call;${NVTXRANGE_FLAG}" CACHE STRING "Release compiler flags")
set(CUDA_NVCC_FLAGS_PROFILE "-O3;-DPROFILE;-std=c++14;${NVTXRANGE_FLAG}" CACHE STRING "Profile compiler flags")
set(CUDA_NVCC_FLAGS_RELWITHTRACES "-O3;-DNDEBUG;-DAMGX_USE_CPU_PROFILER;-std=c++14;${NVTXRANGE_FLAG}" CACHE STRING "RelWithTraces compiler flags")
else()
set(CUDA_NVCC_FLAGS_DEBUG "-g;-G;--Werror cross-execution-space-call;${NVTXRANGE_FLAG}" CACHE STRING "Debug compiler flags")
set(CUDA_NVCC_FLAGS_RELEASE "-O3;-DNDEBUG;--Werror cross-execution-space-call;${NVTXRANGE_FLAG}" CACHE STRING "Release compiler flags")
set(CUDA_NVCC_FLAGS_PROFILE "-O3;-DPROFILE;${NVTXRANGE_FLAG}" CACHE STRING "Profile compiler flags")
set(CUDA_NVCC_FLAGS_RELWITHTRACES "-O3;-DNDEBUG;-DAMGX_USE_CPU_PROFILER;${NVTXRANGE_FLAG}" CACHE STRING "RelWithTraces compiler flags")
if(WIN32)
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE} -DNOMINMAX")
endif()
endif()
#keep intermediate files
if (AMGX_keep_intermediate)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler=-keep")
endif(AMGX_keep_intermediate)
#windows/linux specific settings for C
GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_NAME "${CMAKE_C_COMPILER}" NAME)
IF(CMAKE_C_COMPILER_NAME MATCHES cl AND NOT CMAKE_C_COMPILER_NAME MATCHES clang)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
ELSE(CMAKE_C_COMPILER_NAME MATCHES cl AND NOT CMAKE_C_COMPILER_NAME MATCHES clang)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xcompiler=-rdynamic;-Xcompiler=-fPIC;-Xcompiler=-fvisibility=default")
ENDIF(CMAKE_C_COMPILER_NAME MATCHES cl AND NOT CMAKE_C_COMPILER_NAME MATCHES clang)
# VS: include object files in target property SOURCES
# otherwise a workaround for extracting ${obj_all} is necessary below
set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF)
# load CUDA.
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
FIND_PACKAGE(CUDA)
message("Cuda libraries: " ${CUDA_LIBRARIES})
if(MPI_FOUND)
set(VAMPIR_TRACE_INCLUDE_PATH "${MPI_INCLUDE_PATH}/vampirtrace")
set(VAMPIR_TRACE_LIB_PATH "${MPI_INCLUDE_PATH}/../lib")
if (DEFINED ENV{VAMPIR_TRACE_PATH})
message("Found VampirTrace: $ENV{VAMPIR_TRACE_PATH}")
set(VAMPIR_TRACE_PATH "$ENV{VAMPIR_TRACE_PATH}")
set(VAMPIR_TRACE_LIB_PATH "${VAMPIR_TRACE_PATH}/lib")
set(VAMPIR_TRACE_INCLUDE_PATH "${VAMPIR_TRACE_PATH}/include/vampirtrace")
endif (DEFINED ENV{VAMPIR_TRACE_PATH})
set(CMAKE_CXX_FLAGS_RELWITHTRACES "${CMAKE_CXX_FLAGS_RELWITHTRACES} -DAMGX_WITH_MPI;-DAMGX_USE_VAMPIR_TRACE;-DVTRACE;-I${VAMPIR_TRACE_INCLUDE_PATH}")
set(CUDA_NVCC_FLAGS_RELWITHTRACES "${CUDA_NVCC_FLAGS_RELWITHTRACES} -DAMGX_WITH_MPI;-DAMGX_USE_VAMPIR_TRACE;-DVTRACE;-I${VAMPIR_TRACE_INCLUDE_PATH}")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHTRACES "-L${VAMPIR_TRACE_LIB_PATH} -lvt-mpi -L${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/lib64 -lcupti ${CMAKE_EXE_LINKER_FLAGS_RELWITHTRACES}")
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHTRACES "-L${VAMPIR_TRACE_LIB_PATH} -lvt-mpi -L${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/lib64 -lcupti ${CMAKE_SHARED_LINKER_FLAGS_RELWITHTRACES}")
if (DEFINED ENV{VAMPIR_TRACE_PATH})
message("Will use the following include and lib dirs with RelWithTraces: ${VAMPIR_TRACE_INCLUDE_PATH} and ${VAMPIR_TRACE_LIB_PATH}")
set(MPI_C_LIBRARIES "${VAMPIR_TRACE_LIB_PATH}/libvt-mpi.so;${MPI_C_LIBRARIES}")
#set(MPI_C_LIBRARIES "${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/lib64/libcupti.so;${VAMPIR_TRACE_LIB_PATH}/libvt-mpi.so;${MPI_C_LIBRARIES}") // currently needed by mvapich in ubuntuh
endif (DEFINED ENV{VAMPIR_TRACE_PATH})
endif(MPI_FOUND)
#if CUDA Toolkit is older than 9.0
if(CUDA_VERSION_MAJOR LESS 9)
message(FATAL_ERROR "CUDA versions older than 9.0 are not supported")
endif()
#if compiling against CUDA Toolkit 9.x
IF(CUDA_VERSION_MAJOR MATCHES 9)
SET(CUDA_ARCH "70" CACHE STRING "Target Architectures (SM35 SM52 SM60 SM70), multiple are allowed")
ENDIF(CUDA_VERSION_MAJOR MATCHES 9)
#if compiling against CUDA Toolkit 10.x
IF(CUDA_VERSION_MAJOR MATCHES 10)
SET(CUDA_ARCH "70" CACHE STRING "Target Architectures (SM35 SM52 SM60 SM70), multiple are allowed")
IF(CUDA_VERSION_MINOR GREATER 0)
# Disable mixed precision for CUDA 10.1+
# Use the generic cuSPARSE interfaces available from 10.1 on Linux
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -DDISABLE_MIXED_PRECISION -DCUSPARSE_GENERIC_INTERFACES)
ENDIF(CUDA_VERSION_MINOR GREATER 0)
ENDIF(CUDA_VERSION_MAJOR MATCHES 10)
#if compiling against CUDA Toolkit 11.x
IF(CUDA_VERSION_MAJOR MATCHES 11)
SET(CUDA_ARCH "70 80" CACHE STRING "Target Architectures (SM60 SM70 SM80), multiple are allowed")
# Disable mixed precision for CUDA 10.1+
# Use the generic cuSPARSE interfaces available from 10.1 on Linux, cusparseSpGEMM from 11.0
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -DDISABLE_MIXED_PRECISION -DCUSPARSE_GENERIC_INTERFACES -DCUSPARSE_USE_GENERIC_SPGEMM)
ENDIF(CUDA_VERSION_MAJOR MATCHES 11)
#replace ' ' with ; to match the proper cmake format
STRING(REGEX REPLACE " " ";" CUDA_ARCH ${CUDA_ARCH})
#set the compiler flags for each NV target
FOREACH(target ${CUDA_ARCH})
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode=arch=compute_${target},code=\\\"sm_${target},compute_${target}\\\")
ENDFOREACH(target ${CUDA_ARCH})
# write version
set(versionFile "ReleaseVersion.txt")
set(versionCode "core/src/version.cu")
if(${versionFile} IS_NEWER_THAN ${versionCode})
file(STRINGS ${versionFile} versionString)
file(WRITE ${versionCode} "#include <version.h>\n")
file(APPEND ${versionCode} "namespace amgx{\n")
file(APPEND ${versionCode} "const char __AMGX_BUILD_DATE__ [] = __DATE__;\n")
file(APPEND ${versionCode} "const char __AMGX_BUILD_TIME__ [] = __TIME__;\n")
file(APPEND ${versionCode} "const char __AMGX_BUILD_ID__ [] = " ${versionString} ";" \n}\n)
endif(${versionFile} IS_NEWER_THAN ${versionCode})
# plugin management
set(pluginConf "PluginConfig.txt") # plugin configuration
set(pluginCode "${CMAKE_CURRENT_SOURCE_DIR}/plugin_config.cu") # plugin code
file(STRINGS ${pluginConf} pluginList) # plugin list
set(libList base core ${pluginList}) # lib list
# create initialization and finalization for plugins
if(${pluginConf} IS_NEWER_THAN ${pluginCode})
file(WRITE ${pluginCode} "#include <error.h>\n")
file(APPEND ${pluginCode} "#include <misc.h>\n")
file(APPEND ${pluginCode} "namespace amgx {\n")
foreach( plugin ${pluginList} )
file(APPEND ${pluginCode} "namespace ${plugin} { extern AMGX_ERROR initialize(); extern void finalize(); }\n")
endforeach(plugin)
file(APPEND ${pluginCode} "\nAMGX_ERROR initializePlugins() {\n")
foreach( plugin ${pluginList} )
file(APPEND ${pluginCode} " if (AMGX_OK != ${plugin}::initialize()) return AMGX_ERR_PLUGIN;\n")
endforeach(plugin)
file(APPEND ${pluginCode} " return AMGX_OK;\n")
file(APPEND ${pluginCode} "}\n")
file(APPEND ${pluginCode} "\nvoid finalizePlugins() {\n")
foreach( plugin ${pluginList} )
file(APPEND ${pluginCode} " ${plugin}::finalize();\n")
endforeach(plugin)
file(APPEND ${pluginCode} "}\n")
file(APPEND ${pluginCode} "} // namespace amgx\n")
endif(${pluginConf} IS_NEWER_THAN ${pluginCode})
# WARNING: the placement of the following two if statements is important, they have to come after
# FIND_PACKAGE(CUDA) and before create list of all sources/objects in amgx. Since the scripts used
# to compile CUDA are generated at configure time. This means that the scripts are generated based
# on the values of variables at the point of call (the two phases of cmake are configure then generate).
#include magma
if (MAGMA_ROOT_DIR)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-DAMGX_USE_MAGMA")
CUDA_INCLUDE_DIRECTORIES(${MAGMA_ROOT_DIR}/include)
set(magma_libs ${MAGMA_ROOT_DIR}/lib/libmagma.a)
endif(MAGMA_ROOT_DIR)
#include lapack (MKL)
if (MKL_ROOT_DIR)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-DAMGX_USE_LAPACK")
CUDA_INCLUDE_DIRECTORIES(${MKL_ROOT_DIR}/include)
#WARNING: MKL link line flags vary significantly (please double check http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor)
set(mkl_libs -Wl,--start-group ${MKL_ROOT_DIR}/lib/intel64/libmkl_intel_lp64.a ${MKL_ROOT_DIR}/lib/intel64/libmkl_gnu_thread.a ${MKL_ROOT_DIR}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -fopenmp)
endif(MKL_ROOT_DIR)
#create a list of all sources in amgx
set(src_all) # collect all sources from libs
set(target_all) # collect all targets from libs
set(tests_all)
foreach( lib ${libList} )
add_subdirectory(${lib})
get_target_property(src amgx_${lib} SOURCES)
set(src_all ${src_all} ${src})
set(target_all ${target_all} amgx_${lib})
FILE(GLOB_RECURSE TESTS "${CMAKE_CURRENT_SOURCE_DIR}/${lib}/tests/*.cu")
set(tests_all ${tests_all} ${TESTS})
endforeach(lib)
# create a list of all objects in amgx
set(obj_all)
set(cpp_all)
foreach( src ${src_all} )
if(${src} MATCHES ${CMAKE_BINARY_DIR})
set(obj_all ${obj_all} ${src})
else(${src} MATCHES ${CMAKE_BINARY_DIR})
set(cpp_all ${cpp_all} ${src})
endif(${src} MATCHES ${CMAKE_BINARY_DIR})
endforeach(src)
# build amgx
set_source_files_properties(${obj_all} PROPERTIES GENERATED TRUE)
#CUDA_ADD_LIBRARY(amgx STATIC ${obj_all} ) # static lib
CUDA_ADD_LIBRARY(amgxsh SHARED ${obj_all} ) # shared lib
if (target_all)
# add_dependencies(amgx ${target_all})
add_dependencies(amgxsh ${target_all})
endif (target_all)
find_library_local_first(cublas_library cublas "The cuBLAS CUDA library")
find_library_local_first(cusparse_library cusparse "The cusparse CUDA library")
find_library_local_first(cusolver_library cusolver "The cusolver CUDA library")
IF (WIN32)
#target_link_libraries( amgx ${cublas_library} ${cusparse_library} ${cusolver_library})
target_link_libraries( amgxsh ${cublas_library} ${cusparse_library} ${cusolver_library})
ELSE (WIN32)
find_library_local_first(nvtx nvToolsExt "nvtx CUDA library")
# target_link_libraries( amgx ${cublas_library} ${cusparse_library} ${cusolver_library} ${nvtx} m pthread)
target_link_libraries( amgxsh ${cublas_library} ${cusparse_library} ${cusolver_library} ${nvtx} m pthread)
ENDIF(WIN32)
if(MPI_FOUND)
# target_link_libraries( amgx ${MPI_C_LIBRARIES})
target_link_libraries( amgxsh ${MPI_C_LIBRARIES})
endif(MPI_FOUND)
#link magma
if (MAGMA_ROOT_DIR)
# target_link_libraries(amgx ${magma_libs})
target_link_libraries(amgxsh ${magma_libs})
endif(MAGMA_ROOT_DIR)
#link lapack (MKL)
if (MKL_ROOT_DIR)
# target_link_libraries(amgx ${mkl_libs} )
target_link_libraries(amgxsh ${mkl_libs})
endif(MKL_ROOT_DIR)
#install(TARGETS amgx DESTINATION "lib")
install(TARGETS amgxsh DESTINATION "lib")
export(TARGETS amgxsh FILE ${CMAKE_CURRENT_SOURCE_DIR}/amgxsh.cmake)
# build examples
#add_subdirectory(examples)
#if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/eigen_examples)
# add_subdirectory(eigen_examples)
#endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/eigen_examples)
# build unit tests
#if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests)
# add_subdirectory(tests)
#endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests)
Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of NVIDIA CORPORATION nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Cusb-Library V0.3.0
Copyright Statements
Copyright 2008-2013 NVIDIA Corporation
License Text (http://spdx.org/licenses/Apache-2.0)
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable