Skip to content

build: Add Maple host configs #3616

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

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
116 changes: 116 additions & 0 deletions host-configs/TOTAL/maple-common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
##------------------------------------------------------------------------------
## add_third_party_libraries()
##
## Searches for the tpls.cmake file and includes it if found
## If this is not found, the assumption is that this is a compilation of the
## third party libraries.
##
##------------------------------------------------------------------------------
macro(add_third_party_libraries)
find_file(TPLS_CMAKE tpls.cmake
PATHS ${CMAKE_SOURCE_DIR}/../host-configs
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/.. )

if ( TPLS_CMAKE )
message( STATUS "tpls.cmake found: ${TPLS_CMAKE}")
if ( NOT DEFINED GEOS_TPL_DIR )
if ( DEFINED ENV{GEOS_TPL_DIR} )
set( GEOS_TPL_DIR "$ENV{GEOS_TPL_DIR}" CACHE PATH "" FORCE )
else()
message( FATAL_ERROR "GEOS_TPL_DIR not defined." )
endif()
endif()
include( ${TPLS_CMAKE} )
else()
message( STATUS "tpls.cmake not found")
message( STATUS "Assuming building TPLs" )
endif()
endmacro(add_third_party_libraries)

##------------------------------------------------------------------------------
## set_compiler_options()
##
## Sets the default/common compiler options.
##
##------------------------------------------------------------------------------
macro(set_compiler_options)

set( COMMON_FLAGS "" )
set( RELEASE_FLAGS "-O3 -DNDEBUG" )
set( DEBUG_FLAGS "-O0 -g" )

set( CMAKE_C_FLAGS ${COMMON_FLAGS} CACHE STRING "" )
set( CMAKE_CXX_FLAGS ${COMMON_FLAGS} CACHE STRING "" )
set( CMAKE_Fortran_FLAGS ${COMMON_FLAGS} CACHE STRING "" )
set( CMAKE_CXX_FLAGS_RELEASE ${RELEASE_FLAGS} CACHE STRING "" )
set( CMAKE_C_FLAGS_RELEASE ${RELEASE_FLAGS} CACHE STRING "" )
set( CMAKE_Fortran_FLAGS_RELEASE ${RELEASE_FLAGS} CACHE STRING "" )
set( CMAKE_CXX_FLAGS_DEBUG ${DEBUG_FLAGS} CACHE STRING "" )
set( CMAKE_C_FLAGS_DEBUG ${DEBUG_FLAGS} CACHE STRING "" )
set( CMAKE_Fortran_FLAGS_DEBUG ${DEBUG_FLAGS} CACHE STRING "" )

endmacro(set_compiler_options)

##------------------------------------------------------------------------------
## set_cuda_options()
##
## Sets the default/common CUDA options.
##
##------------------------------------------------------------------------------
macro(set_cuda_options)

set( CUDA_TOOLKIT_ROOT_DIR "$ENV{CUDA_HOME}" CACHE PATH "" )
set( CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "" )
set( CMAKE_CUDA_COMPILER ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc CACHE STRING "" )
set( CUDA_ARCH "sm_90" CACHE STRING "" )
set( CMAKE_CUDA_STANDARD 17 CACHE STRING "" )
set( CMAKE_CUDA_FLAGS "-restrict -arch ${CUDA_ARCH} --expt-extended-lambda --expt-relaxed-constexpr -Werror cross-execution-space-call,reorder,deprecated-declarations -Xcompiler -std=c++17" CACHE STRING "" )
set( CMAKE_CUDA_FLAGS_RELEASE "-O3 -DNDEBUG -Xcompiler -DNDEBUG -Xcompiler -O3" CACHE STRING "" )
set( CMAKE_CUDA_FLAGS_RELWITHDEBINFO "-g -lineinfo ${CMAKE_CUDA_FLAGS_RELEASE}" CACHE STRING "" )
set( CMAKE_CUDA_FLAGS_DEBUG "-g -G -O0 -Xcompiler -O0" CACHE STRING "" )

endmacro(set_cuda_options)

