Skip to content

Commit

Permalink
Trilinos build: enable CUDA and Tpetra-based solver packages (Belos, …
Browse files Browse the repository at this point in the history
…Amesos2, Ifpack2, MueLu)
  • Loading branch information
klevzoff committed Jul 29, 2020
1 parent c7b3f03 commit 2efb469
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
41 changes: 33 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ if (ENABLE_TRILINOS)

message(STATUS "TRILINOS_EXTRA_ARGS = ${TRILINOS_EXTRA_ARGS}")

if( ${ENABLE_MPI} )
if( ENABLE_MPI )
set( TRILINOS_C_COMPILER ${MPI_C_COMPILER} )
set( TRILINOS_CXX_COMPILER ${MPI_CXX_COMPILER} )
set( TRILINOS_Fortran_COMPILER ${MPI_Fortran_COMPILER} )
Expand All @@ -659,6 +659,11 @@ if (ENABLE_TRILINOS)
set( TRILINOS_Fortran_COMPILER ${CMAKE_Fortran_COMPILER} )
endif()

if( ENABLE_CUDA )
set( TRILINOS_CXX_FLAGS "${TRILINOS_CXX_FLAGS} -ccbin ${TRILINOS_CXX_COMPILER} -arch=${CUDA_ARCH} --expt-extended-lambda --expt-relaxed-constexpr" )
set( TRILINOS_CXX_COMPILER ${CMAKE_CURRENT_BINARY_DIR}/trilinos/src/trilinos/packages/kokkos/bin/nvcc_wrapper )
endif()

ExternalProject_Add( trilinos
PREFIX ${PROJECT_BINARY_DIR}/trilinos
URL ${TRILINOS_URL}
Expand All @@ -678,13 +683,15 @@ if (ENABLE_TRILINOS)
-D CMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}
-D CMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-D CMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-D TPL_ENABLE_MPI:BOOL=${ENABLE_MPI}
-D BUILD_SHARED_LIBS:BOOL=ON
-D CMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE}
-D CMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
-D BUILD_SHARED_LIBS:BOOL=ON
-D CUDA_ROOT:PATH=${CUDA_TOOLKIT_ROOT_DIR}
-D TPL_ENABLE_MPI:BOOL=${ENABLE_MPI}
-D TPL_ENABLE_CUDA:BOOL=${ENABLE_CUDA}
-D Trilinos_ENABLE_OpenMP:BOOL=${ENABLE_OPENMP}
-D Trilinos_ENABLE_Fortran:BOOL=ON
-D Trilinos_WARNINGS_AS_ERRORS_FLAGS:STRING=""
-D CMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE}
-D Trilinos_ENABLE_TESTS:BOOL=OFF
-D Trilinos_ENABLE_Gtest:BOOL=OFF
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF
Expand All @@ -695,14 +702,31 @@ if (ENABLE_TRILINOS)
-D Trilinos_ENABLE_Kokkos:BOOL=ON
-D Trilinos_ENABLE_Stratimikos:BOOL=ON
-D Trilinos_ENABLE_Amesos:BOOL=ON
-D Trilinos_ENABLE_Amesos2:BOOL=ON
-D Trilinos_ENABLE_AztecOO:BOOL=ON
-D Trilinos_ENABLE_Belos:BOOL=ON
-D Trilinos_ENABLE_Ifpack:BOOL=ON
-D Trilinos_ENABLE_Ifpack2:BOOL=ON
-D Trilinos_ENABLE_Teuchos:BOOL=ON
-D Trilinos_ENABLE_ML:BOOL=ON
-D Trilinos_ENABLE_MueLu:BOOL=ON
-D Trilinos_ENABLE_Thyra:BOOL=ON
-D Trilinos_ENABLE_STK:BOOL=OFF
-D Trilinos_ENABLE_TrilinosCouplings:BOOL=ON
-D Trilinos_ENABLE_TrilinosCouplings:BOOL=OFF
-D Trilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=ON
-D Trilinos_ENABLE_COMPLEX_DOUBLE:BOOL=OFF
-D KOKKOS_ENABLE_CUDA:BOOL=${ENABLE_CUDA}
-D KOKKOS_ENABLE_CUDA_LAMBDA:BOOL=${ENABLE_CUDA}
-D KOKKOS_ENABLE_CUDA_UVM:BOOL=${ENABLE_CUDA}
-D Tpetra_ENABLE_CUDA:BOOL=${ENABLE_CUDA}
-D Tpetra_INST_SERIAL:BOOL=ON
-D Tpetra_INST_INT_LONG_LONG:BOOL=ON
-D Tpetra_INST_INT_INT:BOOL=OFF
-D Tpetra_INST_DOUBLE:BOOL=ON
-D Tpetra_INST_COMPLEX_DOUBLE:BOOL=OFF
-D Belos_ENABLE_Tpetra:BOOL=ON
-D Belos_ENABLE_Epetra:BOOL=OFF
-D Belos_ENABLE_Xpetra:BOOL=OFF
${TRILINOS_EXTRA_ARGS}
)

Expand Down Expand Up @@ -913,9 +937,10 @@ if( ENABLE_PETSC )

message(STATUS "Building PETSC found at ${PETSC_URL}")

set(PETSC_C_FLAGS "-fPIC ${C_FLAGS_NO_WARNINGS} ${CMAKE_C_FLAGS_RELEASE}")
set(PETSC_CXX_FLAGS "-fPIC ${CXX_FLAGS_NO_WARNINGS} ${CMAKE_CXX_FLAGS_RELEASE}")
set(PETSC_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_RELEASE}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" bt_uc)
set(PETSC_C_FLAGS "-fPIC ${C_FLAGS_NO_WARNINGS} ${CMAKE_C_FLAGS_${bt_uc}}")
set(PETSC_CXX_FLAGS "-fPIC ${CXX_FLAGS_NO_WARNINGS} ${CMAKE_CXX_FLAGS_${bt_uc}}")
set(PETSC_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_${bt_uc}}")

if (ENABLE_OPENMP)
set(PETSC_OPENMP_FLAG --with-openmp=1)
Expand Down
6 changes: 3 additions & 3 deletions docker/clang-cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ ARG TMP_DIR
ARG TPL_SRC_DIR=${TMP_DIR}/thirdPartyLibs
ARG TPL_BUILD_DIR=${TMP_DIR}/build

ARG CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
ARG CUDA_ARCH=sm_70
ARG CMAKE_CUDA_COMPILER=${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc
ENV CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
ENV CUDA_ARCH=sm_70
ENV CMAKE_CUDA_COMPILER=${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc

COPY . ${TPL_SRC_DIR}
RUN ${TPL_SRC_DIR}/docker/configure_tpl_build.sh \
Expand Down

0 comments on commit 2efb469

Please sign in to comment.