mv aux->auxil for windows & abstract/trim buildsys

pull/5/head
Izaak Beekman 9 years ago
parent 2ec9106309
commit fe2569ecc5
No known key found for this signature in database
GPG Key ID: A93CE70D8021BD0F

@ -2,8 +2,7 @@ $Format:%d%n%n$
# Fall back version, probably last release:
3.5.0
# OpenCoarrays version file. This project uses semantic
# versioning. For details see http://semver.org
# PSBLAS version file.
#
# Release archive created from commit:
# $Format:%H %d$

33
.gitattributes vendored

@ -0,0 +1,33 @@
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
*.f90 text
*.F90 text
*.md text
*.txt text
*.sh text
*.cu text
*.x64 text
# Denote all files that are truly binary and should not be modified.
*.mod binary
*.o binary
*.a binary
*.tar binary
*.gz binary
*.tgz binary
*.enc binary
# Prevent dev-ops files from making it into the release archives
.travis.yml export-ignore
.pullapprove.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
codecov.yml export-ignore
*.enc export-ignore
.github export-ignore
.Dockerfiles export-ignore
# Perform substitutions when `git export`ing these files
.VERSION export-subst

@ -1,83 +1,45 @@
cmake_minimum_required(VERSION 3.2)
# Set the type/configuration of build to perform
#-----------------------------------
# Set oldest allowable CMake version
#-----------------------------------
cmake_minimum_required(VERSION 3.4)
#----------------------------------------------
# Define canonical CMake build types and extras
#----------------------------------------------
set ( CMAKE_CONFIGURATION_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "CodeCoverage" )
set ( CMAKE_BUILD_TYPE "Release"
CACHE STRING "Select which configuration to build." )
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
# Add option and check environment to determine if developer tests should be run
if($ENV{PSBLAS_DEVELOPER})
option(MPI_RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON)
else()
option(MPI_RUN_DEVELOPER_TESTS "Run tests intended only for developers" OFF)
endif()
mark_as_advanced(MPI_RUN_DEVELOPER_TESTS)
if( NOT DEFINED ENV{PSBLAS_DEVELOPER})
set ( ENV{PSBLAS_DEVELOPER} FALSE )
endif()
#----------------------------------------------------
# Determine version from .VERSION file or git desribe
#----------------------------------------------------
include("${CMAKE_SOURCE_DIR}/cmake/setVersion.cmake")
set_version(
VERSION_VARIABLE PSBLAS_Version
GIT_DESCRIBE_VAR full_git_describe
CUSTOM_VERSION_FILE "${CMAKE_SOURCE_DIR}/.VERSION")
message( STATUS "Building PSBLAS version: ${full_git_describe}" )
#------------------------------------------
# Name project and specify source languages
# Parse version from .VERSION file so that more info can be added and easier to get from scripts
file(STRINGS ".VERSION" first_line
LIMIT_COUNT 1
)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
PSBLAS_Version "${first_line}")
if((NOT (PSBLAS_Version MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) AND (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
message( STATUS "Build from git repository detected")
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --abbrev=0
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE git_status
OUTPUT_VARIABLE git_output
OUTPUT_STRIP_TRAILING_WHITESPACE)
if((git_status STREQUAL "0") AND (git_output MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+"))
set(PSBLAS_Version "${git_output}")
endif()
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE git_status
OUTPUT_VARIABLE full_git_describe
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT (git_status STREQUAL "0"))
set(full_git_describe NOTFOUND)
endif()
# Create a source distribution target using git archive
# e.g., `make dist` will package a release using current git state
add_custom_target(dist # OUTPUT "${CMAKE_BINARY_DIR}/${_OC_stem_name}.tar.gz"
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/makeDist.cmake" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}"
COMMENT "Creating source release asset, ${_OC_stem_name}.tar.gz, from ${git_full_describe} using the `git archive` command."
VERBATIM)
else()
message( WARNING "Could not find git executable!")
endif()
endif()
if(NOT (PSBLAS_Version MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+"))
message( WARNING "Could not extract version from git, falling back on .VERSION, line 3.")
file(STRINGS ".VERSION" PSBLAS_Version
REGEX "[0-9]+\\.[0-9]+\\.[0-9]+"
)
endif()
if(NOT full_git_describe)
set(full_git_describe ${PSBLAS_Version})
endif()
# Strip leading "v" character from PSBLAS version tags
string(REPLACE "v" "" PSBLAS_Version "${PSBLAS_Version}")
#------------------------------------------
project(psblas VERSION "${PSBLAS_Version}" LANGUAGES C Fortran)
message( STATUS "Building PSBLAS version: ${full_git_describe}" )
set(PSBLAS_dist_string "PSBLAS-${full_git_describe}")
#-----------------------------------------------------------------
# Define a target to create a checksummed & signed release archive
#-----------------------------------------------------------------
set(${CMAKE_PROJECT_NAME}_dist_string "${CMAKE_PROJECT_NAME}-${full_git_describe}")
if(GIT_FOUND)
add_custom_target(dist # OUTPUT "${CMAKE_BINARY_DIR}/${_package_stem_name}.tar.gz"
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/makeDist.cmake" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}"
COMMENT "Creating source release asset, ${_package_stem_name}.tar.gz, from ${_full_git_describe} using the `git archive` command."
VERBATIM)
endif()
#Print an error message on an attempt to build inside the source directory tree:
#--------------------------
# Prohibit in-source builds
#--------------------------
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
message(FATAL_ERROR "ERROR! "
"CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
@ -88,7 +50,7 @@ if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
"\nYou must now run something like:\n"
" $ rm -r CMakeCache.txt CMakeFiles/"
"\n"
"Please create a directory outside the PSBLAS source tree and build under that outside directory "
"Please create a directory outside the ${CMAKE_PROJECT_NAME} source tree and build under that outside directory "
"in a manner such as\n"
" $ mkdir build\n"
" $ cd build\n"
@ -97,7 +59,9 @@ if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
)
endif()
#Report untested Fortran compiler unless explicitly directed to build all examples.
#----------------------------------------------------
# Define coverage flags and report untested compilers
#----------------------------------------------------
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" )
set(gfortran_compiler true)
set ( CMAKE_C_FLAGS_CODECOVERAGE "-fprofile-arcs -ftest-coverage -O0"
@ -107,74 +71,14 @@ if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" )
else()
message(WARNING
"\n"
"Attempting to build with untested Fortran compiler: ${CMAKE_Fortran_COMPILER_ID}. "
"Attempting untested CMake build with Fortran compiler: ${CMAKE_Fortran_COMPILER_ID}. "
"Please report any failures at https://github.com/sfilippone/psblas3\n\n"
)
endif()
#-----------------------------------------------------------------
# Set CMAKE_Fortran_COMPILER_VERSION if CMake doesn't do it for us
#-----------------------------------------------------------------
if ( NOT CMAKE_Fortran_COMPILER_VERSION )
if ( NOT (CMAKE_VERSION VERSION_LESS 3.3.1) )
message( AUTHOR_WARNING
"CMake ${CMAKE_VERSION} should know about Fortran compiler versions but is missing CMAKE_Fortran_COMPILER_VERSION variable."
)
endif()
# No CMAKE_Fortran_COMPILER_VERSION set, build our own
# Try extracting it directly from ISO_FORTRAN_ENV's compiler_version
# Write program for introspection
file( WRITE "${CMAKE_BINARY_DIR}/get_compiler_ver.f90"
"program main
use iso_fortran_env, only: compiler_version, output_unit
write(output_unit,'(a)') compiler_version()
end program"
)
try_run( PROG_RAN COMPILE_SUCCESS
"${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/get_compiler_ver.f90"
RUN_OUTPUT_VARIABLE VER_STRING
)
if ( COMPILE_SUCCESS )
string( REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?"
DETECTED_VER "${VER_STRING}"
)
message( STATUS "Detected Fortran compiler as ${VER_STRING}" )
message( STATUS "Extracted version number: ${DETECTED_VER}" )
endif()
if( ( NOT COMPILE_SUCCESS ) OR ( NOT DETECTED_VER ) )
message( WARNING "Could not reliably detect Fortran compiler version. We'll infer it from
the C compiler if it matches the Fortran compiler ID." )
endif()
if( "${CMAKE_C_COMPILER_ID}" MATCHES "${CMAKE_Fortran_COMPILER_ID}" )
set( DETECTED_VER "${CMAKE_C_COMPILER_VERSION}" )
else()
message( FATAL_ERROR "Exhausted all possible means of detecting the Fortran compiler version, cannot proceed!" )
endif()
set( CMAKE_Fortran_COMPILER_VERSION "${DETECTED_VER}" )
endif()
if(gfortran_compiler)
set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "-fcoarray=single -ffree-form")
endif()
include(CheckFortranSourceCompiles)
CHECK_Fortran_SOURCE_COMPILES("
program main
implicit none
integer :: i
i = this_image()
end program
" Check_Simple_Coarray_Fortran_Source_Compiles)
if(gfortran_compiler)
set (CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
unset(OLD_REQUIRED_FLAGS)
endif()
#----------------------------------------------------------------------------
# Find MPI and set some flags so that FC and CC can point to gfortran and gcc
#----------------------------------------------------------------------------
# If the user passes FC=mpifort etc. check and prefer that location
get_filename_component( FTN_COMPILER_NAME "${CMAKE_Fortran_COMPILER}"
NAME )
@ -195,15 +99,7 @@ endif()
find_package( MPI )
if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC))
# Get default install location of MPICH from install.sh
execute_process( COMMAND "./install.sh" -P mpich
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE DEFAULT_MPICH_INSTALL_LOC
OUTPUT_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_program (MY_MPI_EXEC NAMES mpirun mpiexec lamexec srun
PATHS "${DEFAULT_MPICH_INSTALL_LOC}" ENV PATH
HINTS "${FTN_COMPILER_DIR}" "${C_COMPILER_DIR}"
PATH_SUFFIXES bin)
set ( MPI_HOME "${MPI_HOME}" "${MY_MPI_EXEC}" "${MY_MPI_EXEC}/.." )
@ -213,10 +109,11 @@ list(REMOVE_DUPLICATES MPI_Fortran_INCLUDE_PATH)
# Test for consistent MPI environment
if (NOT MPIEXEC)
message ( ERROR "CMake failed to find `mpiexec` or similar. If building with `./install.sh` please
report this bug to the PSBLAS developers at
https://github.com/sfilippone/psblas3/issues, otherwise point CMake
to the desired MPI runtime.")
message ( ERROR "CMake failed to find `mpiexec` or similar. If MPI is installed
on your system then please point CMake to the desired MPI runtime
using `cmake-gui` or `ccmake`. Otherwise, we will proceed with a
serial build. If you beleive you are getting this message in error,
please report this at https://github.com/sfilippone/psblas3/issues.")
endif()
get_filename_component(MPIEXEC_RELATIVE_LOC "${MPIEXEC}"
@ -246,20 +143,18 @@ else()
message ( WARNING "MPIEXEC is in \"${MPIEXEC_DIR},\"
which differs from the location of MPICC and/or MPIFC which are in
\"${MPICC_DIR}\" and \"${MPIFC_DIR},\" respectively.
This is likely indicative of a problem. If building with `./install.sh` please report
this to the PSBLAS developers by filing a new issue at:
https://github.com/sourceryinstitute/PSBLAS/issues/new")
This is likely indicative of an inconsistent MPI environment")
endif()
#-----------------------------------------------
# Work around bug #317 present on fedora systems
# Work around an issue present on fedora systems
#-----------------------------------------------
if( (MPI_C_LINK_FLAGS MATCHES "noexecstack") OR (MPI_Fortran_LINK_FLAGS MATCHES "noexecstack") )
message ( WARNING
"The `noexecstack` linker flag was found in the MPI_<lang>_LINK_FLAGS variable. This is
known to cause segmentation faults for some Fortran codes. See, e.g.,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71729 or
https://github.com/sourceryinstitute/PSBLAS/issues/317.
https://github.com/sourceryinstitute/OpenCoarrays/issues/317.
`noexecstack` is being replaced with `execstack`"
)
@ -389,7 +284,7 @@ if ( MPI_Fortran_MODULE_COMPILES )
else()
message ( WARNING "It appears that MPI was built with a different Fortran compiler. "
"It is possible that this may cause unpredictable behavior. The build will continue "
"using `mpif.h` BUT please report any suspicious behavior to the PSBLAS "
"using `mpif.h` BUT please report any suspicious behavior to the ${CMAKE_PROJECT_NAME} "
"developers."
)
endif()
@ -407,129 +302,52 @@ include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH})
# Use standardized GNU install directory conventions
#---------------------------------------------------
include(GNUInstallDirs)
set(mod_dir_tail "${PSBLAS_dist_string}_${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PSBLAS_dist_string}-tests")
set(mod_dir_tail "${${CMAKE_PROJECT_NAME}_dist_string}_${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${${CMAKE_PROJECT_NAME}_dist_string}-tests")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
#-----------------
# Install manpages
#-----------------
install(FILES "${CMAKE_SOURCE_DIR}/doc/man/man1/caf.1" "${CMAKE_SOURCE_DIR}/doc/man/man1/cafrun.1"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT documentation)
#---------------------------------------------------
# Define macro for compiling with wrapper script
#---------------------------------------------------
function(caf_compile_executable target main_depend)
foreach(includedir IN LISTS MPI_Fortran_INCLUDE_PATH)
set(includes ${includes} -I ${includedir})
endforeach()
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
separate_arguments(config_Fortran_flags UNIX_COMMAND "${CMAKE_Fortran_FLAGS_${build_type}}")
get_directory_property( DirDefs DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMPILE_DEFINITIONS )
set(localDefs "")
foreach(d ${DirDefs})
list(APPEND localDefs "-D${d}")
endforeach()
add_custom_command(OUTPUT "${target}"
COMMAND "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf" ${includes} ${localDefs} ${config_Fortran_flags} -o "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target}" "${CMAKE_CURRENT_SOURCE_DIR}/${main_depend}" ${ARGN}
DEPENDS "${main_depend}" ${ARGN} caf_mpi_static
VERBATIM
)
add_custom_target("build_${target}" ALL
DEPENDS "${target}")
endfunction(caf_compile_executable)
enable_testing()
#--------------------------------------------------------
# Setup shellcheck if present for testing/linting scripts
#--------------------------------------------------------
find_program(SHELLCHECK_EXE shellcheck
DOC "Path to shellcheck executable for linting scripts"
)
if (MPI_RUN_DEVELOPER_TESTS OR $ENV{PSBLAS_DEVELOPER})
if(NOT SHELLCHECK_EXE)
message( AUTHOR_WARNING "PSBLAS developers should install shellcheck to test/lint all shell scripts.
See https://github.com/koalaman/shellcheck#installing for info on obtaining shellcheck.")
endif()
endif()
function(lint_script script_dir script_name)
if (SHELLCHECK_EXE)
add_test(NAME "shellcheck:${script_name}"
COMMAND ${SHELLCHECK_EXE} -x "${script_dir}/${script_name}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
elseif (MPI_RUN_DEVELOPER_TESTS OR $ENV{PSBLAS_DEVELOPER})
message( AUTHOR_WARNING "test: shellcheck:${script_name} not run because shellcheck not installed." )
endif()
endfunction()
#-----------------------------------------------
# Setup script style testing & enforcement macro
#-----------------------------------------------
find_program(style_pl style.pl "${CMAKE_SOURCE_DIR}/developer-scripts/")
function(check_script_style script_full_path)
if(style_pl)
add_test(NAME "style:${script_full_path}"
COMMAND "${style_pl}" "${script_full_path}")
endif()
endfunction()
#------------------------------------------------------------------------------
# Add custom properties on targets for controling number of images during tests
# Add custom properties on targets for controling number of ranks during tests
#------------------------------------------------------------------------------
define_property(TARGET
PROPERTY MIN_IMAGES
BRIEF_DOCS "Minimum allowable images for the test <integer>"
FULL_DOCS "Property to mark executable targets run as tests that they require at least <MIN_IMAGES> images to run"
PROPERTY MIN_RANKS
BRIEF_DOCS "Minimum allowable ranks for the test <integer>"
FULL_DOCS "Property to mark executable targets run as tests that they require at least <MIN_RANKS> ranks to run"
)
define_property(TARGET
PROPERTY POWER_2_IMGS
BRIEF_DOCS "True if test must be run with a power of 2 images (T/F)"
FULL_DOCS "Property to mark executable targets run as tests that they require 2^n images."
PROPERTY POWER_2_RANKS
BRIEF_DOCS "True if test must be run with a power of 2 ranks (T/F)"
FULL_DOCS "Property to mark executable targets run as tests that they require 2^n ranks."
)
#-------------------------------
# Recurse into the src directory
#-------------------------------
#include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src)
#-----------------------------------------------------
# Publicize installed location to other CMake projects
#-----------------------------------------------------
install(EXPORT PSBLAS_Targets
NAMESPACE
PSBLAS::
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/psblas"
install(EXPORT ${CMAKE_PROJECT_NAME}-targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake"
)
include(CMakePackageConfigHelpers) # standard CMake module
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/PSBLASConfigVersion.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
VERSION "${psblas_VERSION}"
COMPATIBILITY AnyNewerVersion
COMPATIBILITY SameMajorVersion
)
configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg/PSBLASConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PSBLASConfig.cmake" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg/${CMAKE_PROJECT_NAME}Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CMAKE_PROJECT_NAME}Config.cmake" @ONLY)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PSBLASConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/PSBLASConfigVersion.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CMAKE_PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/psblas"
)
add_library(PSBLAS INTERFACE)
#target_compile_options(PSBLAS INTERFACE -fcoarray=lib)
#target_link_libraries(PSBLAS INTERFACE caf_mpi)
#------------------------------------------
# Add portable unistall command to makefile
@ -562,17 +380,17 @@ ProcessorCount(N_CPU)
function(add_mpi_test name num_mpi_rank test_target)
# Function to add MPI tests.
if(TARGET ${test_target})
get_target_property(min_test_ranks ${test_target} MIN_IMAGES)
get_target_property(min_test_ranks ${test_target} MIN_RANKS)
elseif(TARGET build_${test_target})
get_target_property(min_test_ranks build_${test_target} MIN_IMAGES)
get_target_property(min_test_ranks build_${test_target} MIN_RANKS)
endif()
if(min_test_ranks)
if(num_mpi_rank LESS min_test_ranks)
message( FATAL_ERROR "Test ${name} requires ${min_test_ranks} but was only given ${num_mpi_images}" )
message( FATAL_ERROR "Test ${name} requires ${min_test_ranks} but was only given ${num_mpi_ranks}" )
endif()
endif()
if ( ((N_CPU LESS num_mpi_rank) OR (N_CPU EQUAL 0)) )
message(STATUS "Test ${name} is oversubscribed: ${num_mpi_rank} CAF images requested with ${N_CPU} system processor available.")
message(STATUS "Test ${name} is oversubscribed: ${num_mpi_rank} CAF ranks requested with ${N_CPU} system processor available.")
if ( openmpi )
if (min_test_ranks)
set( num_mpi_rank ${min_test_ranks} )
@ -580,7 +398,7 @@ function(add_mpi_test name num_mpi_rank test_target)
set( num_mpi_rank 2 )
endif()
set (test_parameters --oversubscribe)
message( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name}, with ${num_mpi_rank} ranks/images." )
message( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name}, with ${num_mpi_rank} ranks." )
endif()
endif()
set(test_parameters -np ${num_mpi_rank} ${test_parameters})
@ -592,16 +410,9 @@ endfunction(add_mpi_test)
# Add PSBLAS tests
#-----------------
if (MPI_RUN_DEVELOPER_TESTS OR $ENV{PSBLAS_DEVELOPER})
message ( STATUS "Running Developer tests is enabled." )
endif()
# Unit tests targeting each function, argument, and branch of code
# add_mpi_test(initialize_mpi 2 initialize_mpi)
#include(cmake/AddInstallationScriptTest.cmake )
#add_installation_script_test(installation-scripts.sh src/tests/installation/)
add_definitions(
-DHAVE_METIS -DHAVE_LAPACK -DHAVE_MOLD -DHAVE_EXTENDS_TYPE_OF -DHAVE_SAME_TYPE_AS -DHAVE_FINAL -DHAVE_ISO_FORTRAN_ENV -DHAVE_FLUSH_STMT -DHAVE_VOLATILE -DMPI_MOD
)

@ -1,5 +1,7 @@
Changelog. A lot less detailed than usual, at least for past
history.
2017/12/26: Add CMake build system & rename aux directory to allow cloning on
Windows.
2017/10/02: Merged CBinding.
2017/09/30: Fixes for README, contributors, bug reporting address.
2017/08/09: New optional args to TRIL and TRIU to produce two output

@ -204,21 +204,21 @@ tools/psb_sasb.f90
./tools/psb_cfree.f90
./modules/psi_c_mod.f90
./modules/psi_mod.f90
./modules/aux/psb_string_mod.f90
./modules/aux/psb_sort_mod.f90
./modules/aux/psb_s_sort_mod.f90
./modules/aux/psi_d_serial_mod.f90
./modules/aux/psi_serial_mod.f90
./modules/aux/psb_i_sort_mod.f90
./modules/aux/psi_z_serial_mod.f90
./modules/aux/psi_i_serial_mod.f90
./modules/aux/psb_ip_reord_mod.f90
./modules/aux/psb_c_sort_mod.f90
./modules/aux/psb_hash_mod.f90
./modules/aux/psb_d_sort_mod.f90
./modules/aux/psi_s_serial_mod.f90
./modules/aux/psi_c_serial_mod.f90
./modules/aux/psb_z_sort_mod.f90
./modules/auxil/psb_string_mod.f90
./modules/auxil/psb_sort_mod.f90
./modules/auxil/psb_s_sort_mod.f90
./modules/auxil/psi_d_serial_mod.f90
./modules/auxil/psi_serial_mod.f90
./modules/auxil/psb_i_sort_mod.f90
./modules/auxil/psi_z_serial_mod.f90
./modules/auxil/psi_i_serial_mod.f90
./modules/auxil/psb_ip_reord_mod.f90
./modules/auxil/psb_c_sort_mod.f90
./modules/auxil/psb_hash_mod.f90
./modules/auxil/psb_d_sort_mod.f90
./modules/auxil/psi_s_serial_mod.f90
./modules/auxil/psi_c_serial_mod.f90
./modules/auxil/psb_z_sort_mod.f90
./modules/psb_base_mod.f90
./modules/psi_z_mod.f90
./modules/desc/psb_indx_map_mod.f90

@ -2,10 +2,10 @@ include ../../Make.inc
BASIC_MODS= psb_const_mod.o psb_error_mod.o psb_realloc_mod.o
COMMINT=psi_comm_buffers_mod.o psi_penv_mod.o psi_bcast_mod.o psi_reduce_mod.o psi_p2p_mod.o
UTIL_MODS = aux/psb_string_mod.o desc/psb_desc_const_mod.o desc/psb_indx_map_mod.o\
UTIL_MODS = auxil/psb_string_mod.o desc/psb_desc_const_mod.o desc/psb_indx_map_mod.o\
desc/psb_gen_block_map_mod.o desc/psb_list_map_mod.o desc/psb_repl_map_mod.o\
desc/psb_glist_map_mod.o desc/psb_hash_map_mod.o \
desc/psb_desc_mod.o aux/psb_sort_mod.o \
desc/psb_desc_mod.o auxil/psb_sort_mod.o \
serial/psb_s_serial_mod.o serial/psb_d_serial_mod.o serial/psb_c_serial_mod.o serial/psb_z_serial_mod.o \
serial/psb_serial_mod.o \
tools/psb_cd_tools_mod.o tools/psb_i_tools_mod.o tools/psb_s_tools_mod.o tools/psb_d_tools_mod.o\
@ -23,13 +23,13 @@ UTIL_MODS = aux/psb_string_mod.o desc/psb_desc_const_mod.o desc/psb_indx_map_mod
serial/psb_vect_mod.o\
psblas/psb_s_psblas_mod.o psblas/psb_c_psblas_mod.o \
psblas/psb_d_psblas_mod.o psblas/psb_z_psblas_mod.o psblas/psb_psblas_mod.o \
aux/psi_serial_mod.o aux/psi_i_serial_mod.o \
aux/psi_s_serial_mod.o aux/psi_d_serial_mod.o aux/psi_c_serial_mod.o aux/psi_z_serial_mod.o \
auxil/psi_serial_mod.o auxil/psi_i_serial_mod.o \
auxil/psi_s_serial_mod.o auxil/psi_d_serial_mod.o auxil/psi_c_serial_mod.o auxil/psi_z_serial_mod.o \
psi_mod.o psi_i_mod.o psi_s_mod.o psi_d_mod.o psi_c_mod.o psi_z_mod.o\
aux/psb_ip_reord_mod.o\
aux/psb_i_sort_mod.o aux/psb_s_sort_mod.o aux/psb_d_sort_mod.o \
aux/psb_c_sort_mod.o aux/psb_z_sort_mod.o \
psb_check_mod.o aux/psb_hash_mod.o\
auxil/psb_ip_reord_mod.o\
auxil/psb_i_sort_mod.o auxil/psb_s_sort_mod.o auxil/psb_d_sort_mod.o \
auxil/psb_c_sort_mod.o auxil/psb_z_sort_mod.o \
psb_check_mod.o auxil/psb_hash_mod.o\
serial/psb_base_mat_mod.o serial/psb_mat_mod.o\
serial/psb_s_base_mat_mod.o serial/psb_s_csr_mat_mod.o serial/psb_s_csc_mat_mod.o serial/psb_s_mat_mod.o \
serial/psb_d_base_mat_mod.o serial/psb_d_csr_mat_mod.o serial/psb_d_csc_mat_mod.o serial/psb_d_mat_mod.o \
@ -60,24 +60,24 @@ psi_penv_mod.o: psi_comm_buffers_mod.o
psi_bcast_mod.o psi_reduce_mod.o psi_p2p_mod.o: psi_penv_mod.o
aux/psb_string_mod.o desc/psb_desc_const_mod.o psi_comm_buffers_mod.o: psb_const_mod.o
aux/psb_hash_mod.o: psb_realloc_mod.o psb_const_mod.o
aux/psb_i_sort_mod.o aux/psb_s_sort_mod.o aux/psb_d_sort_mod.o aux/psb_c_sort_mod.o aux/psb_z_sort_mod.o \
aux/psb_ip_reord_mod.o aux/psi_serial_mod.o aux/psb_sort_mod.o: $(BASIC_MODS)
aux/psb_sort_mod.o: aux/psb_i_sort_mod.o aux/psb_s_sort_mod.o aux/psb_d_sort_mod.o \
aux/psb_c_sort_mod.o aux/psb_z_sort_mod.o aux/psb_ip_reord_mod.o aux/psi_serial_mod.o
aux/psi_serial_mod.o: aux/psi_i_serial_mod.o \
aux/psi_s_serial_mod.o aux/psi_d_serial_mod.o aux/psi_c_serial_mod.o aux/psi_z_serial_mod.o
aux/psi_i_serial_mod.o aux/psi_s_serial_mod.o aux/psi_d_serial_mod.o aux/psi_c_serial_mod.o aux/psi_z_serial_mod.o: psb_const_mod.o
auxil/psb_string_mod.o desc/psb_desc_const_mod.o psi_comm_buffers_mod.o: psb_const_mod.o
auxil/psb_hash_mod.o: psb_realloc_mod.o psb_const_mod.o
auxil/psb_i_sort_mod.o auxil/psb_s_sort_mod.o auxil/psb_d_sort_mod.o auxil/psb_c_sort_mod.o auxil/psb_z_sort_mod.o \
auxil/psb_ip_reord_mod.o auxil/psi_serial_mod.o auxil/psb_sort_mod.o: $(BASIC_MODS)
auxil/psb_sort_mod.o: auxil/psb_i_sort_mod.o auxil/psb_s_sort_mod.o auxil/psb_d_sort_mod.o \
auxil/psb_c_sort_mod.o auxil/psb_z_sort_mod.o auxil/psb_ip_reord_mod.o auxil/psi_serial_mod.o
auxil/psi_serial_mod.o: auxil/psi_i_serial_mod.o \
auxil/psi_s_serial_mod.o auxil/psi_d_serial_mod.o auxil/psi_c_serial_mod.o auxil/psi_z_serial_mod.o
auxil/psi_i_serial_mod.o auxil/psi_s_serial_mod.o auxil/psi_d_serial_mod.o auxil/psi_c_serial_mod.o auxil/psi_z_serial_mod.o: psb_const_mod.o
serial/psb_base_mat_mod.o: aux/psi_serial_mod.o
serial/psb_base_mat_mod.o: auxil/psi_serial_mod.o
serial/psb_s_base_mat_mod.o serial/psb_d_base_mat_mod.o serial/psb_c_base_mat_mod.o serial/psb_z_base_mat_mod.o: serial/psb_base_mat_mod.o
serial/psb_s_base_mat_mod.o: serial/psb_s_base_vect_mod.o
serial/psb_d_base_mat_mod.o: serial/psb_d_base_vect_mod.o
serial/psb_c_base_mat_mod.o: serial/psb_c_base_vect_mod.o
serial/psb_z_base_mat_mod.o: serial/psb_z_base_vect_mod.o
serial/psb_c_base_vect_mod.o serial/psb_s_base_vect_mod.o serial/psb_d_base_vect_mod.o serial/psb_z_base_vect_mod.o: serial/psb_i_base_vect_mod.o
serial/psb_i_base_vect_mod.o serial/psb_c_base_vect_mod.o serial/psb_s_base_vect_mod.o serial/psb_d_base_vect_mod.o serial/psb_z_base_vect_mod.o: aux/psi_serial_mod.o psb_realloc_mod.o
serial/psb_i_base_vect_mod.o serial/psb_c_base_vect_mod.o serial/psb_s_base_vect_mod.o serial/psb_d_base_vect_mod.o serial/psb_z_base_vect_mod.o: auxil/psi_serial_mod.o psb_realloc_mod.o
serial/psb_s_mat_mod.o: serial/psb_s_base_mat_mod.o serial/psb_s_csr_mat_mod.o serial/psb_s_csc_mat_mod.o serial/psb_s_vect_mod.o
serial/psb_d_mat_mod.o: serial/psb_d_base_mat_mod.o serial/psb_d_csr_mat_mod.o serial/psb_d_csc_mat_mod.o serial/psb_d_vect_mod.o serial/psb_i_vect_mod.o
serial/psb_c_mat_mod.o: serial/psb_c_base_mat_mod.o serial/psb_c_csr_mat_mod.o serial/psb_c_csc_mat_mod.o serial/psb_c_vect_mod.o
@ -93,15 +93,15 @@ serial/psb_s_vect_mod.o: serial/psb_s_base_vect_mod.o serial/psb_i_vect_mod.o
serial/psb_d_vect_mod.o: serial/psb_d_base_vect_mod.o serial/psb_i_vect_mod.o
serial/psb_c_vect_mod.o: serial/psb_c_base_vect_mod.o serial/psb_i_vect_mod.o
serial/psb_z_vect_mod.o: serial/psb_z_base_vect_mod.o serial/psb_i_vect_mod.o
serial/psb_s_serial_mod.o serial/psb_d_serial_mod.o serial/psb_c_serial_mod.o serial/psb_z_serial_mod.o: serial/psb_mat_mod.o aux/psb_string_mod.o aux/psb_sort_mod.o aux/psi_serial_mod.o
serial/psb_s_serial_mod.o serial/psb_d_serial_mod.o serial/psb_c_serial_mod.o serial/psb_z_serial_mod.o: serial/psb_mat_mod.o auxil/psb_string_mod.o auxil/psb_sort_mod.o auxil/psi_serial_mod.o
serial/psb_vect_mod.o: serial/psb_i_vect_mod.o serial/psb_d_vect_mod.o serial/psb_s_vect_mod.o serial/psb_c_vect_mod.o serial/psb_z_vect_mod.o
error.o psb_realloc_mod.o: psb_error_mod.o
psb_error_impl.o: psb_penv_mod.o
psb_spmat_type.o: aux/psb_string_mod.o aux/psb_sort_mod.o
psb_spmat_type.o: auxil/psb_string_mod.o auxil/psb_sort_mod.o
desc/psb_desc_mod.o: psb_penv_mod.o psb_realloc_mod.o\
aux/psb_hash_mod.o desc/psb_hash_map_mod.o desc/psb_list_map_mod.o \
auxil/psb_hash_mod.o desc/psb_hash_map_mod.o desc/psb_list_map_mod.o \
desc/psb_repl_map_mod.o desc/psb_gen_block_map_mod.o desc/psb_desc_const_mod.o\
desc/psb_indx_map_mod.o serial/psb_i_vect_mod.o
psi_i_mod.o: desc/psb_desc_mod.o serial/psb_i_vect_mod.o
@ -109,16 +109,16 @@ psi_s_mod.o: desc/psb_desc_mod.o serial/psb_s_vect_mod.o
psi_d_mod.o: desc/psb_desc_mod.o serial/psb_d_vect_mod.o
psi_c_mod.o: desc/psb_desc_mod.o serial/psb_c_vect_mod.o
psi_z_mod.o: desc/psb_desc_mod.o serial/psb_z_vect_mod.o
psi_mod.o: psb_penv_mod.o desc/psb_desc_mod.o aux/psi_serial_mod.o serial/psb_serial_mod.o\
psi_mod.o: psb_penv_mod.o desc/psb_desc_mod.o auxil/psi_serial_mod.o serial/psb_serial_mod.o\
psi_i_mod.o psi_s_mod.o psi_d_mod.o psi_c_mod.o psi_z_mod.o
desc/psb_indx_map_mod.o: desc/psb_desc_const_mod.o psb_error_mod.o psb_penv_mod.o
desc/psb_hash_map_mod.o desc/psb_list_map_mod.o desc/psb_repl_map_mod.o desc/psb_gen_block_map_mod.o:\
desc/psb_indx_map_mod.o desc/psb_desc_const_mod.o \
aux/psb_sort_mod.o psb_penv_mod.o
auxil/psb_sort_mod.o psb_penv_mod.o
desc/psb_glist_map_mod.o: desc/psb_list_map_mod.o
desc/psb_hash_map_mod.o: aux/psb_hash_mod.o aux/psb_sort_mod.o
desc/psb_gen_block_map_mod.o: aux/psb_hash_mod.o
desc/psb_hash_map_mod.o: auxil/psb_hash_mod.o auxil/psb_sort_mod.o
desc/psb_gen_block_map_mod.o: auxil/psb_hash_mod.o
psb_check_mod.o: desc/psb_desc_mod.o

@ -1,14 +0,0 @@
macro(add_installation_script_test name path)
# Copy the source to the binary tree
file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/${path}/${name}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${path}"
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/${path}/${name}-usage" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${path}"
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
add_test(NAME test-${name} COMMAND "${CMAKE_BINARY_DIR}/${path}/${name}")
set_property(TEST test-${name} PROPERTY WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${path}")
set_property(TEST test-${name} PROPERTY ENVIRONMENT "PSBLAS_SRC_DIR=${CMAKE_SOURCE_DIR}")
endmacro(add_installation_script_test)

@ -1 +1,17 @@
include("${CMAKE_CURRENT_LIST_DIR}/PSBLASTargets.cmake")
# Config file for the INSTALLED package
# Allow other CMake projects to find this package if it is installed
# Requires the use of the standard CMake module CMakePackageConfigHelpers
set ( @CMAKE_PROJECT_NAME@_VERSION @VERSION@ )
###@COMPILER_CONSISTENCY_CHECK@
@PACKAGE_INIT@
# Provide the targets
set_and_check ( @PACKAGE_NAME@_CONFIG_INSTALL_DIR "@PACKAGE_EXPORT_INSTALL_DIR@" )
include ( "${@PACKAGE_NAME@_CONFIG_INSTALL_DIR}/@PACKAGE_NAME@-targets.cmake" )
# Make the module files available via include
set_and_check ( @CMAKE_PROJECT_NAME@_INCLUDE_DIRS "@PACKAGE_INSTALL_MOD_DIR@" )

@ -0,0 +1,90 @@
include(CMakeParseArguments)
# Function to parse version info from git and/or .VERSION file
function(set_version)
set(options "")
set(oneValueArgs VERSION_VARIABLE GIT_DESCRIBE_VAR CUSTOM_VERSION_FILE CUSTOM_VERSION_REGEX )
set(multiValueArgs "")
cmake_parse_arguments(set_version "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Algorithm:
# 1. Get first line of .VERSION file, which will be set via `git archive` so long as
#
# 2. If not a packaged release check if this is an active git repo
# 3. Get version info from `git describe`
# 4. First the most recent tag is fetched if available
# 5. Then the full `git describe` output is fetched
if(NOT set_version_CUSTOM_VERSION_REGEX)
set(_VERSION_REGEX "[vV]*[0-9]+\\.[0-9]+\\.[0-9]+")
else()
set(_VERSION_REGEX ${set_version_CUSTOM_VERSION_REGEX})
endif()
if(NOT set_version_CUSTOM_VERSION_FILE)
set(_VERSION_FILE "${CMAKE_SOURCE_DIR}/.VERSION")
else()
set(_VERSION_FILE "${set_version_CUSTOM_VERSION_FILE}")
endif()
file(STRINGS "${_VERSION_FILE}" first_line
LIMIT_COUNT 1
)
string(REGEX MATCH ${_VERSION_REGEX}
_package_version "${first_line}")
if((NOT (_package_version MATCHES ${_VERSION_REGEX})) AND (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
message( STATUS "Build from git repository detected")
find_package(Git)
if(GIT_FOUND)
set(GIT_FOUND "${GIT_FOUND}" PARENT_SCOPE)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --abbrev=0
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE _git_status
OUTPUT_VARIABLE _git_output
OUTPUT_STRIP_TRAILING_WHITESPACE)
if((_git_status STREQUAL "0") AND (_git_output MATCHES ${_VERSION_REGEX}))
set(_package_version "${_git_output}")
endif()
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE _git_status
OUTPUT_VARIABLE _full_git_describe
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT (_git_status STREQUAL "0"))
set(_full_git_describe NOTFOUND)
endif()
else()
message( WARNING "Could not find git executable!")
endif()
endif()
if(NOT (_package_version MATCHES ${_VERSION_REGEX}))
message( WARNING "Could not extract version from git, falling back on ${_VERSION_FILE}.")
file(STRINGS ".VERSION" _package_version
REGEX ${_VERSION_REGEX}
)
endif()
if(NOT _full_git_describe)
set(_full_git_describe ${_package_version})
endif()
# Strip leading "v" character from package version tags so that
# the version string can be passed to the CMake `project` command
string(REPLACE "v" "" _package_version "${_package_version}")
string(REPLACE "V" "" _package_version "${_package_version}")
if(set_version_VERSION_VARIABLE)
set(${set_version_VERSION_VARIABLE} ${_package_version} PARENT_SCOPE)
else()
set(PROJECT_VERSION ${_package_version} PARENT_SCOPE)
endif()
if(set_version_GIT_DESCRIBE_VAR)
set(${set_version_GIT_DESCRIBE_VAR} ${_full_git_describe} PARENT_SCOPE)
else()
set(FULL_GIT_DESCRIBE ${_full_git_describe} PARENT_SCOPE)
endif()
endfunction()
Loading…
Cancel
Save