#########################################################################
# BLAS/LAPACK SETUP
#########################################################################
# use :
# - OpenBLAS library
find_library( BLAS_LIBRARIES
NAMES openblas openblas.so.0 libopenblas.so.0
PATHS /usr
PATH_SUFFIXES lib lib64 )

if(NOT BLAS_LIBRARIES)
message( FATAL_ERROR "Failed to find OpenBLAS." )
endif()

set( LAPACK_LIBRARIES ${BLAS_LIBRARIES} )

message( STATUS "OpenBLAS BLAS '${BLAS_LIBRARIES}'." )
message( STATUS "OpenBLAS LAPACK '${LAPACK_LIBRARIES}'." )

set( ENABLE_MKL OFF CACHE BOOL "" )

#########################################################################
# OTHER OPTIONS
#########################################################################
# Use old policy CMP0146
set ( CMAKE_POLICY_DEFAULT_CMP0146 "OLD" CACHE STRING "" FORCE )

# Use new policy CMP0135
set ( CMAKE_POLICY_DEFAULT_CMP0135 "NEW" CACHE STRING "" FORCE )

# Enable failure on tests
set( ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "" FORCE )

# Enale caliper instrumentation
set( ENABLE_CALIPER ON CACHE BOOL "" )

# Disable doxygen. No valid libiconv available
set( ENABLE_DOXYGEN OFF CACHE BOOL "" FORCE )

# Disable MathPresso. Not supported in this architecture
set( ENABLE_MATHPRESSO OFF CACHE BOOL "" FORCE )

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#########################################################################
# Maple - gcc - cuda - openmpi - openblas
#########################################################################
#
# Load modules this way :
# module purge
# module load genesis
# module load common
# module load cmake/3.29.6
# module load gcc/12.2.0
# module load cuda/12.4.131
# module load openmpi-gcc/5.0.5/cuda.12.4
#
#########################################################################

include(${CMAKE_CURRENT_LIST_DIR}/maple-gcc12.2.0-openmpi5.0.5-openblas0.3.21.cmake)

set( CONFIG_NAME "maple-gcc12.2.0-cuda12.4.131-openmpi5.0.5-openblas0.3.21" CACHE PATH "" )

#########################################################################
# CUDA SETUP
#########################################################################

# use :
# - CUDA 12.4.131
if( NOT DEFINED ENV{CUDA_HOME} )
message( FATAL_ERROR "CUDA is not loaded. Please load the cuda/12.4.131 module." )
endif()

set_cuda_options()

set( ENABLE_CUDA ON CACHE BOOL "" )

#########################################################################
# OTHER OPTIONS
#########################################################################
# Set HYPRE to use CUDA
set( ENABLE_HYPRE_DEVICE "CUDA" CACHE PATH "" FORCE )

add_third_party_libraries()

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#########################################################################
# Maple - gcc - openmpi - openblas
#########################################################################
#
# Load modules this way :
# module purge
# module load genesis
# module load common
# module load cmake/3.29.6
# module load gcc/12.2.0
# module load openmpi-gcc/5.0.5/cuda.12.4
#
#########################################################################

include(${CMAKE_CURRENT_LIST_DIR}/maple-common.cmake)

set( CONFIG_NAME "maple-gcc12.2.0-openmpi5.0.5-openblas0.3.21" CACHE PATH "" )

#########################################################################
# COMPILER SETUP
#########################################################################

# Use :
# - GCC
if( NOT ("$ENV{LMOD_FAMILY_COMPILER}" STREQUAL "gcc" AND "$ENV{LMOD_FAMILY_COMPILER_VERSION}" STREQUAL "12.2.0"))
message( FATAL_ERROR "GCC is not loaded. Please load the gcc/12.2.0 module." )
endif()

set( CMAKE_C_COMPILER "gcc" CACHE PATH "" )
set( CMAKE_CXX_COMPILER "g++" CACHE PATH "" )
set( CMAKE_Fortran_COMPILER "gfortran" CACHE PATH "" )

set_compiler_options()

#########################################################################
# MPI SETUP
#########################################################################

