Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ generated-docs/
*.md~
*.swp

out.cmake
GPATH
GRTAGS
GTAGS
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ script:
- cd build;
- |
CC=mpicc CXX=mpic++ cmake -DMFEM_DIR="/home/travis/build/LLNL/mfem-install" \
-DHYPRE_DIR="/home/travis/build/LLNL/hypre-install" \
-DSuiteSparse_DIR="/home/travis/build/LLNL/SuiteSparse-install" \
-DMETIS_DIR="/home/travis/build/LLNL/metis-install" \
-DUSE_ARPACK=OFF -DCMAKE_BUILD_TYPE=Debug \
-DSPE10_PERM="/home/travis/build/LLNL/spe10-install/spe_perm.dat" \
-DSMOOTHG_TEST_PROCS=2 ..;
Expand Down
69 changes: 25 additions & 44 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
# BHEADER ####################################################################
#
# Copyright (c) 2018, Lawrence Livermore National Security, LLC.
Expand Down Expand Up @@ -33,9 +32,7 @@ set(${PROJECT_NAME}_GRAPHDATA ${PROJECT_SOURCE_DIR}/graphdata)

#####
# set up external dependencies
# (this is a mess, seems to work, but I don't know what
# I'm doing and I'm sure it can be greatly simplified)
# (also should take some directory hints from config.sh)
# (we outsource a lot of this to MFEM)
#####

# This is a list of TPLs that are used by all targets
Expand All @@ -44,7 +41,7 @@ set(TPL_LIBRARIES "")
# This is a list of linker flags to be used with TPLs for all targets
set(TPL_LINKER_FLAGS "")

