Skip to content

Commit

Permalink
Merge pull request #274 from aprokop/detribits_part1
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Aug 31, 2020
2 parents b08805a + 65ed820 commit 8708d6e
Show file tree
Hide file tree
Showing 160 changed files with 1,430 additions and 3,567 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build*
/build*
/install*
*_autogen.f90
*~
.*.swp
Expand Down
22 changes: 20 additions & 2 deletions .jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ pipeline {
issueCommentTrigger('.*test this please.*')
}
agent none

environment {
CCACHE_DIR = '/tmp/ccache'
CCACHE_MAXSIZE = '10G'
FORTRILINOS_DIR = '/opt/fortrilinos'
CTEST_OPTIONS = '--timeout 180 --no-compress-output -T Test --test-output-size-passed=65536 --test-output-size-failed=1048576'

// Run MPI as root
OMPI_ALLOW_RUN_AS_ROOT = '1'
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM = '1'
}
stages {
stage('Build') {
Expand All @@ -31,8 +34,9 @@ pipeline {
-D CMAKE_INSTALL_PREFIX=$FORTRILINOS_DIR \
-D CMAKE_BUILD_TYPE=Debug \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D MPIEXEC_PREFLAGS="--allow-run-as-root" \
-D MPIEXEC_MAX_NUMPROCS=4 \
-D ForTrilinos_TESTING=ON \
-D ForTrilinos_EXAMPLES=ON \
..
'''
sh 'make -j8 VERBOSE=1'
Expand All @@ -44,6 +48,20 @@ pipeline {
sh 'ccache --show-stats'
xunit reduceLog: false, tools:[CTest(deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/Testing/**/Test.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
}
success {
sh 'cd build && make install'
sh 'rm -rf test_install && mkdir -p test_install'
dir('test_install') {
sh 'cp -r ../example/test-installation .'
sh '''
cmake \
-D CMAKE_PREFIX_PATH=$FORTRILINOS_DIR \
test-installation
'''
sh 'make VERBOSE=1'
sh 'make test'
}
}
}
}
}
Expand Down
271 changes: 182 additions & 89 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,91 +1,184 @@
## Copyright 2017-2018, UT-Battelle, LLC
##
## SPDX-License-Identifier: BSD-3-Clause
## License-Filename: LICENSE

##---------------------------------------------------------------------------##
## Define the package
##---------------------------------------------------------------------------##

TRIBITS_PACKAGE_DECL(ForTrilinos)

##---------------------------------------------------------------------------##
## Set up package-specific options
##---------------------------------------------------------------------------##

TRIBITS_ADD_DEBUG_OPTION()
TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()

# Pick a default node to compile for in order of Cuda -> OpenMP -> Serial
# For now we just build for this one node which is selected based on the config.
# This is an intermediate step and expected to change later for supporting
# all nodes simultaneously.
IF (KOKKOS_ENABLE_CUDA)
SET(Kokkos_NODE_TYPE "KokkosCudaWrapperNode")
ELSEIF (KOKKOS_ENABLE_OPENMP)
SET(Kokkos_NODE_TYPE "KokkosOpenMPWrapperNode")
ELSE ()
SET(Kokkos_NODE_TYPE "KokkosSerialWrapperNode")
ENDIF()
MESSAGE(STATUS "ForTrilinos default node type: ${Kokkos_NODE_TYPE}")

# Enable unlimited-length lines
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
SET(CMAKE_Fortran_FLAGS "-ffree-line-length-none ${CMAKE_Fortran_FLAGS}")
#---------------------------------*-CMake-*----------------------------------#
# Copyright 2020 UT-Battelle, LLC
# License-Filename: LICENSE
# SPDX-License-Identifier: BSD-3-Clause
#----------------------------------------------------------------------------#

cmake_minimum_required(VERSION 3.12)
project(ForTrilinos VERSION 2.0.0 LANGUAGES Fortran CXX)
cmake_policy(VERSION 3.12...3.18)

list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_LIST_DIR}/cmake"
)
if(CMAKE_VERSION VERSION_LESS 3.18)
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_LIST_DIR}/cmake/backport/3.18"
)
endif()

include(GNUInstallDirs)

#-----------------------------------------------------------------------------#
# Component options
#-----------------------------------------------------------------------------#

# Only enable SWIG fortran when Fortran is enabled
option(ForTrilinos_USE_SWIG_Fortran
"Regenerate Fortran bindings with SWIG" OFF)

#-----------------------------------------------------------------------------#
# Deployment options
#-----------------------------------------------------------------------------#

option(BUILD_SHARED_LIBS "Default to building shared libraries" ON)

if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON CACHE STRING
"Inform installed binaries of external library rpaths")
endif()
if(BUILD_SHARED_LIBS)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE STRING
"Inform installed binaries of internal library rpaths")
endif()
if(APPLE)
option(CMAKE_MACOSX_RPATH "Support @rpath in install targets" ON)
endif()

IF (${PACKAGE_NAME}_ENABLE_DeveloperMode)
# SWIG setup
FIND_PACKAGE(SWIG REQUIRED)
# SWIG is requested and available; make sure it's the Fortran fork.
INCLUDE(CheckSWIGFortran)
IF (CMAKE_VERSION VERSION_LESS 3.10)
# TODO: Old version of cmake modules
include(SwigModulesOld)
ELSE()
include(SwigModules)
ENDIF()

# Ignore some SWIG warnings:
# 401: "Nothing known about base class"
LIST(APPEND CMAKE_SWIG_FLAGS "-w401" "-fext" "F90")
set(SWIG_FORTRAN_EXTRA_FILE_EXTENSIONS ".F90")

IF (NOT TPL_ENABLE_MPI)
# Warn if MPI is disabled since not all wrapper functions will be
# generated. Later this might be extended to other optional packages.
MESSAGE(WARNING "DeveloperMode is being used without MPI: "
"the newly generated wrappers will NOT be generated in the source "
"directory, since they will not contain MPI-related classes.")
ELSE()
# Export the newly generated wrappers to the source directory.
SET(ForTrilinos_EXPORT_SWIG TRUE CACHE BOOL
"Build SWIG wrapper files in the source directory")
ENDIF()
ENDIF()

##---------------------------------------------------------------------------##
## Add the libraries, tests, and examples
##---------------------------------------------------------------------------##

# TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)
# TRIBITS_ADD_TEST_DIRECTORIES(test)

##---------------------------------------------------------------------------##
## Generate the Doxygen documentation
##---------------------------------------------------------------------------##
# There does not currently exist Doxygen documentation
#IF(ForTrilinos_ENABLE_Doxygen)
# ADD_SUBDIRECTORY(docs/doxygen)
#ENDIF()

##---------------------------------------------------------------------------##
## Build the documentation published on http://fortrilinos.readthedocs.org
##---------------------------------------------------------------------------##
IF(ForTrilinos_ENABLE_ReadTheDocs)
ADD_SUBDIRECTORY(docs)
ENDIF()

TRIBITS_PROCESS_SUBPACKAGES()
TRIBITS_PACKAGE_DEF()
TRIBITS_PACKAGE_POSTPROCESS()
#-----------------------------------------------------------------------------#
# Test options
#-----------------------------------------------------------------------------#

option(ForTrilinos_TESTING "Build ForTrilinos unit tests" OFF)
option(ForTrilinos_EXAMPLES "Build ForTrilinos examples" OFF)
set(ForTrilinos_MAX_NUMPROCS "0" CACHE STRING
"Maximum number of processors to use in tests")

#-----------------------------------------------------------------------------#
# Internal variables
#-----------------------------------------------------------------------------#

# Prefix for exported ForTrilinos targets
set(ForTrilinos_NAMESPACE "ForTrilinos::")

# Destination for configured header files (config.h) during build
set(ForTrilinos_HEADER_CONFIG_DIRECTORY "${PROJECT_BINARY_DIR}/include")
# Where to configure cmake files
set(ForTrilinos_CMAKE_CONFIG_DIRECTORY "${PROJECT_BINARY_DIR}/share")
# Where to build .mod files
set(ForTrilinos_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")

# Where to install cmake config files
set(ForTrilinos_INSTALL_CMAKECONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/ForTrilinos")

#-----------------------------------------------------------------------------#
# LANGUAGE SUPPORT
#-----------------------------------------------------------------------------#

# Don't use compiler language extensions
set(CMAKE_CXX_EXTENSIONS OFF)

#-----------------------------------------------------------------------------#
# DEPENDENCIES
#
# Derive options from Trilinos configuration where possible.
#-----------------------------------------------------------------------------#

find_package(Trilinos 12.17 REQUIRED MODULE
COMPONENTS
TeuchosCore TeuchosComm TeuchosNumerics TeuchosParameterList
OPTIONAL_COMPONENTS
# Optional
Belos
Tpetra
# Required for fortrilinos_hl
Anasazi NOX Stratimikos Thyra ThyraTpetraAdapters
# Optional for fortrilinos_hl
Amesos2 Ifpack2 MueLu
)

set(Trilinos_COMPONENTS ${COMPONENTS_LIST})
if("MPI" IN_LIST Trilinos_TPL_LIST)
set(Trilinos_USE_MPI ON)
endif()

set(ForTrilinos_USE_MPI "${Trilinos_USE_MPI}" CACHE BOOL
"MPI status depends on the Trilinos installation in use" FORCE)

set(_fortrilinos_use_hl OFF)
if(Trilinos_Anasazi_FOUND
AND Trilinos_NOX_FOUND
AND Trilinos_Stratimikos_FOUND
AND Trilinos_Thyra_FOUND
AND Trilinos_ThyraTpetraAdapters_FOUND)
set(_fortrilinos_use_hl ON)
endif()
set(ForTrilinos_USE_HL "${_fortrilinos_use_hl}" CACHE BOOL
"High-level ForTrilinos wrappers depend on Trilinos installation" FORCE)

if(ForTrilinos_USE_MPI)
if(NOT MPIEXEC_EXECUTABLE)
# Hint for MPI
set(MPIEXEC_EXECUTABLE "${TeuchosComm_MPI_EXEC}")
endif()
find_package(MPI REQUIRED COMPONENTS CXX Fortran)
if(NOT ForTrilinos_MAX_NUMPROCS)
# Not set or default of zero
set(ForTrilinos_MAX_NUMPROCS "${MPIEXEC_MAX_NUMPROCS}" CACHE STRING
"Maximum number of processors to use in tests" FORCE)
elseif(ForTrilinos_MAX_NUMPROCS GREATER MPIEXEC_MAX_NUMPROCS)
message(WARNING "Maximim number of processors in MPI "
"tests exceeds the system-detected processor count: "
"${ForTrilinos_MAX_NUMPROCS} > ${MPIEXEC_MAX_NUMPROCS}"
)
endif()
else()
set(ForTrilinos_MAX_NUMPROCS "1" CACHE INTERNAL
"Maximum number of processors to use in tests")
endif()

if(ForTrilinos_USE_SWIG_Fortran)
find_package(SWIG REQUIRED COMPONENTS fortran)
include(UseSWIG)

if(NOT ForTrilinos_USE_MPI)
message(WARNING "DeveloperMode is being used without MPI: "
"the newly generated wrappers will NOT be generated in the source "
"directory, since they will not contain MPI-related classes.")
endif()
endif()

if(ForTrilinos_TESTING OR ForTrilinos_EXAMPLES)
include(CTest)
endif()

#---------------------------------------------------------------------------##
# LIBRARY
#---------------------------------------------------------------------------##

add_subdirectory(src)

#---------------------------------------------------------------------------##
# TESTS
#---------------------------------------------------------------------------##

if(ForTrilinos_TESTING)
add_subdirectory(test)
endif()

#---------------------------------------------------------------------------##
# EXAMPLES
#---------------------------------------------------------------------------##

if(ForTrilinos_EXAMPLES)
add_subdirectory(example)
endif()

#---------------------------------------------------------------------------##
# INSTALLATION
#---------------------------------------------------------------------------##

include(ForTrilinosConfigSetup)
fortrilinos_configure_export()

#---------------------------------------------------------------------------##
3 changes: 0 additions & 3 deletions PackagesList.cmake

This file was deleted.

1 change: 0 additions & 1 deletion TPLsList.cmake

This file was deleted.

23 changes: 0 additions & 23 deletions cmake/CheckSWIGFortran.cmake

This file was deleted.

8 changes: 0 additions & 8 deletions cmake/Dependencies.cmake

This file was deleted.

Loading

0 comments on commit 8708d6e

Please sign in to comment.