Skip to content

Commit

Permalink
install script for LC quartz
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed May 22, 2024
1 parent 1d7db4d commit 2eb0a85
Show file tree
Hide file tree
Showing 5 changed files with 613 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dump
*.msh
*.msh.mfem
__pycache__
dependencies
143 changes: 143 additions & 0 deletions install-helper/libROM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
###############################################################################
#
# Copyright (c) 2013-2024, Lawrence Livermore National Security, LLC
# and other libROM project developers. See the top-level COPYRIGHT
# file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
###############################################################################

include(FortranCInterface)
FortranCInterface_HEADER(${CMAKE_CURRENT_SOURCE_DIR}/FCMangle.h
MACRO_NAMESPACE "CAROM_FC_")

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CAROM_config.h.in
${CMAKE_CURRENT_SOURCE_DIR}/CAROM_config.h @ONLY)

# While it is tempting to use file globbing here, file globbing is
# considered a "modern CMake anti-pattern" because "CMake is not a
# build system -- it is a build system _generator_". Instead, use
# some file name "stems" for generating file names. This construction
# is useful when files may be moved to different directories.
set(module_list
linalg/BasisGenerator
linalg/BasisReader
linalg/BasisWriter
linalg/Matrix
linalg/Vector
linalg/NNLS
linalg/svd/IncrementalSVD
linalg/svd/IncrementalSVDFastUpdate
linalg/svd/IncrementalSVDStandard
linalg/svd/IncrementalSVDBrand
linalg/svd/RandomizedSVD
linalg/svd/SVD
linalg/svd/StaticSVD
algo/DMD
algo/DMDc
algo/AdaptiveDMD
algo/NonuniformDMD
algo/DifferentialEvolution
algo/greedy/GreedyCustomSampler
algo/greedy/GreedyRandomSampler
algo/greedy/GreedySampler
algo/manifold_interp/Interpolator
algo/manifold_interp/MatrixInterpolator
algo/manifold_interp/VectorInterpolator
hyperreduction/DEIM
hyperreduction/GNAT
hyperreduction/QDEIM
hyperreduction/S_OPT
hyperreduction/STSampling
hyperreduction/Utilities
hyperreduction/Hyperreduction
utils/Database
utils/HDFDatabase
utils/HDFDatabaseMPIO
utils/CSVDatabase
utils/Utilities
utils/ParallelBuffer
utils/mpi_utils)
set(source_files)
foreach(module IN LISTS module_list)
list(APPEND source_files ${module}.cpp)
endforeach(module) # IN LISTS module_list

list(APPEND source_files
algo/ParametricDMD.h
linalg/Options.h
librom.h)

if (USE_MFEM)
list(APPEND source_files
mfem/PointwiseSnapshot.hpp
mfem/PointwiseSnapshot.cpp
mfem/Utilities.hpp
mfem/Utilities.cpp
mfem/SampleMesh.hpp
mfem/SampleMesh.cpp)
endif()

list(APPEND source_files
linalg/scalapack_c_wrapper.c
linalg/scalapack_f_wrapper.f90)
if (BUILD_STATIC)
add_library(ROM ${source_files})
else()
add_library(ROM SHARED ${source_files})
endif()

# If MKL libraries not found, search for reference ScaLAPACK. If MKL
# libraries found, search for MKL ScaLAPACK; if MKL ScaLAPACK not
# found, search for reference ScaLAPACK. It seems that only
if (BLAS_LIBRARIES MATCHES ".*mkl.*")
#find_package(MKL COMPONENTS BLACS ScaLAPACK)
if (NOT MKL_ScaLAPACK_FOUND)
find_package(ScaLAPACK REQUIRED)
target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES})
else()
target_link_libraries(ROM PUBLIC ${MKL_ScaLAPACK_LIBRARY} ${MKL_BLACS_LIBRARY} ${MKL_LIBRARIES})
target_include_directories(ROM PUBLIC ${MKL_INCLUDE_DIRS})
endif()
else() # BLAS or LAPACK isn't MKL
find_package(ScaLAPACK)
if (NOT ScaLAPACK_FOUND)
# Attempt to use manually-built scalapack in dependencies.
# CMake files in scalapack directory disrupts find_package using PATHS/HINTS.
# Here we prepend environment PATH variable.
# This changed PATH variable applies only to this libROM compilation.
set(ENV{PATH} "${CMAKE_SOURCE_DIR}/dependencies/scalapack-2.2.0:$ENV{PATH}")
find_package(ScaLAPACK REQUIRED)
endif()
target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES})
endif()