# SAAMGE_PARALLEL
# SAAMGE
option(USE_SAAMGE "Should SAAMGE be enabled?" OFF)
if(USE_SAAMGE)
find_path(SAAMGE_INCLUDE_PATH saamge.hpp
Expand All @@ -64,6 +61,14 @@ else()
set(${PROJECT_NAME}_USE_SAAMGE 0)
endif()

# MPI
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
list(APPEND TPL_LIBRARIES ${MPI_LIBRARIES})
if(MPI_CXX_COMPILE_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_CXX_COMPILE_FLAGS}")
endif()

# MFEM
find_path(MFEM_INCLUDE_PATH mfem.hpp
HINTS ${MFEM_DIR}/include)
Expand All @@ -75,41 +80,24 @@ add_library(MFEM_LIB STATIC IMPORTED)
set_property(TARGET MFEM_LIB PROPERTY IMPORTED_LOCATION ${MFEM_LIBRARY_PATH}/${MFEM_LIB_NAME})
list(APPEND TPL_LIBRARIES ${MFEM_LIBRARY_PATH}/${MFEM_LIB_NAME})

# Hypre
find_path(HYPRE_INCLUDE_PATH HYPRE.h
HINTS ${HYPRE_DIR}/include)
include_directories(${HYPRE_INCLUDE_PATH})
set(HYPRE_LIB_NAME libHYPRE.a)
find_library(HYPRE_LIB HYPRE
${HYPRE_DIR}/lib)
list(APPEND TPL_LIBRARIES ${HYPRE_LIB})

# MPI
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
list(APPEND TPL_LIBRARIES ${MPI_LIBRARIES})
if(MPI_CXX_COMPILE_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_CXX_COMPILE_FLAGS}")
option(ADOPT_MFEM_DEPENDENCIES "Take include and link paths from MFEM installation?" ON)
if(ADOPT_MFEM_DEPENDENCIES)
# steal all of MFEM's dependencies
find_path(MFEM_CONFIG_PATH config.mk
PATHS ${MFEM_DIR}/share/mfem ${MFEM_DIR})
execute_process(COMMAND python parsemk.py ${MFEM_CONFIG_PATH}/config.mk
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
include("out.cmake")
include_directories(${MK_INCLUDES})
list(APPEND TPL_LIBRARIES ${MK_LIBRARIES})
else()
include("explicitdependencies.cmake")
include_directories(${EI_INCLUDES})
list(APPEND TPL_LIBRARIES ${EI_LIBRARIES})
endif()

# Metis
find_path(METIS_INCLUDE_PATH metis.h
HINTS ${METIS_DIR}/include)
set(METIS_LIB_NAME libmetis.a)
find_path(METIS_LIBRARY_PATH ${METIS_LIB_NAME}
${METIS_DIR}/lib)
include_directories(${METIS_INCLUDE_PATH})
add_library(METIS_LIB STATIC IMPORTED)
set_property(TARGET METIS_LIB PROPERTY IMPORTED_LOCATION ${METIS_LIBRARY_PATH}/${METIS_LIB_NAME})
list(APPEND TPL_LIBRARIES ${METIS_LIBRARY_PATH}/${METIS_LIB_NAME})

# SuiteSparse
find_package(SuiteSparse REQUIRED UMFPACK KLU AMD BTF CHOLMOD COLAMD CAMD CCOLAMD config)
include_directories(${SuiteSparse_INCLUDE_DIRS})
list(APPEND TPL_LIBRARIES ${SuiteSparse_LIBRARIES})

# ARPACK
# there are several sources for ARPACK, I recommend
# there are several sources for ARPACK, we recommend
# https://github.com/opencollab/arpack-ng.git
# and
# https://github.com/m-reuter/arpackpp.git
Expand All @@ -135,13 +123,6 @@ else()
set(${PROJECT_NAME}_USE_ARPACK 0)
endif()

# BLAS/LAPACK
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
list(APPEND TPL_LIBRARIES ${LAPACK_LIBRARIES})
list(APPEND TPL_LIBRARIES ${BLAS_LIBRARIES})
list(APPEND TPL_LIBRARIES "gfortran")

list(REMOVE_DUPLICATES TPL_LIBRARIES)

# SPE10 data (not a package, but we want it for testing)
Expand Down
7 changes: 2 additions & 5 deletions config/example_config_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ rm CMakeCache.txt
rm -rf CMakeFiles

cmake \
-DADOPT_MFEM_DEPENDENCIES=ON \
\
-DMFEM_DIR=/path/to/the/directory/where/mfem/is/installed \
-DMETIS_DIR=/path/to/the/directory/where/metis/is/installed \
-DHYPRE_DIR=/path/to/the/directory/where/hypre/is/installed \
-DSuiteSparse_DIR=/path/to/the/directory/where/SuiteSparse/is/installed \
-DSPE10_DIR=/path/to/the/directory/where/spe_perm.dat/is/located \
\
-DMEMORYCHECK_COMMAND=/path/to/valgrind/binary \
Expand All @@ -44,8 +43,6 @@ cmake \
-DUSE_ARPACK=OFF \
\
-DCMAKE_BUILD_TYPE=Debug \
-DBLAS_LIBRARIES=/path/to/the/blas/library/file \
-DLAPACK_LIBRARIES=/path/to/the/lapack/library/file \
\
${EXTRA_ARGS} \
${BASE_DIR}
7 changes: 2 additions & 5 deletions config/example_config_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ rm CMakeCache.txt
rm -rf CMakeFiles

cmake \
-DADOPT_MFEM_DEPENDENCIES=ON \
\
-DMFEM_DIR=/path/to/the/directory/where/mfem/is/installed \
-DMETIS_DIR=/path/to/the/directory/where/metis/is/installed \
-DHYPRE_DIR=/path/to/the/directory/where/hypre/is/installed \
-DSuiteSparse_DIR=/path/to/the/directory/where/SuiteSparse/is/installed \
-DSPE10_DIR=/path/to/the/directory/where/spe_perm.dat/is/located \
\
-DMEMORYCHECK_COMMAND=/path/to/valgrind/binary \
Expand All @@ -44,8 +43,6 @@ cmake \
-DUSE_ARPACK=OFF \
\
-DCMAKE_BUILD_TYPE=Release \
-DBLAS_LIBRARIES=/path/to/the/blas/library/file \
-DLAPACK_LIBRARIES=/path/to/the/lapack/library/file \
\
${EXTRA_ARGS} \
${BASE_DIR}
5 changes: 0 additions & 5 deletions config/example_config_release_with_arpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@ rm -rf CMakeFiles

cmake \
-DMFEM_DIR=/path/to/the/directory/where/mfem/is/installed \
-DMETIS_DIR=/path/to/the/directory/where/metis/is/installed \
-DHYPRE_DIR=/path/to/the/directory/where/hypre/is/installed \
-DSuiteSparse_DIR=/path/to/the/directory/where/SuiteSparse/is/installed \
-DSPE10_DIR=/path/to/the/directory/where/spe_perm.dat/is/located \
\
-DUSE_ARPACK=ON \
-DARPACK_DIR=/path/to/the/lib/directory/of/arpack \
-DARPACKPP_DIR=/path/to/the/root/directory/of/arpackpp \
\
-DCMAKE_BUILD_TYPE=Release \
-DBLAS_LIBRARIES=/path/to/the/blas/library/file \
-DLAPACK_LIBRARIES=/path/to/the/lapack/library/file \
\
${EXTRA_ARGS} \
${BASE_DIR}
51 changes: 51 additions & 0 deletions explicitdependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# BHEADER ####################################################################
#
# Copyright (c) 2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# LLNL-CODE-745247. All Rights reserved. See file COPYRIGHT for details.
#
# This file is part of smoothG. For more information and source code
# availability, see https://www.github.com/llnl/smoothG.
#
# smoothG is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License (as published by the Free
# Software Foundation) version 2.1 dated February 1999.
#
#################################################################### EHEADER #

set(EI_INCLUDES "")
set(EI_LIBRARIES "")

# Hypre
find_path(HYPRE_INCLUDE_PATH HYPRE.h
HINTS ${HYPRE_DIR}/include)
list(APPEND EI_INCLUDES ${HYPRE_INCLUDE_PATH})
set(HYPRE_LIB_NAME libHYPRE.a)
find_library(HYPRE_LIB HYPRE
${HYPRE_DIR}/lib)
list(APPEND EI_LIBRARIES ${HYPRE_LIB})

# Metis
find_path(METIS_INCLUDE_PATH metis.h
HINTS ${METIS_DIR}/include)
set(METIS_LIB_NAME libmetis.a)
find_path(METIS_LIBRARY_PATH ${METIS_LIB_NAME}
${METIS_DIR}/lib)
list(APPEND EI_INCLUDES ${METIS_INCLUDE_PATH})
add_library(METIS_LIB STATIC IMPORTED)
set_property(TARGET METIS_LIB PROPERTY IMPORTED_LOCATION ${METIS_LIBRARY_PATH}/${METIS_LIB_NAME})
list(APPEND EI_LIBRARIES ${METIS_LIBRARY_PATH}/${METIS_LIB_NAME})

# SuiteSparse
find_package(SuiteSparse REQUIRED UMFPACK KLU AMD BTF CHOLMOD COLAMD CAMD CCOLAMD config)
list(APPEND EI_INCLUDES ${SuiteSparse_INCLUDE_DIRS})
list(APPEND EI_LIBRARIES ${SuiteSparse_LIBRARIES})

# BLAS/LAPACK
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
list(APPEND EI_LIBRARIES ${LAPACK_LIBRARIES})
list(APPEND EI_LIBRARIES ${BLAS_LIBRARIES})
list(APPEND EI_LIBRARIES "gfortran")

list(REMOVE_DUPLICATES EI_LIBRARIES)
Loading