Skip to content

Commit

Permalink
Create Pececillo fork for paraboloid fit tests
Browse files Browse the repository at this point in the history
- Remove flow and hc drivers
- Update to master's cmake build, and remove external libraries
  • Loading branch information
zjibben committed Jan 2, 2018
1 parent a2507d8 commit f9fbe43
Show file tree
Hide file tree
Showing 149 changed files with 430 additions and 5,952 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build/*
external/*

*~
*.ply
*gmv*
*TAGS
*txt
101 changes: 66 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.5)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}"
"${CMAKE_SOURCE_DIR}/cmake/Modules"
"${CMAKE_SOURCE_DIR}/cmake/Utils")

include(NoInSourceBuild)

project(Pececillo Fortran C)

# Override the default installation prefix (/usr/local).
Expand All @@ -22,8 +24,6 @@ endif()
# ---------------------------------------------------------------------------- #

option(ENABLE_TESTS "Build test programs" ON)

# Build the tests
if (ENABLE_TESTS)
enable_testing()
endif()
Expand All @@ -38,19 +38,12 @@ endif()

message(STATUS "CMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}")
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
set (CMAKE_Fortran_FLAGS_RELEASE "$-u -O3 -w=uda -DNDEBUG")
# note: need to disable openmp below for traceback support
set (CMAKE_Fortran_FLAGS_RELEASE "-u -O3 -w=uda -DNDEBUG")
set (CMAKE_Fortran_FLAGS_DEBUG "-g90 -g -gline -O0 -w=uda -C=all")
#set (CMAKE_Fortran_FLAGS_DEBUG "-O3 -Oassumed=contig -w=uda -DNDEBUG")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -DNDEBUG -assume realloc_lhs")
set (CMAKE_Fortran_FLAGS_DEBUG "-g -assume realloc_lhs -traceback -fp-stack-check -ftrapuv -check bounds,uninit,noarg-temp-created,pointer")
#set (CMAKE_Fortran_FLAGS_DEBUG "-g -traceback -assume realloc_lhs -fp-stack-check -ftrapuv -check bounds,uninit,noarg-temp-created,pointer -warn all")
# set (CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -traceback -assume realloc_lhs -ftrapuv -fp-stack-check -check all -warn all -WB")
set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -assume realloc_lhs -traceback")
#set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -assume realloc_lhs -traceback -fp-stack-check -ftrapuv -check bounds,uninit,noarg-temp-created,pointer")
#set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -assume realloc_lhs -traceback -fp-stack-check -ftrapuv -check all")
#message(STATUS "${CMAKE_Fortran_COMPILER_VERSION}")
endif()

find_package(OpenMP)
Expand All @@ -63,39 +56,77 @@ if (OPENMP_FOUND)
endif (OPENMP_FOUND)

#-------------------------------------------------------------------------------
# TPLs
# External dependencies
#-------------------------------------------------------------------------------

# Find and/or build the required TPLs.
add_subdirectory(external)

# We need to incorporate netcdf and exodus into the TPL build process, but for
# now we require them to be prebuilt and installed someplace. EXODUS_LIB_DIR
# must be set on the command line to the directory containing the libraries.
# Source tarballs for the packages are in external/tarballs.
find_library(EXODUS_LIBRARY exoIIv2c)
find_library(NETCDF_LIBRARY netcdf)
if(EXODUS_LIBRARY STREQUAL "EXODUS_LIBRARY-NOTFOUND" OR
NETCDF_LIBRARY STREQUAL "NETCDF_LIBRARY-NOTFOUND")
message(FATAL_ERROR "ERROR! Could not find the netcdf and/or exoIIv2c "
"libraries in EXODUS_LIB_DIR=${EXODUS_LIB_DIR}")
set(CMAKE_PREFIX_PATH ${PECECILLO_TPL_DIR})

# HYPRE library
find_package(HYPRE 2.9.0)
if(HYPRE_FOUND)
if(HYPRE_IS_PARALLEL)
set(HYPRE_FOUND False)
message(STATUS "Require serial HYPRE library but found unsuitable parallel library")
endif()
endif()
if(NOT HYPRE_FOUND)
message(FATAL_ERROR "Could NOT find a suitable Hypre installation")
endif()

# HDF5 library
find_package(HDF5 "1.8.8" COMPONENTS C HL)
if(HDF5_FOUND)
if(HDF5_IS_PARALLEL)
set(HDF5_FOUND False)
message(STATUS "Require serial HDF5 library but found unsuitable parallel library")
endif()
endif()
if(HDF5_FOUND)
add_library(hdf5 INTERFACE)
target_link_libraries(hdf5 INTERFACE ${HDF5_LIBRARIES})
target_include_directories(hdf5 INTERFACE ${HDF5_INCLUDE_DIRS})
target_compile_definitions(hdf5 INTERFACE ${HDF5_DEFINITIONS})
else()
message(FATAL_ERROR "Could NOT find a suitable HDF5 installation")
endif()
add_library(exodus STATIC IMPORTED)
set_target_properties(exodus PROPERTIES
IMPORTED_LOCATION ${EXODUS_LIBRARY}
IMPORTED_LINK_INTERFACE_LIBRARIES ${NETCDF_LIBRARY})
message(STATUS "NETCDF_LIBRARY=${NETCDF_LIBRARY}")

find_package(LAPACK)
# NetCDF library
find_package(NetCDF "4.1.3")
if(NETCDF_FOUND)
if(NOT NETCDF_HAS_NC4)
message(STATUS "Found unsuitable NetCDF without the required netcdf-4 feature")
set(NETCDF_FOUND False)
endif()
endif()
if(NOT NETCDF_FOUND)
message(FATAL_ERROR "Could NOT find a suitable NetCDF installation")
endif()

# ExodusII library
find_package(Exodus "602" EXACT)
if(NOT EXODUS_FOUND)
message(FATAL_ERROR "Could NOT find a suitable Exodus installation")
endif()

# YAJL library
find_package(YAJL)
if(NOT YAJL_FOUND)
message(FATAL_ERROR "Could NOT find a suitable YAJL library")
endif()

# LAPACK library
find_package(LAPACK)
if(NOT LAPACK_FOUND)
message(FATAL_ERROR "Could NOT find a suitable LAPACK library")
endif()

#-------------------------------------------------------------------------------
# Installation Definitions
#-------------------------------------------------------------------------------

add_subdirectory(petaca)
set(Petaca_MODULE_DIR ${Petaca_BINARY_DIR}/mod_files/)
# RPATH handling for installed shared libraries and dynamically-linked
# executables. See http://www.cmake.org/Wiki/CMake_RPATH_handling
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

set(Pececillo_MODULE_DIR ${Pececillo_BINARY_DIR}/mod_files/)
set(CMAKE_Fortran_MODULE_DIRECTORY ${Pececillo_MODULE_DIR})
add_subdirectory(src)
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Paraboloid Curvature

## Building



$ mkdir build
$ cd build
$ cmake -DCMAKE_PREFIX_PATH=/your/pececillo-tpl/install/path ..
$ make
54 changes: 54 additions & 0 deletions cmake/Modules/FindExodus.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This module finds the Exodus library and header file directory.
# EXODUS_FOUND is set to True if both are found and the following
# variables are returned.
#
# EXODUS_INCLUDE_DIRS - required include directories
# EXODUS_LIBRARIES - required link libraries
# EXODUS_VERSION - version of exodus found
#
# This module also defines the imported library target "exodus". It is
# generally enough to include "exodus" as a target link library; cmake
# will automatically handle adding the appropriate compile include flags
# and collection of link libraries.
#
# Set the variable CMAKE_PREFIX_PATH to provide a hint to the module for
# where to find the library and header file. This is searched before the
# standard system locations.
#
# Find_package(NetCDF) should be run before using this module.

#if(Exodus_FIND_QUIETLY)
# set(_find_netcdf_arg QUIET)
#endif()
#find_package(NetCDF ${_find_netcdf_arg})
#unset(_find_netcdf_arg)

find_path(EXODUS_INCLUDE_DIR exodusII.h)
find_library(EXODUS_LIBRARY exoIIv2c)

# Identify the ExodusII API version (not exactly the library version)
if(EXODUS_INCLUDE_DIR)
set(exodusii_h ${EXODUS_INCLUDE_DIR}/exodusII.h)
include(SearchHeaderFile)
search_header_file(${exodusii_h} "EX_API_VERS_NODOT" EXODUS_VERSION)
endif()

# Set EXODUS_FOUND to TRUE of the REQUIRED variables have been set.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Exodus
REQUIRED_VARS EXODUS_LIBRARY EXODUS_INCLUDE_DIR
VERSION_VAR EXODUS_VERSION)

if(EXODUS_FOUND)
set(EXODUS_INCLUDE_DIRS ${EXODUS_INCLUDE_DIR} ${NETCDF_C_INCLUDE_DIRS})
set(EXODUS_LIBRARIES ${EXODUS_LIBRARY} ${NETCDF_C_LIBRARIES})
list(REMOVE_DUPLICATES EXODUS_INCLUDE_DIRS)
mark_as_advanced(EXODUS_INCLUDE_DIR EXODUS_LIBRARY)
if(NOT TARGET exodus)
add_library(exodus UNKNOWN IMPORTED)
set_target_properties(exodus PROPERTIES
IMPORTED_LOCATION "${EXODUS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${EXODUS_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${NETCDF_C_LIBRARIES}")
endif()
endif()
111 changes: 36 additions & 75 deletions cmake/Modules/FindHYPRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,107 +6,68 @@
# === Variables ===
#
# HYPRE_FOUND Flag indicating if HYPRE is found
# HYPRE_VERSION HYPRE version
# HYPRE_INCLUDE_DIRS List of paths required to compile
# HYPRE_VERSION HYPRE version
# HYPRE_INCLUDE_DIRS List of paths required to compile
# with HYPRE
# HYPRE_LIBRARIES List libraries (targets?) required
# to link against HYPRE.
# HYPRE_IS_PARALLEL HYPRE was found
# HYPRE_IS_PARALLEL HYPRE was found
#
# HYPRE_INSTALL_PREFIX Hypre installation prefix. Used in the
# library and include file search.
# === Usage ===
#
#
# Call this module with FIND_PACKAGE(HYPRE) in any CMakeLists.txt
# that requires HYPRE include directories or libraries. The search
# can be bypassed by explicitly setting HYPRE_INCLUDE_DIRS and
# HYPRE_LIBRARIES variables.
# HYPRE_LIBRARIES variables.
#
# The variables HYPRE_INSTALL_PREFIX or ENV HYPRE_ROOT control
# search locations for include and libraries.
#
include(FindPackageHandleStandardArgs)
include(PrintVariable)

# --- MACROS/FUNCTIONS
FUNCTION(_search_hypre_config_file config_h defmacro outvar)
if ( EXISTS "${config_h}" )
set(_regexp ".define[ \\t]+${defmacro}")
set(_quote "\"")
FILE(STRINGS "${config_h}" _tmp_string REGEX "${_regexp}")
STRING(REGEX REPLACE ".define ${defmacro}[ \\t]+(.*)$" "\\1" _result "${_tmp_string}")
STRING(REPLACE "${_quote}" " " _result "${_result}")
STRING(REGEX REPLACE "[ \t\n]+" "" _result "${_result}")
else()
set(_result ${outvar}-NOTFOUND)
endif()
set(${outvar} ${_result} PARENT_SCOPE)

ENDFUNCTION()

# --- Begin main
set(hypre_search_paths ${HYPRE_DIR} ENV HYPRE_ROOT)
find_library(HYPRE_LIBRARY HYPRE HINTS ${hypre_search_paths} PATH_SUFFIXES lib)
find_path(HYPRE_INCLUDE_DIR HYPRE.h HINTS ${hypre_search_paths} PATH_SUFFIXES include)

# Search for HYPRE.h
find_path(HYPRE_INCLUDE_DIR
NAMES HYPRE.h
HINTS ENV HYPRE_ROOT ${HYPRE_INSTALL_PREFIX}
PATH_SUFFIXES include)

# Search for HYPRE library
find_library(HYPRE_LIBRARY
NAMES HYPRE
HINTS ENV HYPRE_ROOT ${HYPRE_INSTALL_PREFIX}
PATH_SUFFIXES lib)

# Define the cofig header file, will mine this to determine version
# and build type (MPI, non-MPI)
if ( HYPRE_INCLUDE_DIR )
if(HYPRE_INCLUDE_DIR)
set(HYPRE_CONFIG_FILE ${HYPRE_INCLUDE_DIR}/HYPRE_config.h)
endif()

# Define the version
if ( NOT HYPRE_VERSION AND HYPRE_CONFIG_FILE )
_search_hypre_config_file(${HYPRE_CONFIG_FILE} HYPRE_RELEASE_VERSION HYPRE_VERSION)
endif()

# Define the build (MPI or non-MPI)
if (HYPRE_CONFIG_FILE)
_search_hypre_config_file(${HYPRE_CONFIG_FILE} HYPRE_HAVE_MPI HYPRE_IS_PARALLEL)
include(SearchHeaderFile)
search_header_file(${HYPRE_CONFIG_FILE} "HYPRE_HAVE_MPI" HYPRE_IS_PARALLEL)
if(HYPRE_IS_PARALLEL)
set(HYPRE_IS_PARALLEL True)
else()
set(HYPRE_IS_PARALLEL False)
endif()
if (HYPRE_IS_PARALLEL)
find_package(MPI)
endif()
if(NOT HYPRE_VERSION)
search_header_file(${HYPRE_CONFIG_FILE} HYPRE_RELEASE_VERSION HYPRE_VERSION STRIP_QUOTES)
endif()
unset(HYPRE_CONFIG_FILE)
endif()

# Define the include directories, append MPI if needed
if ( NOT HYPRE_INCLUDE_DIRS)
set(HYPRE_INCLUDE_DIRS ${HYPRE_INCLUDE_DIR})
if (HYPRE_IS_PARALLEL)
if (MPI_C_FOUND)
list(APPEND HYPRE_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH})
endif()
endif()
if(HYPRE_IS_PARALLEL)
find_package(MPI)
endif()

# Define the libraries
if ( NOT HYPRE_LIBRARIES )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HYPRE
REQUIRED_VARS HYPRE_LIBRARY HYPRE_INCLUDE_DIR
VERSION_VAR HYPRE_VERSION)

if(HYPRE_FOUND)
set(HYPRE_INCLUDE_DIRS ${HYPRE_INCLUDE_DIR})
set(HYPRE_LIBRARIES ${HYPRE_LIBRARY})
if (HYPRE_IS_PARALLEL)
if(HYPRE_IS_PARALLEL AND MPI_C_FOUND)
list(APPEND HYPRE_LIBRARIES ${MPI_C_LIBRARIES})
list(APPEND HYPRE_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH})
endif()
endif()

# Send a useful message if everything is found
find_package_handle_standard_args(HYPRE
VERSION_VAR HYPRE_VERSION
REQUIRED_VARS HYPRE_LIBRARY HYPRE_INCLUDE_DIRS HYPRE_LIBRARIES)

mark_as_advanced(
HYPRE_INCLUDE_DIR
HYPRE_CONFIG_FILE
HYPRE_LIBRARY)

if(NOT TARGET hypre)
add_library(hypre UNKNOWN IMPORTED)
set_target_properties(hypre PROPERTIES
IMPORTED_LOCATION "${HYPRE_LIBRARY}"
#IMPORTED_LINK_INTERFACE_LANGUAGES "C"
INTERFACE_INCLUDE_DIRECTORIES "${HYPRE_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${HYPRE_LIBRARIES}")
#INTERFACE_COMPILE_DEFINITIONS "${MPI_C_COMPILE_FLAGS}")
endif()
endif()
Loading

0 comments on commit f9fbe43

Please sign in to comment.