# PUBLIC dependencies are transitive; these dependencies are used in
# the API headers *and* in their implementations
#
# INTERFACE dependencies are used in the API headers, but not in the
# API implementation (e.g., API forwards objects to another library
# without dereferencing those objects -- only pointers are used)
#
# PRIVATE dependencies are used in the API implementation, but not in
# the headers
#
# Using both the MPI::MPI_C target and the two MPI_C "flag variables
# (i.e., "MPI_C_LINK_FLAGS, MPI_C_LIBRARIES) is probably redundant,
# but is done here to ease a potential rollback to CMake 2.8 or CMake
# 3.0.
target_link_libraries(ROM
PUBLIC ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran ${HDF5_LIBRARIES}
${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MFEM} ${HYPRE} ${PARMETIS} ${METIS}
PRIVATE ${ZLIB_LIBRARIES} ZLIB::ZLIB)

target_include_directories(ROM PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${MFEM_INCLUDES}
${HYPRE_INCLUDES}
${PARMETIS_INCLUDES}
${HDF5_C_INCLUDE_DIRS}
${MPI_C_INCLUDE_DIRS}
${MFEM_C_INCLUDE_DIRS}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
84 changes: 84 additions & 0 deletions install-helper/mumps/FindMETIS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindMETIS
-------
Michael Hirsch, Ph.D.
Finds the METIS library.
NOTE: If libparmetis used, libmetis must also be linked.
Imported Targets
^^^^^^^^^^^^^^^^
METIS::METIS
Result Variables
^^^^^^^^^^^^^^^^
METIS_LIBRARIES
libraries to be linked
METIS_INCLUDE_DIRS
dirs to be included
#]=======================================================================]


if("parallel" IN_LIST METIS_FIND_COMPONENTS)
find_library(PARMETIS_LIBRARY
NAMES parmetis
PATH_SUFFIXES METIS libmetis
DOC "ParMETIS library"
)
if(PARMETIS_LIBRARY)
set(METIS_parallel_FOUND true)
endif()
endif()

find_library(METIS_LIBRARY
NAMES metis
PATH_SUFFIXES METIS libmetis
DOC "METIS library"
)

set(metis_inc metis.h)
if("parallel" IN_LIST METIS_FIND_COMPONENTS)
set(parmetis_inc parmetis.h)
endif()

find_path(PARMETIS_INCLUDE_DIR
NAMES ${parmetis_inc}
PATH_SUFFIXES METIS openmpi-x86_64 mpich-x86_64
DOC "METIS include directory"
)

find_path(METIS_INCLUDE_DIR
NAMES ${metis_inc}
PATH_SUFFIXES METIS openmpi-x86_64 mpich-x86_64
DOC "METIS include directory"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(METIS
REQUIRED_VARS METIS_LIBRARY METIS_INCLUDE_DIR PARMETIS_INCLUDE_DIR
HANDLE_COMPONENTS
)

if(METIS_FOUND)

set(METIS_LIBRARIES ${PARMETIS_LIBRARY} ${METIS_LIBRARY})
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR} ${PARMETIS_INCLUDE_DIR})

message(VERBOSE "METIS libraries: ${METIS_LIBRARIES}
METIS include directories: ${METIS_INCLUDE_DIRS}")

if(NOT TARGET METIS::METIS)
add_library(METIS::METIS INTERFACE IMPORTED)
set_property(TARGET METIS::METIS PROPERTY INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES}")
set_property(TARGET METIS::METIS PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIRS}")
endif()
endif(METIS_FOUND)

mark_as_advanced(METIS_INCLUDE_DIRS METIS_LIBRARY PARMETIS_LIBRARY)
Loading

0 comments on commit 2eb0a85

Please sign in to comment.