# use :
# - OpenMPI library
if( NOT "$ENV{LMOD_FAMILY_MPI}" STREQUAL "openmpi-gcc/5.0.5" )
message( FATAL_ERROR "OpenMPI is not loaded. Please load the openmpi-gcc/5.0.5/cuda.12.4 module." )
endif()

set( ENABLE_MPI ON CACHE BOOL "" )
set( ENABLE_OPENMP ON CACHE PATH "" FORCE )

set( MPI_C_COMPILER mpicc CACHE PATH "" FORCE )
set( MPI_CXX_COMPILER mpicxx CACHE PATH "" FORCE )
set( MPI_Fortran_COMPILER mpifort CACHE PATH "" FORCE )
set( MPIEXEC_EXECUTABLE mpiexec CACHE PATH "" FORCE )

#########################################################################
# OTHER OPTIONS
#########################################################################
add_third_party_libraries()
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#########################################################################
# Maple - llvm - cuda - openmpi - openblas
#########################################################################
#
# Load modules this way :
# module purge
# module load genesis
# module load common
# module load cmake/3.29.6
# module load llvm/17.0.4
# module load cuda/12.4.131
# module load openmpi-llvm/cuda.12.4
#
#########################################################################

include(${CMAKE_CURRENT_LIST_DIR}/maple-llvm17.0.4-openmpi5.0.3-openblas0.3.21.cmake)

set( CONFIG_NAME "maple-llvm17.0.4-cuda12.4.131-openmpi5.0.3-openblas0.3.21" CACHE PATH "" )

#########################################################################
# CUDA SETUP
#########################################################################

# use :
# - CUDA 12.4.131
if( NOT DEFINED ENV{CUDA_HOME} )
message( FATAL_ERROR "CUDA is not loaded. Please load the cuda/12.4.131 module." )
endif()

set_cuda_options()

set( ENABLE_CUDA ON CACHE BOOL "" )

#########################################################################
# OTHER OPTIONS
#########################################################################
# Set HYPRE to use CUDA
set( ENABLE_HYPRE_DEVICE "CUDA" CACHE PATH "" FORCE )

add_third_party_libraries()

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#########################################################################
# Maple - llvm - openmpi - openblas
#########################################################################
#
# Load modules this way :
# module purge
# module load genesis
# module load common
# module load cmake/3.29.6
# module load llvm/17.0.4
# module load openmpi-llvm/cuda.12.4
#
#########################################################################

include(${CMAKE_CURRENT_LIST_DIR}/maple-common.cmake)

set( CONFIG_NAME "maple-llvm17.0.4-openmpi5.0.3-openblas0.3.21" CACHE PATH "" )

#########################################################################
# COMPILER SETUP
#########################################################################

# Use :
# - LLVM
if( NOT "$ENV{LMOD_FAMILY_COMPILER}" STREQUAL "llvm" )
message( FATAL_ERROR "LLVM is not loaded. Please load the llvm/17.0.4 module." )
endif()

set( CMAKE_C_COMPILER "clang" CACHE PATH "" )
set( CMAKE_CXX_COMPILER "clang++" CACHE PATH "" )
set( CMAKE_Fortran_COMPILER "flang-new" CACHE PATH "" )

set_compiler_options()

#########################################################################
# MPI SETUP
#########################################################################

# use :
# - OpenMPI library
if( NOT "$ENV{LMOD_FAMILY_MPI}" STREQUAL "openmpi-llvm/cuda.12.4" )
message( FATAL_ERROR "OpenMPI is not loaded. Please load the openmpi-llvm/cuda.12.4 module." )
endif()

set( ENABLE_MPI ON CACHE BOOL "" )

set( MPI_C_COMPILER mpicc CACHE PATH "" FORCE )
set( MPI_CXX_COMPILER mpicxx CACHE PATH "" FORCE )
set( MPI_Fortran_COMPILER mpifort CACHE PATH "" FORCE )
set( MPIEXEC_EXECUTABLE mpiexec CACHE PATH "" FORCE )

set( ENABLE_OPENMP ON CACHE PATH "" FORCE )

#########################################################################
# OTHER OPTIONS
#########################################################################
add_third_party_libraries()
Loading