From 9ad92e0a5527c7b35be0ab1085430b1db1204fab Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 12 Dec 2017 18:02:11 -0800 Subject: [PATCH 01/48] Copy .VERSION & main CMakeLists from OpenCoarrays --- .VERSION | 13 + CMakeLists.txt | 743 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 756 insertions(+) create mode 100644 .VERSION create mode 100644 CMakeLists.txt diff --git a/.VERSION b/.VERSION new file mode 100644 index 000000000..6ff366451 --- /dev/null +++ b/.VERSION @@ -0,0 +1,13 @@ +$Format:%d%n%n$ +# Fall back version, probably last release: +1.9.3 + +# OpenCoarrays version file. This project uses semantic +# versioning. For details see http://semver.org +# +# Release archive created from commit: +# $Format:%H %d$ +# $Format:Created on %ci by %cN, and$ +# $Format:signed by %GS using %GK.$ +# $Format:Signature status: %G?$ +$Format:%GG$ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..caa9633a4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,743 @@ +cmake_minimum_required(VERSION 3.2) + +# Set the type/configuration of build to perform +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{OPENCOARRAYS_DEVELOPER}) + option(CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON) +else() + option(CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" OFF) +endif() +mark_as_advanced(CAF_RUN_DEVELOPER_TESTS) + +if( NOT DEFINED ENV{OPENCOARRAYS_DEVELOPER}) + set ( ENV{OPENCOARRAYS_DEVELOPER} FALSE ) +endif() + +# 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]+" + OpenCoarraysVersion "${first_line}") + +if((NOT (OpenCoarraysVersion 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(OpenCoarraysVersion "${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 (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) + message( WARNING "Could not extract version from git, falling back on .VERSION, line 3.") + file(STRINGS ".VERSION" OpenCoarraysVersion + REGEX "[0-9]+\\.[0-9]+\\.[0-9]+" + ) +endif() + +if(NOT full_git_describe) + set(full_git_describe ${OpenCoarraysVersion}) +endif() + +project(opencoarrays VERSION "${OpenCoarraysVersion}" LANGUAGES C Fortran) +message( STATUS "Building OpenCoarrays version: ${full_git_describe}" ) +set(OpenCoarrays_dist_string "OpenCoarrays-${full_git_describe}") + +#Print an error message on an attempt to build inside the source directory tree: +if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(FATAL_ERROR "ERROR! " + "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" + " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}" + "\nThis archive does not support in-source builds:\n" + "You must now delete the CMakeCache.txt file and the CMakeFiles/ directory under " + "the 'src' source directory or you will not be able to configure correctly!" + "\nYou must now run something like:\n" + " $ rm -r CMakeCache.txt CMakeFiles/" + "\n" + "Please create a directory outside the opencoarrays source tree and build under that outside directory " + "in a manner such as\n" + " $ mkdir build-opencarrays\n" + " $ cd build-opencoarrays\n" + " $ CC=gcc FC=gfortran cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/path/to/install/dir /path/to/opencoarrays/src/dir \n" + "\nsubstituting the appropriate syntax for your shell (the above line assumes the bash shell)." + ) +endif() + +#Report untested Fortran compiler unless explicitly directed to build all examples. +if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" ) + set(gfortran_compiler true) + set ( CMAKE_C_FLAGS_CODECOVERAGE "-fprofile-arcs -ftest-coverage -O0" + CACHE STRING "Code coverage C compiler flags") + set ( CMAKE_Fortran_FLAGS_CODECOVERAGE "-fprofile-arcs -ftest-coverage -O0" + CACHE STRING "Code coverage Fortran compiler flags") +else() + message(WARNING + "\n" + "Attempting to build with untested Fortran compiler: ${CMAKE_Fortran_COMPILER_ID}. " + "Please report any failures to opencoarrays@googlegroups.com\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() + + # We have populated CMAKE_Fortran_COMPILER_VERSION if it was missing + if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0)) + set(opencoarrays_aware_compiler true) + add_definitions(-DPREFIX_NAME=_gfortran_caf_) + else() + set(opencoarrays_aware_compiler false) + add_definitions(-DPREFIX_NAME=_caf_extensions_) + endif() + if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.4.0)) + # GCC patch to fix issue accepted for 5.4 release + # See https://github.com/sourceryinstitute/opencoarrays/issues/28 and + # https://groups.google.com/forum/#!msg/opencoarrays/RZOwwYTqG80/46S9eL696dgJ + message( STATUS "Disabling optimization flags due to GCC < 5.4 bug") + set(CMAKE_Fortran_FLAGS_RELEASE -O0 + CACHE STRING "Flags used by the compiler during release builds." FORCE) + set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O0" + CACHE STRING "Flags used by the compiler during release builds with debug info" FORCE) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0") + endif() + if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 ) ) + add_definitions(-DGCC_GE_7) # Tell library to build against GFortran 7.x bindings b/c we might be using clang for C + endif() + if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0.0 ) ) + add_definitions(-DGCC_GE_8) # Tell library to build against GFortran 8.x bindings w/ descriptor change + 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 ) +get_filename_component( C_COMPILER_NAME "${CMAKE_C_COMPILER}" + NAME ) +get_filename_component( FTN_COMPILER_DIR "${CMAKE_Fortran_COMPILER}" + REALPATH ) +get_filename_component( C_COMPILER_DIR "${CMAKE_C_COMPILER}" + REALPATH ) + +if (FTN_COMPILER_NAME MATCHES "^[mM][pP][iI]") + set (MPI_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}") +endif() +if (C_COMPILER_NAME MATCHES "^[mM][pP][iI]") + set (MPI_C_COMPILER "${CMAKE_C_COMPILER}") +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}/.." ) + find_package( MPI REQUIRED ) +endif() +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 OpenCoarrays developers at +https://github.com/sourceryinstitute/opencoarrays/issues, otherwise point CMake +to the desired MPI runtime.") +endif() + +get_filename_component(MPIEXEC_RELATIVE_LOC "${MPIEXEC}" + PROGRAM) +get_filename_component(MPIEXEC_ABS_LOC "${MPIEXEC_RELATIVE_LOC}" + REALPATH) +get_filename_component(MPIEXEC_DIR "${MPIEXEC_ABS_LOC}" + DIRECTORY) + +get_filename_component(MPICC_RELATIVE_LOC "${MPI_C_COMPILER}" + PROGRAM) +get_filename_component(MPICC_ABS_LOC "${MPICC_RELATIVE_LOC}" + REALPATH) +get_filename_component(MPICC_DIR "${MPICC_ABS_LOC}" + DIRECTORY) + +get_filename_component(MPIFC_RELATIVE_LOC "${MPI_Fortran_COMPILER}" + PROGRAM) +get_filename_component(MPIFC_ABS_LOC "${MPIFC_RELATIVE_LOC}" + REALPATH) +get_filename_component(MPIFC_DIR "${MPIFC_ABS_LOC}" + DIRECTORY) + +if ((MPIEXEC_DIR STREQUAL MPICC_DIR) AND (MPIEXEC_DIR STREQUAL MPIFC_DIR)) + message ( STATUS "MPI runtime and compile time environments appear to be consistent") +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 OpenCoarrays developers by filing a new issue at: +https://github.com/sourceryinstitute/OpenCoarrays/issues/new") +endif() + +#----------------------------------------------- +# Work around bug #317 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__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/OpenCoarrays/issues/317. + +`noexecstack` is being replaced with `execstack`" + ) + string(REPLACE "noexecstack" + "execstack" MPI_C_LINK_FLAGS_FIXED ${MPI_C_LINK_FLAGS}) + string(REPLACE "noexecstack" + "execstack" MPI_Fortran_LINK_FLAGS_FIXED ${MPI_Fortran_LINK_FLAGS}) + set(MPI_C_LINK_FLAGS "${MPI_C_LINK_FLAGS_FIXED}" CACHE STRING + "MPI C linking flags" FORCE) + set(MPI_Fortran_LINK_FLAGS "${MPI_Fortran_LINK_FLAGS_FIXED}" CACHE STRING + "MPI Fortran linking flags" FORCE) +endif() + +#-------------------------------------------------------- +# Make sure a simple "hello world" C mpi program compiles +#-------------------------------------------------------- +set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS} ${MPI_C_LINK_FLAGS}) +set(OLD_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) +set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +set(OLD_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) +set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) +include (CheckCSourceCompiles) +CHECK_C_SOURCE_COMPILES(" +#include +#include +int main(int argc, char** argv) { + MPI_Init(NULL, NULL); + int world_size; + MPI_Comm_size(MPI_COMM_WORLD, &world_size); + int world_rank; + MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); + char processor_name[MPI_MAX_PROCESSOR_NAME]; + int name_len; + MPI_Get_processor_name(processor_name, &name_len); + printf('Hello world from processor %s, rank %d out of %d processors', + processor_name, world_rank, world_size); + MPI_Finalize(); +}" +MPI_C_COMPILES) +set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_INCLUDES ${OLD_INCLUDES}) +set(CMAKE_REQUIRED_LIBRARIES ${OLD_LIBRARIES}) +unset(OLD_REQUIRED_FLAGS) +unset(OLD_INCLUDES) +unset(OLD_LIBRARIES) + +if (NOT MPI_C_COMPILES) + message(FATAL_ERROR "MPI_C is missing! " + "Try setting MPI_C_COMPILER to the appropriate C compiler wrapper script and reconfigure. " + "i.e., `cmake -DMPI_C_COMPILER=/path/to/mpicc ..` or set it by editing the cache using " + "cmake-gui or ccmake." + ) +endif() + +#-------------------------------------------------------------- +# Make sure a simple "hello world" Fortran mpi program compiles +# Try using mpi.mod first then fall back on includ 'mpif.h' +#-------------------------------------------------------------- +set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS "-ffree-form" ${MPI_Fortran_COMPILE_FLAGS} ${MPI_Fortran_LINK_FLAGS}) +set(OLD_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) +set(CMAKE_REQUIRED_INCLUDES ${MPI_Fortran_INCLUDE_PATH}) +set(OLD_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) +set(CMAKE_REQUIRED_LIBRARIES ${MPI_Fortran_LIBRARIES}) +include (CheckFortranSourceCompiles) +CHECK_Fortran_SOURCE_COMPILES(" +program mpi_hello +use mpi +implicit none +integer :: ierr, mpi_world_size, mpi_world_rank, res_len +character*(MPI_MAX_PROCESSOR_NAME) :: proc +call mpi_init(ierr) +call mpi_comm_size(MPI_COMM_WORLD,mpi_world_size,ierr) +call mpi_comm_rank(MPI_COMM_WORLD,mpi_world_rank,ierr) +call mpi_get_processor_name(proc,res_len,ierr) +write(*,*) 'Hello from processor ', trim(proc), ' rank ', mpi_world_rank, ' out of ', mpi_world_size, '.' +call mpi_finalize(ierr) +end program +" +MPI_Fortran_MODULE_COMPILES) +set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_INCLUDES ${OLD_INCLUDES}) +set(CMAKE_REQUIRED_LIBRARIES ${OLD_LIBRARIES}) +unset(OLD_REQUIRED_FLAGS) +unset(OLD_INCLUDES) +unset(OLD_LIBRARIES) + +#-------------------------------- +# If that failed try using mpif.h +#-------------------------------- +set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS "-ffree-form" ${MPI_Fortran_COMPILE_FLAGS} ${MPI_Fortran_LINK_FLAGS}) +set(OLD_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) +set(CMAKE_REQUIRED_INCLUDES ${MPI_Fortran_INCLUDE_PATH}) +set(OLD_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) +set(CMAKE_REQUIRED_LIBRARIES ${MPI_Fortran_LIBRARIES}) +include (CheckFortranSourceCompiles) +CHECK_Fortran_SOURCE_COMPILES(" +program mpi_hello +implicit none +include 'mpif.h' +integer :: ierr, mpi_world_size, mpi_world_rank, res_len +character*(MPI_MAX_PROCESSOR_NAME) :: proc +call mpi_init(ierr) +call mpi_comm_size(MPI_COMM_WORLD,mpi_world_size,ierr) +call mpi_comm_rank(MPI_COMM_WORLD,mpi_world_rank,ierr) +call mpi_get_processor_name(proc,res_len,ierr) +write(*,*) 'Hello from processor ', trim(proc), ' rank ', mpi_world_rank, ' out of ', mpi_world_size, '.' +call mpi_finalize(ierr) +end program +" + MPI_Fortran_INCLUDE_COMPILES) +set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_INCLUDES ${OLD_INCLUDES}) +set(CMAKE_REQUIRED_LIBRARIES ${OLD_LIBRARIES}) +unset(OLD_REQUIRED_FLAGS) +unset(OLD_INCLUDES) +unset(OLD_LIBRARIES) + +if ( (NOT MPI_Fortran_MODULE_COMPILES) AND (NOT MPI_Fortran_INCLUDE_COMPILES) ) + message ( WARNING "It appears that the Fortran MPI compiler is not working. " + "For OpenCoarrays Aware compilers, this may be irrelavent: " + " The src/extensions/opencoarrays.F90 module will be disabled, but it is " + " possible that the build will succeed, despite this fishy circumstance." + ) +endif() + +if ( MPI_Fortran_MODULE_COMPILES ) + add_definitions(-DMPI_WORKING_MODULE) +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 OpenCoarrays " + "developers." + ) +endif() + +#---------------- +# Setup MPI flags +#---------------- +set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) +set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) +set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) +set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) +include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) + +#--------------------------------------------------- +# Use standardized GNU install directory conventions +#--------------------------------------------------- +include(GNUInstallDirs) +set(mod_dir_tail "${OpenCoarrays_dist_string}_${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${OpenCoarrays_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 caf 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 (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) + if(NOT SHELLCHECK_EXE) + message( AUTHOR_WARNING "OpenCoarrays 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 (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_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 +#------------------------------------------------------------------------------ +define_property(TARGET + PROPERTY MIN_IMAGES + BRIEF_DOCS "Minimum allowable images for the test " + FULL_DOCS "Property to mark executable targets run as tests that they require at least images 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." + ) + + +#------------------------------- +# Recurse into the src directory +#------------------------------- +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src) + +add_subdirectory(src) + +#----------------------------------------------------- +# Publicize installed location to other CMake projects +#----------------------------------------------------- +install(EXPORT OpenCoarraysTargets + NAMESPACE + OpenCoarrays:: + DESTINATION + "${CMAKE_INSTALL_LIBDIR}/cmake/opencoarrays" +) +include(CMakePackageConfigHelpers) # standard CMake module +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/OpenCoarraysConfigVersion.cmake" + VERSION "${opencoarrays_VERSION}" + COMPATIBILITY AnyNewerVersion +) +configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg/OpenCoarraysConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/OpenCoarraysConfig.cmake" @ONLY) + +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/OpenCoarraysConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/OpenCoarraysConfigVersion.cmake" + DESTINATION + "${CMAKE_INSTALL_LIBDIR}/cmake/opencoarrays" +) + +add_library(OpenCoarrays INTERFACE) +target_compile_options(OpenCoarrays INTERFACE -fcoarray=lib) +target_link_libraries(OpenCoarrays INTERFACE caf_mpi) + +#------------------------------------------ +# Add portable unistall command to makefile +#------------------------------------------ +# Adapted from the CMake Wiki FAQ +configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_DIR}/uninstall.cmake" + @ONLY) + +add_custom_target ( uninstall + COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/uninstall.cmake" ) + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) +# See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend +# on the test executables + +#--------------------------------------------------------------------------------------- +# Define macro for adding CAF tests, and ensuring proper flags are passed to MPI runtime +#--------------------------------------------------------------------------------------- + +# Determine if we're using Open MPI +execute_process(COMMAND ${MPIEXEC} --version + OUTPUT_VARIABLE mpi_version_out) +if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]") + message( STATUS "OpenMPI detected") + set ( openmpi true ) +endif () + +include( ProcessorCount ) +ProcessorCount(N_CPU) +function(add_caf_test name num_caf_img test_target) + # Function to add MPI tests. + if(TARGET ${test_target}) + get_target_property(min_test_imgs ${test_target} MIN_IMAGES) + elseif(TARGET build_${test_target}) + get_target_property(min_test_imgs build_${test_target} MIN_IMAGES) + endif() + if(min_test_imgs) + if(num_caf_img LESS min_test_imgs) + message( FATAL_ERROR "Test ${name} requires ${min_test_imgs} but was only given ${num_caf_images}" ) + endif() + endif() + if ( ((N_CPU LESS num_caf_img) OR (N_CPU EQUAL 0)) ) + message(STATUS "Test ${name} is oversubscribed: ${num_caf_img} CAF images requested with ${N_CPU} system processor available.") + if ( openmpi ) + if (min_test_imgs) + set( num_caf_img ${min_test_imgs} ) + elseif ( N_CPU LESS 2 ) + set( num_caf_img 2 ) + endif() + set (test_parameters --oversubscribe) + message( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name}, with ${num_caf_img} ranks/images." ) + endif() + endif() + set(test_parameters -np ${num_caf_img} ${test_parameters}) + add_test(NAME ${name} COMMAND "bash" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun" ${test_parameters} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test_target}") + set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") +endfunction(add_caf_test) + +#-------------- +# Add OCA tests +#-------------- + +if(opencoarrays_aware_compiler) + if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) + message ( STATUS "Running Developer tests is enabled." ) + endif() + # Unit tests targeting each libcaf_mpi function, argument, and branch of code + add_caf_test(initialize_mpi 2 initialize_mpi) + add_caf_test(register 2 register) + add_caf_test(register_vector 2 register_vector) + add_caf_test(register_alloc_vector 2 register_alloc_vector) + add_caf_test(allocate_as_barrier 2 allocate_as_barrier) + add_caf_test(allocate_as_barrier_proc 8 allocate_as_barrier_proc) + if (gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})) + message( STATUS "Allocatable components of coarray derived types only supported in GFortran >= 7 with OpenCoarrays > 1.8.4" ) + message( STATUS "(but full support not anticipated until OpenCoarrays 2.0 release)" ) + if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) + message( AUTHOR_WARNING "Allocatable components of coarray derived type developer tests enabled, despite lack of support in GFortran < 7\n These tests should fail." ) + endif() + add_caf_test(register_alloc_comp_1 2 register_alloc_comp_1) + add_caf_test(register_alloc_comp_2 2 register_alloc_comp_2) + add_caf_test(register_alloc_comp_3 2 register_alloc_comp_3) + add_caf_test(async_comp_alloc 6 async_comp_alloc) + add_caf_test(async_comp_alloc_2 2 async_comp_alloc_2) + add_caf_test(comp_allocated_1 2 comp_allocated_1) + add_caf_test(comp_allocated_2 2 comp_allocated_2) + endif() + add_caf_test(get_array 2 get_array) + add_caf_test(get_self 2 get_self) + add_caf_test(send_array 2 send_array) + add_caf_test(get_with_offset_1d 2 get_with_offset_1d) + add_caf_test(whole_get_array 2 whole_get_array) + add_caf_test(strided_get 2 strided_get) + add_caf_test(strided_sendget 3 strided_sendget) + add_caf_test(co_sum 4 co_sum_test) + add_caf_test(co_broadcast 4 co_broadcast_test) + add_caf_test(co_min 4 co_min_test) + add_caf_test(co_max 4 co_max_test) + add_caf_test(syncall 8 syncall) + add_caf_test(syncimages 8 syncimages) + add_caf_test(syncimages2 8 syncimages2) + add_caf_test(duplicate_syncimages 8 duplicate_syncimages) + add_caf_test(co_reduce 4 co_reduce_test) + add_caf_test(co_reduce_res_im 4 co_reduce_res_im) + add_caf_test(co_reduce_string 4 co_reduce_string) + add_caf_test(syncimages_status 8 syncimages_status) + add_caf_test(sync_ring_abort_np3 3 sync_image_ring_abort_on_stopped_image) + add_caf_test(sync_ring_abort_np7 7 sync_image_ring_abort_on_stopped_image) + add_caf_test(simpleatomics 8 atomics) + # possible logic error in the following test +# add_caf_test(increment_my_neighbor 32 increment_my_neighbor) + + # Integration tests verifying the use of libcaf_mpi in applications + add_caf_test(hello_multiverse 2 hello_multiverse) + add_caf_test(coarray_burgers_pde 2 coarray_burgers_pde) + add_caf_test(co_heat 2 co_heat) + add_caf_test(asynchronous_hello_world 3 asynchronous_hello_world) + + # Regression tests based on reported issues + if((gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})) + if( CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 ) + message( AUTHOR_WARNING "Developer tests requested and GFortran < 7: test source-alloc-no-sync may fail" ) + endif() + # GFortran PR 78505 only fixed on trunk/gcc 7, issue #243 + add_caf_test(source-alloc-no-sync 8 source-alloc-sync) + endif() + + # Open GCC 7 regressions + if ((CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) OR (gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0))) + add_caf_test(convert-before-put 3 convert-before-put) + add_caf_test(put-alloc-comp 2 issue-422-send) + add_caf_test(get-put-alloc-comp 3 issue-422-send-get) + endif() + + add_caf_test(allocatable_p2p_event_post 4 allocatable_p2p_event_post) + # Fixed GCC 7 regressions, should run on GCC 6 and 7 + add_caf_test(static_event_post_issue_293 3 static_event_post_issue_293) + + # These co_reduce (#172, fixed by PR #332, addl discussion in PR + # #331) tests are for bugs not regressions. Should be fixed in all + # version of GCC, I beleive + add_caf_test(co_reduce-factorial 4 co_reduce-factorial) + add_caf_test(co_reduce-factorial-int8 4 co_reduce-factorial-int8) + add_caf_test(co_reduce-factorial-int64 4 co_reduce-factorial-int64) + + # IMAGE FAIL tests + if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) + add_caf_test(image_status_test_1 4 image_status_test_1) + if(CAF_ENABLE_FAILED_IMAGES) + if ((NOT DEFINED ENV{TRAVIS}) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})) + add_caf_test(image_fail_test_1 4 image_fail_test_1) + set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed.") + # No other way to check that image_fail_test_1 passes. + add_caf_test(image_fail_and_sync_test_1 4 image_fail_and_sync_test_1) + add_caf_test(image_fail_and_sync_test_2 4 image_fail_and_sync_test_2) + + add_caf_test(image_fail_and_sync_test_3 4 image_fail_and_sync_test_3) + add_caf_test(image_fail_and_status_test_1 4 image_fail_and_status_test_1) + add_caf_test(image_fail_and_failed_images_test_1 4 image_fail_and_failed_images_test_1) + add_caf_test(image_fail_and_stopped_images_test_1 4 image_fail_and_stopped_images_test_1) + add_caf_test(image_fail_and_get_test_1 4 image_fail_and_get_test_1) + endif() + endif() + endif() +else() + add_test(co_sum_extension test-co_sum-extension.sh) + set_property(TEST co_sum_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") + + add_test(co_broadcast_extension test-co_broadcast-extension.sh) + set_property(TEST co_broadcast_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") + + add_test(co_min_extension test-co_min-extension.sh) + set_property(TEST co_min_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") + + add_test(co_max_extension test-co_max-extension.sh) + set_property(TEST co_max_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") + + add_test(co_reduce_extension test-co_reduce-extension.sh) + set_property(TEST co_reduce_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") +endif() + +include(cmake/AddInstallationScriptTest.cmake ) +add_installation_script_test(installation-scripts.sh src/tests/installation/) From c8890772727d9c8f3a9d6bc791fa633a1fff1145 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 12 Dec 2017 18:25:44 -0800 Subject: [PATCH 02/48] Copy "cmake/" subdirectory from OpenCoarrays --- cmake/AddInstallationScriptTest.cmake | 14 +++++ cmake/makeDist.cmake | 79 ++++++++++++++++++++++++ cmake/opencoarrays-VER-SHA256.txt.asc.in | 12 ++++ cmake/opencoarrays-VER-SHA256.txt.in | 3 + cmake/pkg/OpenCoarraysConfig.cmake.in | 1 + cmake/uninstall.cmake.in | 23 +++++++ 6 files changed, 132 insertions(+) create mode 100644 cmake/AddInstallationScriptTest.cmake create mode 100644 cmake/makeDist.cmake create mode 100644 cmake/opencoarrays-VER-SHA256.txt.asc.in create mode 100644 cmake/opencoarrays-VER-SHA256.txt.in create mode 100644 cmake/pkg/OpenCoarraysConfig.cmake.in create mode 100644 cmake/uninstall.cmake.in diff --git a/cmake/AddInstallationScriptTest.cmake b/cmake/AddInstallationScriptTest.cmake new file mode 100644 index 000000000..ecf764bce --- /dev/null +++ b/cmake/AddInstallationScriptTest.cmake @@ -0,0 +1,14 @@ +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 "OPENCOARRAYS_SRC_DIR=${CMAKE_SOURCE_DIR}") +endmacro(add_installation_script_test) diff --git a/cmake/makeDist.cmake b/cmake/makeDist.cmake new file mode 100644 index 000000000..4011eceea --- /dev/null +++ b/cmake/makeDist.cmake @@ -0,0 +1,79 @@ +# CMake file to be called in script mode (${CMAKE_COMMAND} -P ) to +# Generate a source archive release asset from add_custom_command +# +# See SourceDistTarget.cmake + +if(NOT CMAKE_ARGV3) + message(FATAL_ERROR "Must pass the top level src dir to ${CMAKE_ARGV2} as the first argument") +endif() + +if(NOT CMAKE_ARGV4) + message(FATAL_ERROR "Must pass the top level src dir to ${CMAKE_ARGV2} as the second argument") +endif() + +find_package(Git) +if(NOT GIT_FOUND) + message( FATAL_ERROR "You can't create a source archive release asset without git!") +endif() + +execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always + RESULT_VARIABLE git_status + OUTPUT_VARIABLE git_version + WORKING_DIRECTORY "${CMAKE_ARGV3}" + OUTPUT_STRIP_TRAILING_WHITESPACE) +if(NOT (git_status STREQUAL "0")) + message( FATAL_ERROR "git describe --always failed with exit status: ${git_status} and message: +${git_version}") +endif() + +set(archive "OpenCoarrays-${git_version}") +set(l_archive "opencoarrays-${git_version}") +set(release_asset "${CMAKE_ARGV4}/${archive}.tar.gz") +execute_process( + COMMAND "${GIT_EXECUTABLE}" archive "--prefix=${archive}/" -o "${release_asset}" "${git_version}" + RESULT_VARIABLE git_status + OUTPUT_VARIABLE git_output + WORKING_DIRECTORY "${CMAKE_ARGV3}" + OUTPUT_STRIP_TRAILING_WHITESPACE) + +if(NOT (git_status STREQUAL "0")) + message( FATAL_ERROR "git archive ... failed with exit status: ${git_status} and message: +${git_output}") +else() + message( STATUS "Source code release asset created from `git archive`: ${release_asset}") +endif() + +file(SHA256 "${release_asset}" tarball_sha256) +set(sha256_checksum "${tarball_sha256} ${archive}.tar.gz") +configure_file("${CMAKE_ARGV3}/cmake/opencoarrays-VER-SHA256.txt.in" + "${CMAKE_ARGV4}/${l_archive}-SHA256.txt" + @ONLY) +message( STATUS + "SHA 256 checksum of release tarball written out as: ${CMAKE_ARGV4}/${l_archive}-SHA256.txt" ) + +find_program(GPG_EXECUTABLE + gpg + DOC "Location of GnuPG (gpg) executable") + +if(GPG_EXECUTABLE) + execute_process( + COMMAND "${GPG_EXECUTABLE}" --armor --detach-sign --comment "@gpg_comment@" "${CMAKE_ARGV4}/${l_archive}-SHA256.txt" + RESULT_VARIABLE gpg_status + OUTPUT_VARIABLE gpg_output + WORKING_DIRECTORY "${CMAKE_ARGV4}") + if(NOT (gpg_status STREQUAL "0")) + message( WARNING "GPG signing of ${CMAKE_ARGV4}/${l_archive}-SHA256.txt appears to have failed +with status: ${gpg_status} and output: ${gpg_output}") + else() + configure_file("${CMAKE_ARGV3}/cmake/opencoarrays-VER-SHA256.txt.asc.in" + "${CMAKE_ARGV4}/${l_archive}-GPG.comment" + @ONLY) + file(READ "${CMAKE_ARGV4}/${l_archive}-GPG.comment" gpg_comment) + configure_file("${CMAKE_ARGV4}/${l_archive}-SHA256.txt.asc" + "${CMAKE_ARGV4}/${l_archive}-SHA256.txt.asc.out" + @ONLY) + file(RENAME "${CMAKE_ARGV4}/${l_archive}-SHA256.txt.asc.out" + "${CMAKE_ARGV4}/${l_archive}-SHA256.txt.asc") + message(STATUS "GPG signed SHA256 checksum created: ${CMAKE_ARGV4}/${l_archive}-SHA256.txt.asc") + endif() +endif() diff --git a/cmake/opencoarrays-VER-SHA256.txt.asc.in b/cmake/opencoarrays-VER-SHA256.txt.asc.in new file mode 100644 index 000000000..3345fbf42 --- /dev/null +++ b/cmake/opencoarrays-VER-SHA256.txt.asc.in @@ -0,0 +1,12 @@ +Mac users can use GPGTools - https://gpgtools.org +Comment: Download Izaak Beekman's GPG public key from your +Comment: trusted key server or from +Comment: https://izaakbeekman.com/izaak.pubkey.txt +Comment: Next add it to your GPG keyring, e.g., +Comment: `curl https://izaakbeekman.com/izaak.pubkey.txt | gpg --import` +Comment: Make sure you have verified that the release archive's +Comment: SHA256 checksum matches the provided +Comment: opencoarrays-@git_version@-SHA256.txt and ensure that this file +Comment: and it's signature are in the same directory. Then +Comment: verify with: +Comment: `gpg --verify opencoarrays-@git_version@-SHA256.txt.asc` diff --git a/cmake/opencoarrays-VER-SHA256.txt.in b/cmake/opencoarrays-VER-SHA256.txt.in new file mode 100644 index 000000000..5c2e8af81 --- /dev/null +++ b/cmake/opencoarrays-VER-SHA256.txt.in @@ -0,0 +1,3 @@ +# To verify cryptographic checksums `shasum -c opencoarrays-@git_version@-SHA256.txt` on Mac OS X, or +# `sha256sum -c opencoarrays-@git_version@-SHA256.txt` on Linux. +@sha256_checksum@ diff --git a/cmake/pkg/OpenCoarraysConfig.cmake.in b/cmake/pkg/OpenCoarraysConfig.cmake.in new file mode 100644 index 000000000..1be75d0c6 --- /dev/null +++ b/cmake/pkg/OpenCoarraysConfig.cmake.in @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/OpenCoarraysTargets.cmake") diff --git a/cmake/uninstall.cmake.in b/cmake/uninstall.cmake.in new file mode 100644 index 000000000..dd3959305 --- /dev/null +++ b/cmake/uninstall.cmake.in @@ -0,0 +1,23 @@ +# Adapted from http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F May 1, 2014 + +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) From 79dd803410739bd9621e285c080984eadf50ae5b Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 12 Dec 2017 18:32:21 -0800 Subject: [PATCH 03/48] Adapt "cmake/" subdirectory to PSBLAS --- cmake/AddInstallationScriptTest.cmake | 2 +- cmake/makeDist.cmake | 8 ++++---- cmake/opencoarrays-VER-SHA256.txt.in | 3 --- cmake/pkg/OpenCoarraysConfig.cmake.in | 1 - cmake/pkg/PSBLASConfig.cmake.in | 1 + ...VER-SHA256.txt.asc.in => psblas-VER-SHA256.txt.asc.in} | 4 ++-- cmake/psblas-VER-SHA256.txt.in | 3 +++ 7 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 cmake/opencoarrays-VER-SHA256.txt.in delete mode 100644 cmake/pkg/OpenCoarraysConfig.cmake.in create mode 100644 cmake/pkg/PSBLASConfig.cmake.in rename cmake/{opencoarrays-VER-SHA256.txt.asc.in => psblas-VER-SHA256.txt.asc.in} (78%) create mode 100644 cmake/psblas-VER-SHA256.txt.in diff --git a/cmake/AddInstallationScriptTest.cmake b/cmake/AddInstallationScriptTest.cmake index ecf764bce..d6f7f9168 100644 --- a/cmake/AddInstallationScriptTest.cmake +++ b/cmake/AddInstallationScriptTest.cmake @@ -10,5 +10,5 @@ macro(add_installation_script_test name path) ) 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 "OPENCOARRAYS_SRC_DIR=${CMAKE_SOURCE_DIR}") + set_property(TEST test-${name} PROPERTY ENVIRONMENT "PSBLAS_SRC_DIR=${CMAKE_SOURCE_DIR}") endmacro(add_installation_script_test) diff --git a/cmake/makeDist.cmake b/cmake/makeDist.cmake index 4011eceea..f0b465660 100644 --- a/cmake/makeDist.cmake +++ b/cmake/makeDist.cmake @@ -26,8 +26,8 @@ if(NOT (git_status STREQUAL "0")) ${git_version}") endif() -set(archive "OpenCoarrays-${git_version}") -set(l_archive "opencoarrays-${git_version}") +set(archive "PSBLAS-${git_version}") +set(l_archive "PSBLAS-${git_version}") set(release_asset "${CMAKE_ARGV4}/${archive}.tar.gz") execute_process( COMMAND "${GIT_EXECUTABLE}" archive "--prefix=${archive}/" -o "${release_asset}" "${git_version}" @@ -45,7 +45,7 @@ endif() file(SHA256 "${release_asset}" tarball_sha256) set(sha256_checksum "${tarball_sha256} ${archive}.tar.gz") -configure_file("${CMAKE_ARGV3}/cmake/opencoarrays-VER-SHA256.txt.in" +configure_file("${CMAKE_ARGV3}/cmake/PSBLAS-VER-SHA256.txt.in" "${CMAKE_ARGV4}/${l_archive}-SHA256.txt" @ONLY) message( STATUS @@ -65,7 +65,7 @@ if(GPG_EXECUTABLE) message( WARNING "GPG signing of ${CMAKE_ARGV4}/${l_archive}-SHA256.txt appears to have failed with status: ${gpg_status} and output: ${gpg_output}") else() - configure_file("${CMAKE_ARGV3}/cmake/opencoarrays-VER-SHA256.txt.asc.in" + configure_file("${CMAKE_ARGV3}/cmake/PSBLAS-VER-SHA256.txt.asc.in" "${CMAKE_ARGV4}/${l_archive}-GPG.comment" @ONLY) file(READ "${CMAKE_ARGV4}/${l_archive}-GPG.comment" gpg_comment) diff --git a/cmake/opencoarrays-VER-SHA256.txt.in b/cmake/opencoarrays-VER-SHA256.txt.in deleted file mode 100644 index 5c2e8af81..000000000 --- a/cmake/opencoarrays-VER-SHA256.txt.in +++ /dev/null @@ -1,3 +0,0 @@ -# To verify cryptographic checksums `shasum -c opencoarrays-@git_version@-SHA256.txt` on Mac OS X, or -# `sha256sum -c opencoarrays-@git_version@-SHA256.txt` on Linux. -@sha256_checksum@ diff --git a/cmake/pkg/OpenCoarraysConfig.cmake.in b/cmake/pkg/OpenCoarraysConfig.cmake.in deleted file mode 100644 index 1be75d0c6..000000000 --- a/cmake/pkg/OpenCoarraysConfig.cmake.in +++ /dev/null @@ -1 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/OpenCoarraysTargets.cmake") diff --git a/cmake/pkg/PSBLASConfig.cmake.in b/cmake/pkg/PSBLASConfig.cmake.in new file mode 100644 index 000000000..93b403daa --- /dev/null +++ b/cmake/pkg/PSBLASConfig.cmake.in @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/PSBLASTargets.cmake") diff --git a/cmake/opencoarrays-VER-SHA256.txt.asc.in b/cmake/psblas-VER-SHA256.txt.asc.in similarity index 78% rename from cmake/opencoarrays-VER-SHA256.txt.asc.in rename to cmake/psblas-VER-SHA256.txt.asc.in index 3345fbf42..22cd9211b 100644 --- a/cmake/opencoarrays-VER-SHA256.txt.asc.in +++ b/cmake/psblas-VER-SHA256.txt.asc.in @@ -6,7 +6,7 @@ Comment: Next add it to your GPG keyring, e.g., Comment: `curl https://izaakbeekman.com/izaak.pubkey.txt | gpg --import` Comment: Make sure you have verified that the release archive's Comment: SHA256 checksum matches the provided -Comment: opencoarrays-@git_version@-SHA256.txt and ensure that this file +Comment: psblas-@git_version@-SHA256.txt and ensure that this file Comment: and it's signature are in the same directory. Then Comment: verify with: -Comment: `gpg --verify opencoarrays-@git_version@-SHA256.txt.asc` +Comment: `gpg --verify psblas-@git_version@-SHA256.txt.asc` diff --git a/cmake/psblas-VER-SHA256.txt.in b/cmake/psblas-VER-SHA256.txt.in new file mode 100644 index 000000000..1b3888c42 --- /dev/null +++ b/cmake/psblas-VER-SHA256.txt.in @@ -0,0 +1,3 @@ +# To verify cryptographic checksums `shasum -c psblas-@git_version@-SHA256.txt` on Mac OS X, or +# `sha256sum -c psblas-@git_version@-SHA256.txt` on Linux. +@sha256_checksum@ From 7b8e929b27405bee49350e5fda969d09b887f870 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 12 Dec 2017 18:32:53 -0800 Subject: [PATCH 04/48] Adapt .VERSION & CMakeLists.txt to PSBLAS --- .VERSION | 2 +- CMakeLists.txt | 292 +++++++++++++------------------------------------ 2 files changed, 78 insertions(+), 216 deletions(-) diff --git a/.VERSION b/.VERSION index 6ff366451..026477da9 100644 --- a/.VERSION +++ b/.VERSION @@ -1,6 +1,6 @@ $Format:%d%n%n$ # Fall back version, probably last release: -1.9.3 +3.5.0 # OpenCoarrays version file. This project uses semantic # versioning. For details see http://semver.org diff --git a/CMakeLists.txt b/CMakeLists.txt index caa9633a4..54ee24949 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,15 +7,15 @@ set ( CMAKE_BUILD_TYPE "Release" 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{OPENCOARRAYS_DEVELOPER}) - option(CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON) +if($ENV{PSBLAS_DEVELOPER}) + option(MPI_RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON) else() - option(CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" OFF) + option(MPI_RUN_DEVELOPER_TESTS "Run tests intended only for developers" OFF) endif() -mark_as_advanced(CAF_RUN_DEVELOPER_TESTS) +mark_as_advanced(MPI_RUN_DEVELOPER_TESTS) -if( NOT DEFINED ENV{OPENCOARRAYS_DEVELOPER}) - set ( ENV{OPENCOARRAYS_DEVELOPER} FALSE ) +if( NOT DEFINED ENV{PSBLAS_DEVELOPER}) + set ( ENV{PSBLAS_DEVELOPER} FALSE ) endif() # Name project and specify source languages @@ -25,9 +25,9 @@ file(STRINGS ".VERSION" first_line ) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" - OpenCoarraysVersion "${first_line}") + PSBLAS_Version "${first_line}") -if((NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) AND (EXISTS "${CMAKE_SOURCE_DIR}/.git")) +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) @@ -37,7 +37,7 @@ if((NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) AND (EXISTS "$ OUTPUT_VARIABLE git_output OUTPUT_STRIP_TRAILING_WHITESPACE) if((git_status STREQUAL "0") AND (git_output MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) - set(OpenCoarraysVersion "${git_output}") + set(PSBLAS_Version "${git_output}") endif() execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" @@ -58,20 +58,24 @@ if((NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) AND (EXISTS "$ endif() endif() -if(NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) +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" OpenCoarraysVersion + file(STRINGS ".VERSION" PSBLAS_Version REGEX "[0-9]+\\.[0-9]+\\.[0-9]+" ) endif() if(NOT full_git_describe) - set(full_git_describe ${OpenCoarraysVersion}) + set(full_git_describe ${PSBLAS_Version}) endif() -project(opencoarrays VERSION "${OpenCoarraysVersion}" LANGUAGES C Fortran) -message( STATUS "Building OpenCoarrays version: ${full_git_describe}" ) -set(OpenCoarrays_dist_string "OpenCoarrays-${full_git_describe}") +# 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}") #Print an error message on an attempt to build inside the source directory tree: if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") @@ -84,11 +88,11 @@ 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 opencoarrays source tree and build under that outside directory " + "Please create a directory outside the PSBLAS source tree and build under that outside directory " "in a manner such as\n" - " $ mkdir build-opencarrays\n" - " $ cd build-opencoarrays\n" - " $ CC=gcc FC=gfortran cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/path/to/install/dir /path/to/opencoarrays/src/dir \n" + " $ mkdir build\n" + " $ cd build\n" + " $ CC=gcc FC=gfortran cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/path/to/install/dir /path/to/psblas3/src/dir \n" "\nsubstituting the appropriate syntax for your shell (the above line assumes the bash shell)." ) endif() @@ -104,7 +108,7 @@ else() message(WARNING "\n" "Attempting to build with untested Fortran compiler: ${CMAKE_Fortran_COMPILER_ID}. " - "Please report any failures to opencoarrays@googlegroups.com\n\n" + "Please report any failures at https://github.com/sfilippone/psblas3\n\n" ) endif() @@ -149,32 +153,6 @@ the C compiler if it matches the Fortran compiler ID." ) set( CMAKE_Fortran_COMPILER_VERSION "${DETECTED_VER}" ) endif() - # We have populated CMAKE_Fortran_COMPILER_VERSION if it was missing - if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0)) - set(opencoarrays_aware_compiler true) - add_definitions(-DPREFIX_NAME=_gfortran_caf_) - else() - set(opencoarrays_aware_compiler false) - add_definitions(-DPREFIX_NAME=_caf_extensions_) - endif() - if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.4.0)) - # GCC patch to fix issue accepted for 5.4 release - # See https://github.com/sourceryinstitute/opencoarrays/issues/28 and - # https://groups.google.com/forum/#!msg/opencoarrays/RZOwwYTqG80/46S9eL696dgJ - message( STATUS "Disabling optimization flags due to GCC < 5.4 bug") - set(CMAKE_Fortran_FLAGS_RELEASE -O0 - CACHE STRING "Flags used by the compiler during release builds." FORCE) - set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O0" - CACHE STRING "Flags used by the compiler during release builds with debug info" FORCE) - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0") - endif() - if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 ) ) - add_definitions(-DGCC_GE_7) # Tell library to build against GFortran 7.x bindings b/c we might be using clang for C - endif() - if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0.0 ) ) - add_definitions(-DGCC_GE_8) # Tell library to build against GFortran 8.x bindings w/ descriptor change - endif() - if(gfortran_compiler) set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS "-fcoarray=single -ffree-form") @@ -236,8 +214,8 @@ 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 OpenCoarrays developers at -https://github.com/sourceryinstitute/opencoarrays/issues, otherwise point CMake +report this bug to the PSBLAS developers at +https://github.com/sfilippone/psblas3/issues, otherwise point CMake to the desired MPI runtime.") endif() @@ -269,8 +247,8 @@ else() 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 OpenCoarrays developers by filing a new issue at: -https://github.com/sourceryinstitute/OpenCoarrays/issues/new") +this to the PSBLAS developers by filing a new issue at: +https://github.com/sourceryinstitute/PSBLAS/issues/new") endif() #----------------------------------------------- @@ -281,7 +259,7 @@ if( (MPI_C_LINK_FLAGS MATCHES "noexecstack") OR (MPI_Fortran_LINK_FLAGS MATCHES "The `noexecstack` linker flag was found in the MPI__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/OpenCoarrays/issues/317. +https://github.com/sourceryinstitute/PSBLAS/issues/317. `noexecstack` is being replaced with `execstack`" ) @@ -403,11 +381,7 @@ unset(OLD_INCLUDES) unset(OLD_LIBRARIES) if ( (NOT MPI_Fortran_MODULE_COMPILES) AND (NOT MPI_Fortran_INCLUDE_COMPILES) ) - message ( WARNING "It appears that the Fortran MPI compiler is not working. " - "For OpenCoarrays Aware compilers, this may be irrelavent: " - " The src/extensions/opencoarrays.F90 module will be disabled, but it is " - " possible that the build will succeed, despite this fishy circumstance." - ) + message ( WARNING "It appears that the Fortran MPI compiler is not working. ") endif() if ( MPI_Fortran_MODULE_COMPILES ) @@ -415,7 +389,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 OpenCoarrays " + "using `mpif.h` BUT please report any suspicious behavior to the PSBLAS " "developers." ) endif() @@ -433,8 +407,8 @@ include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) # Use standardized GNU install directory conventions #--------------------------------------------------- include(GNUInstallDirs) -set(mod_dir_tail "${OpenCoarrays_dist_string}_${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${OpenCoarrays_dist_string}-tests") +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(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") @@ -447,7 +421,7 @@ install(FILES "${CMAKE_SOURCE_DIR}/doc/man/man1/caf.1" "${CMAKE_SOURCE_DIR}/doc/ COMPONENT documentation) #--------------------------------------------------- -# Define macro for compiling with caf wrapper script +# Define macro for compiling with wrapper script #--------------------------------------------------- function(caf_compile_executable target main_depend) foreach(includedir IN LISTS MPI_Fortran_INCLUDE_PATH) @@ -477,9 +451,9 @@ enable_testing() find_program(SHELLCHECK_EXE shellcheck DOC "Path to shellcheck executable for linting scripts" ) -if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) +if (MPI_RUN_DEVELOPER_TESTS OR $ENV{PSBLAS_DEVELOPER}) if(NOT SHELLCHECK_EXE) - message( AUTHOR_WARNING "OpenCoarrays developers should install shellcheck to test/lint all shell scripts. + 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() @@ -489,7 +463,7 @@ function(lint_script script_dir script_name) add_test(NAME "shellcheck:${script_name}" COMMAND ${SHELLCHECK_EXE} -x "${script_dir}/${script_name}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") - elseif (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) + elseif (MPI_RUN_DEVELOPER_TESTS OR $ENV{PSBLAS_DEVELOPER}) message( AUTHOR_WARNING "test: shellcheck:${script_name} not run because shellcheck not installed." ) endif() endfunction() @@ -525,39 +499,39 @@ define_property(TARGET #------------------------------- # Recurse into the src directory #------------------------------- -include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src) +#include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src) -add_subdirectory(src) +#add_subdirectory(src) #----------------------------------------------------- # Publicize installed location to other CMake projects #----------------------------------------------------- -install(EXPORT OpenCoarraysTargets +install(EXPORT PSBLASTargets NAMESPACE - OpenCoarrays:: + PSBLAS:: DESTINATION - "${CMAKE_INSTALL_LIBDIR}/cmake/opencoarrays" + "${CMAKE_INSTALL_LIBDIR}/cmake/psblas" ) include(CMakePackageConfigHelpers) # standard CMake module write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/OpenCoarraysConfigVersion.cmake" - VERSION "${opencoarrays_VERSION}" + "${CMAKE_CURRENT_BINARY_DIR}/PSBLASConfigVersion.cmake" + VERSION "${psblas_VERSION}" COMPATIBILITY AnyNewerVersion ) -configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg/OpenCoarraysConfig.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/OpenCoarraysConfig.cmake" @ONLY) +configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg/PSBLASConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PSBLASConfig.cmake" @ONLY) install( FILES - "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/OpenCoarraysConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/OpenCoarraysConfigVersion.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PSBLASConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/PSBLASConfigVersion.cmake" DESTINATION - "${CMAKE_INSTALL_LIBDIR}/cmake/opencoarrays" + "${CMAKE_INSTALL_LIBDIR}/cmake/psblas" ) -add_library(OpenCoarrays INTERFACE) -target_compile_options(OpenCoarrays INTERFACE -fcoarray=lib) -target_link_libraries(OpenCoarrays INTERFACE caf_mpi) +add_library(PSBLAS INTERFACE) +#target_compile_options(PSBLAS INTERFACE -fcoarray=lib) +#target_link_libraries(PSBLAS INTERFACE caf_mpi) #------------------------------------------ # Add portable unistall command to makefile @@ -587,157 +561,45 @@ endif () include( ProcessorCount ) ProcessorCount(N_CPU) -function(add_caf_test name num_caf_img test_target) +function(add_mpi_test name num_mpi_rank test_target) # Function to add MPI tests. if(TARGET ${test_target}) - get_target_property(min_test_imgs ${test_target} MIN_IMAGES) + get_target_property(min_test_ranks ${test_target} MIN_IMAGES) elseif(TARGET build_${test_target}) - get_target_property(min_test_imgs build_${test_target} MIN_IMAGES) + get_target_property(min_test_ranks build_${test_target} MIN_IMAGES) endif() - if(min_test_imgs) - if(num_caf_img LESS min_test_imgs) - message( FATAL_ERROR "Test ${name} requires ${min_test_imgs} but was only given ${num_caf_images}" ) + 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}" ) endif() endif() - if ( ((N_CPU LESS num_caf_img) OR (N_CPU EQUAL 0)) ) - message(STATUS "Test ${name} is oversubscribed: ${num_caf_img} CAF images requested with ${N_CPU} system processor available.") + 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.") if ( openmpi ) - if (min_test_imgs) - set( num_caf_img ${min_test_imgs} ) + if (min_test_ranks) + set( num_mpi_rank ${min_test_ranks} ) elseif ( N_CPU LESS 2 ) - set( num_caf_img 2 ) + 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_caf_img} ranks/images." ) + message( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name}, with ${num_mpi_rank} ranks/images." ) endif() endif() - set(test_parameters -np ${num_caf_img} ${test_parameters}) - add_test(NAME ${name} COMMAND "bash" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun" ${test_parameters} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test_target}") + set(test_parameters -np ${num_mpi_rank} ${test_parameters}) + add_test(NAME ${name} COMMAND "bash" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/mpirun" ${test_parameters} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test_target}") set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") -endfunction(add_caf_test) - -#-------------- -# Add OCA tests -#-------------- - -if(opencoarrays_aware_compiler) - if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) - message ( STATUS "Running Developer tests is enabled." ) - endif() - # Unit tests targeting each libcaf_mpi function, argument, and branch of code - add_caf_test(initialize_mpi 2 initialize_mpi) - add_caf_test(register 2 register) - add_caf_test(register_vector 2 register_vector) - add_caf_test(register_alloc_vector 2 register_alloc_vector) - add_caf_test(allocate_as_barrier 2 allocate_as_barrier) - add_caf_test(allocate_as_barrier_proc 8 allocate_as_barrier_proc) - if (gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})) - message( STATUS "Allocatable components of coarray derived types only supported in GFortran >= 7 with OpenCoarrays > 1.8.4" ) - message( STATUS "(but full support not anticipated until OpenCoarrays 2.0 release)" ) - if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) - message( AUTHOR_WARNING "Allocatable components of coarray derived type developer tests enabled, despite lack of support in GFortran < 7\n These tests should fail." ) - endif() - add_caf_test(register_alloc_comp_1 2 register_alloc_comp_1) - add_caf_test(register_alloc_comp_2 2 register_alloc_comp_2) - add_caf_test(register_alloc_comp_3 2 register_alloc_comp_3) - add_caf_test(async_comp_alloc 6 async_comp_alloc) - add_caf_test(async_comp_alloc_2 2 async_comp_alloc_2) - add_caf_test(comp_allocated_1 2 comp_allocated_1) - add_caf_test(comp_allocated_2 2 comp_allocated_2) - endif() - add_caf_test(get_array 2 get_array) - add_caf_test(get_self 2 get_self) - add_caf_test(send_array 2 send_array) - add_caf_test(get_with_offset_1d 2 get_with_offset_1d) - add_caf_test(whole_get_array 2 whole_get_array) - add_caf_test(strided_get 2 strided_get) - add_caf_test(strided_sendget 3 strided_sendget) - add_caf_test(co_sum 4 co_sum_test) - add_caf_test(co_broadcast 4 co_broadcast_test) - add_caf_test(co_min 4 co_min_test) - add_caf_test(co_max 4 co_max_test) - add_caf_test(syncall 8 syncall) - add_caf_test(syncimages 8 syncimages) - add_caf_test(syncimages2 8 syncimages2) - add_caf_test(duplicate_syncimages 8 duplicate_syncimages) - add_caf_test(co_reduce 4 co_reduce_test) - add_caf_test(co_reduce_res_im 4 co_reduce_res_im) - add_caf_test(co_reduce_string 4 co_reduce_string) - add_caf_test(syncimages_status 8 syncimages_status) - add_caf_test(sync_ring_abort_np3 3 sync_image_ring_abort_on_stopped_image) - add_caf_test(sync_ring_abort_np7 7 sync_image_ring_abort_on_stopped_image) - add_caf_test(simpleatomics 8 atomics) - # possible logic error in the following test -# add_caf_test(increment_my_neighbor 32 increment_my_neighbor) - - # Integration tests verifying the use of libcaf_mpi in applications - add_caf_test(hello_multiverse 2 hello_multiverse) - add_caf_test(coarray_burgers_pde 2 coarray_burgers_pde) - add_caf_test(co_heat 2 co_heat) - add_caf_test(asynchronous_hello_world 3 asynchronous_hello_world) - - # Regression tests based on reported issues - if((gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0)) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})) - if( CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 ) - message( AUTHOR_WARNING "Developer tests requested and GFortran < 7: test source-alloc-no-sync may fail" ) - endif() - # GFortran PR 78505 only fixed on trunk/gcc 7, issue #243 - add_caf_test(source-alloc-no-sync 8 source-alloc-sync) - endif() - - # Open GCC 7 regressions - if ((CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) OR (gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0))) - add_caf_test(convert-before-put 3 convert-before-put) - add_caf_test(put-alloc-comp 2 issue-422-send) - add_caf_test(get-put-alloc-comp 3 issue-422-send-get) - endif() - - add_caf_test(allocatable_p2p_event_post 4 allocatable_p2p_event_post) - # Fixed GCC 7 regressions, should run on GCC 6 and 7 - add_caf_test(static_event_post_issue_293 3 static_event_post_issue_293) - - # These co_reduce (#172, fixed by PR #332, addl discussion in PR - # #331) tests are for bugs not regressions. Should be fixed in all - # version of GCC, I beleive - add_caf_test(co_reduce-factorial 4 co_reduce-factorial) - add_caf_test(co_reduce-factorial-int8 4 co_reduce-factorial-int8) - add_caf_test(co_reduce-factorial-int64 4 co_reduce-factorial-int64) - - # IMAGE FAIL tests - if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) - add_caf_test(image_status_test_1 4 image_status_test_1) - if(CAF_ENABLE_FAILED_IMAGES) - if ((NOT DEFINED ENV{TRAVIS}) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})) - add_caf_test(image_fail_test_1 4 image_fail_test_1) - set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed.") - # No other way to check that image_fail_test_1 passes. - add_caf_test(image_fail_and_sync_test_1 4 image_fail_and_sync_test_1) - add_caf_test(image_fail_and_sync_test_2 4 image_fail_and_sync_test_2) - - add_caf_test(image_fail_and_sync_test_3 4 image_fail_and_sync_test_3) - add_caf_test(image_fail_and_status_test_1 4 image_fail_and_status_test_1) - add_caf_test(image_fail_and_failed_images_test_1 4 image_fail_and_failed_images_test_1) - add_caf_test(image_fail_and_stopped_images_test_1 4 image_fail_and_stopped_images_test_1) - add_caf_test(image_fail_and_get_test_1 4 image_fail_and_get_test_1) - endif() - endif() - endif() -else() - add_test(co_sum_extension test-co_sum-extension.sh) - set_property(TEST co_sum_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") - - add_test(co_broadcast_extension test-co_broadcast-extension.sh) - set_property(TEST co_broadcast_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") - - add_test(co_min_extension test-co_min-extension.sh) - set_property(TEST co_min_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") +endfunction(add_mpi_test) - add_test(co_max_extension test-co_max-extension.sh) - set_property(TEST co_max_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") +#----------------- +# Add PSBLAS tests +#----------------- - add_test(co_reduce_extension test-co_reduce-extension.sh) - set_property(TEST co_reduce_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") +if (MPI_RUN_DEVELOPER_TESTS OR $ENV{PSBLAS_DEVELOPER}) + message ( STATUS "Running Developer tests is enabled." ) endif() -include(cmake/AddInstallationScriptTest.cmake ) -add_installation_script_test(installation-scripts.sh src/tests/installation/) +# 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/) From ee2cb246f097ea89aa3908028062205ca01c927a Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 12 Dec 2017 18:38:49 -0800 Subject: [PATCH 05/48] Add base library build --- CMakeLists.txt | 362 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 362 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54ee24949..9f4761af3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -603,3 +603,365 @@ endif() #include(cmake/AddInstallationScriptTest.cmake ) #add_installation_script_test(installation-scripts.sh src/tests/installation/) + +add_library(base +base/internals/psi_desc_impl.f90 +base/internals/psi_crea_bnd_elem.f90 +base/internals/psi_bld_tmphalo.f90 +base/internals/psi_list_search.f90 +base/internals/psi_crea_ovr_elem.f90 +base/internals/psi_compute_size.f90 +base/internals/psi_dl_check.f90 +base/internals/psi_exist_ovr_elem.f90 +base/internals/psi_srtlist.f90 +base/internals/psi_bld_tmpovrl.f90 +base/internals/psi_crea_index.f90 +base/internals/psi_sort_dl.f90 +base/tools/psb_iallc.f90 +base/tools/psb_c_map.f90 +base/tools/psb_dspalloc.f90 +base/tools/psb_cspasb.f90 +base/tools/psb_dins.f90 +base/tools/psb_iasb.f90 +base/tools/psb_sspfree.f90 +base/tools/psb_cd_lstext.f90 +base/tools/psb_dsprn.f90 +base/tools/psb_cins.f90 +base/tools/psb_csprn.f90 +base/tools/psb_ifree.f90 +base/tools/psb_sspasb.f90 +base/tools/psb_z_map.f90 +base/tools/psb_zspins.f90 +base/tools/psb_sins.f90 +base/tools/psb_cdins.f90 +base/tools/psb_cspfree.f90 +base/tools/psb_cdalv.f90 +base/tools/psb_zallc.f90 +base/tools/psb_cspins.f90 +base/tools/psb_dallc.f90 +base/tools/psb_cdrep.f90 +base/tools/psb_dspfree.f90 +base/tools/psb_zspfree.f90 +base/tools/psb_get_overlap.f90 +base/tools/psb_cdals.f90 +base/tools/psb_dfree.f90 +base/tools/psb_dasb.f90 +base/tools/psb_zfree.f90 +base/tools/psb_zins.f90 +base/tools/psb_cd_switch_ovl_indxmap.f90 +base/tools/psb_sasb.f90 +base/tools/psb_callc.f90 +base/tools/psb_cd_reinit.f90 +base/tools/psb_cd_set_bld.f90 +base/tools/psb_s_map.f90 +base/tools/psb_cdprt.f90 +base/tools/psb_glob_to_loc.f90 +base/tools/psb_zasb.f90 +base/tools/psb_zspalloc.f90 +base/tools/psb_cspalloc.f90 +base/tools/psb_iins.f90 +base/tools/psb_d_map.f90 +base/tools/psb_cdren.f90 +base/tools/psb_casb.f90 +base/tools/psb_zsprn.f90 +base/tools/psb_sspins.f90 +base/tools/psb_zspasb.f90 +base/tools/psb_loc_to_glob.f90 +base/tools/psb_dspasb.f90 +base/tools/psb_cdall.f90 +base/tools/psb_sallc.f90 +base/tools/psb_ssprn.f90 +base/tools/psb_dspins.f90 +base/tools/psb_sspalloc.f90 +base/tools/psb_cd_inloc.f90 +base/tools/psb_sfree.f90 +base/tools/psb_cfree.f90 +base/modules/psi_c_mod.f90 +base/modules/psi_mod.f90 +base/modules/aux/psb_string_mod.f90 +base/modules/aux/psb_sort_mod.f90 +base/modules/aux/psb_s_sort_mod.f90 +base/modules/aux/psi_d_serial_mod.f90 +base/modules/aux/psi_serial_mod.f90 +base/modules/aux/psb_i_sort_mod.f90 +base/modules/aux/psi_z_serial_mod.f90 +base/modules/aux/psi_i_serial_mod.f90 +base/modules/aux/psb_ip_reord_mod.f90 +base/modules/aux/psb_c_sort_mod.f90 +base/modules/aux/psb_hash_mod.f90 +base/modules/aux/psb_d_sort_mod.f90 +base/modules/aux/psi_s_serial_mod.f90 +base/modules/aux/psi_c_serial_mod.f90 +base/modules/aux/psb_z_sort_mod.f90 +base/modules/psb_base_mod.f90 +base/modules/psi_z_mod.f90 +base/modules/desc/psb_indx_map_mod.f90 +base/modules/desc/psb_repl_map_mod.f90 +base/modules/desc/psb_desc_const_mod.f90 +base/modules/desc/psb_gen_block_map_mod.f90 +base/modules/desc/psb_hash_map_mod.f90 +base/modules/desc/psb_glist_map_mod.f90 +base/modules/desc/psb_list_map_mod.f90 +base/modules/psi_d_mod.f90 +base/modules/tools/psb_i_tools_mod.f90 +base/modules/tools/psb_d_tools_mod.f90 +base/modules/tools/psb_s_tools_mod.f90 +base/modules/tools/psb_tools_mod.f90 +base/modules/tools/psb_cd_tools_mod.f90 +base/modules/tools/psb_z_tools_mod.f90 +base/modules/tools/psb_c_tools_mod.f90 +base/modules/psi_s_mod.f90 +base/modules/comm/psb_d_linmap_mod.f90 +base/modules/comm/psb_s_linmap_mod.f90 +base/modules/comm/psb_base_linmap_mod.f90 +base/modules/comm/psb_i_comm_mod.f90 +base/modules/comm/psb_c_linmap_mod.f90 +base/modules/comm/psb_c_comm_mod.f90 +base/modules/comm/psb_z_comm_mod.f90 +base/modules/comm/psb_z_linmap_mod.f90 +base/modules/comm/psb_s_comm_mod.f90 +base/modules/comm/psb_d_comm_mod.f90 +base/modules/comm/psb_comm_mod.f90 +base/modules/comm/psb_linmap_mod.f90 +base/modules/psblas/psb_psblas_mod.f90 +base/modules/psi_i_mod.f90 +base/modules/serial/psb_s_csr_mat_mod.f90 +base/modules/serial/psb_z_mat_mod.f90 +base/modules/serial/psb_s_base_mat_mod.f90 +base/modules/serial/psb_s_base_vect_mod.f90 +base/modules/serial/psb_z_csc_mat_mod.f90 +base/modules/serial/psb_d_csr_mat_mod.f90 +base/modules/serial/psb_s_csc_mat_mod.f90 +base/modules/serial/psb_i_base_vect_mod.f90 +base/modules/serial/psb_z_base_vect_mod.f90 +base/modules/serial/psb_c_csr_mat_mod.f90 +base/modules/serial/psb_c_serial_mod.f90 +base/modules/serial/psb_c_base_vect_mod.f90 +base/modules/serial/psb_s_serial_mod.f90 +base/modules/serial/psb_d_csc_mat_mod.f90 +base/modules/serial/psb_vect_mod.f90 +base/modules/serial/psb_base_mat_mod.f90 +base/modules/serial/psb_c_csc_mat_mod.f90 +base/modules/serial/psb_z_base_mat_mod.f90 +base/modules/serial/psb_z_csr_mat_mod.f90 +base/modules/serial/psb_c_mat_mod.f90 +base/modules/serial/psb_d_base_mat_mod.f90 +base/modules/serial/psb_d_serial_mod.f90 +base/modules/serial/psb_c_base_mat_mod.f90 +base/modules/serial/psb_d_base_vect_mod.f90 +base/modules/serial/psb_serial_mod.f90 +base/modules/serial/psb_s_mat_mod.f90 +base/modules/serial/psb_z_serial_mod.f90 +base/modules/serial/psb_d_mat_mod.f90 +base/modules/serial/psb_mat_mod.f90 +base/modules/error.f90 +base/modules/psb_check_mod.f90 +base/comm/psb_shalo.f90 +base/comm/psb_dhalo.f90 +base/comm/psb_igather.f90 +base/comm/internals/psi_iovrl_restr.f90 +base/comm/internals/psi_covrl_upd.f90 +base/comm/internals/psi_covrl_save.f90 +base/comm/internals/psi_sovrl_upd.f90 +base/comm/internals/psi_dovrl_restr.f90 +base/comm/internals/psi_zovrl_restr.f90 +base/comm/internals/psi_dovrl_save.f90 +base/comm/internals/psi_zovrl_save.f90 +base/comm/internals/psi_sovrl_restr.f90 +base/comm/internals/psi_zovrl_upd.f90 +base/comm/internals/psi_sovrl_save.f90 +base/comm/internals/psi_iovrl_upd.f90 +base/comm/internals/psi_covrl_restr.f90 +base/comm/internals/psi_iovrl_save.f90 +base/comm/internals/psi_dovrl_upd.f90 +base/comm/psb_iovrl.f90 +base/comm/psb_cgather.f90 +base/comm/psb_covrl.f90 +base/comm/psb_zovrl.f90 +base/comm/psb_ihalo.f90 +base/comm/psb_dgather.f90 +base/comm/psb_sovrl.f90 +base/comm/psb_dovrl.f90 +base/comm/psb_zgather.f90 +base/comm/psb_zhalo.f90 +base/comm/psb_sgather.f90 +base/comm/psb_chalo.f90 +base/psblas/psb_snrmi.f90 +base/psblas/psb_dspmm.f90 +base/psblas/psb_samax.f90 +base/psblas/psb_sxdot.f90 +base/psblas/psb_dspnrm1.f90 +base/psblas/psb_sspnrm1.f90 +base/psblas/psb_sspmm.f90 +base/psblas/psb_dnrmi.f90 +base/psblas/psb_zamax.f90 +base/psblas/psb_cspmm.f90 +base/psblas/psb_dspsm.f90 +base/psblas/psb_casum.f90 +base/psblas/psb_cnrmi.f90 +base/psblas/psb_znrm2.f90 +base/psblas/psb_zspsm.f90 +base/psblas/psb_camax.f90 +base/psblas/psb_dnrm2.f90 +base/psblas/psb_znrmi.f90 +base/psblas/psb_cspsm.f90 +base/psblas/psb_sdot.f90 +base/psblas/psb_dasum.f90 +base/psblas/psb_zasum.f90 +base/psblas/psb_damax.f90 +base/psblas/psb_zspmm.f90 +base/psblas/psb_cnrm2.f90 +base/psblas/psb_ddot.f90 +base/psblas/psb_caxpby.f90 +base/psblas/psb_cdot.f90 +base/psblas/psb_snrm2.f90 +base/psblas/psb_sspsm.f90 +base/psblas/psb_daxpby.f90 +base/psblas/psb_zdot.f90 +base/psblas/psb_zaxpby.f90 +base/psblas/psb_zspnrm1.f90 +base/psblas/psb_sasum.f90 +base/psblas/psb_saxpby.f90 +base/psblas/psb_cspnrm1.f90 +base/serial/psb_zspspmm.f90 +base/serial/psi_z_serial_impl.f90 +base/serial/psb_dgelp.f90 +base/serial/psb_zrwextd.f90 +base/serial/sort/psb_c_hsort_impl.f90 +base/serial/sort/psb_d_msort_impl.f90 +base/serial/sort/psi_acx_mod.f90 +base/serial/sort/psb_s_hsort_impl.f90 +base/serial/sort/psb_i_isort_impl.f90 +base/serial/sort/psb_z_qsort_impl.f90 +base/serial/sort/psi_lcx_mod.f90 +base/serial/sort/psb_s_isort_impl.f90 +base/serial/sort/psb_i_msort_impl.f90 +base/serial/sort/psi_alcx_mod.f90 +base/serial/sort/psb_c_qsort_impl.f90 +base/serial/sort/psb_c_msort_impl.f90 +base/serial/sort/psb_z_hsort_impl.f90 +base/serial/sort/psb_z_isort_impl.f90 +base/serial/sort/psb_d_qsort_impl.f90 +base/serial/sort/psb_s_qsort_impl.f90 +base/serial/sort/psb_d_hsort_impl.f90 +base/serial/sort/psb_c_isort_impl.f90 +base/serial/sort/psb_i_hsort_impl.f90 +base/serial/sort/psb_s_msort_impl.f90 +base/serial/sort/psb_z_msort_impl.f90 +base/serial/sort/psb_d_isort_impl.f90 +base/serial/sort/psb_i_qsort_impl.f90 +base/serial/psb_dgeprt.f90 +base/serial/psb_sgelp.f90 +base/serial/psb_zgeprt.f90 +base/serial/psb_casum_s.f90 +base/serial/psb_lsame.f90 +base/serial/psb_dasum_s.f90 +base/serial/impl/psb_z_coo_impl.f90 +base/serial/impl/psb_z_csr_impl.f90 +base/serial/impl/psb_d_csc_impl.f90 +base/serial/impl/psb_base_mat_impl.f90 +base/serial/impl/psb_d_coo_impl.f90 +base/serial/impl/psb_z_csc_impl.f90 +base/serial/impl/psb_d_csr_impl.f90 +base/serial/impl/psb_s_coo_impl.f90 +base/serial/impl/psb_c_csr_impl.f90 +base/serial/impl/psb_s_csr_impl.f90 +base/serial/impl/psb_s_csc_impl.f90 +base/serial/impl/psb_c_csc_impl.f90 +base/serial/impl/psb_c_coo_impl.f90 +base/serial/smmp.f90 +base/serial/psb_srwextd.f90 +base/serial/psb_camax_s.f90 +base/serial/psb_ssymbmm.f90 +base/serial/psb_cgeprt.f90 +base/serial/psb_zasum_s.f90 +base/serial/psi_d_serial_impl.f90 +base/serial/psb_znumbmm.f90 +base/serial/psb_cspspmm.f90 +base/serial/psb_sgeprt.f90 +base/serial/psb_samax_s.f90 +base/serial/psb_sasum_s.f90 +base/serial/psi_i_serial_impl.f90 +base/serial/psb_aspxpby.f90 +base/serial/psb_zamax_s.f90 +base/serial/psi_c_serial_impl.f90 +base/serial/psb_sspspmm.f90 +base/serial/psb_cnumbmm.f90 +base/serial/psi_s_serial_impl.f90 +base/serial/psb_dspspmm.f90 +base/serial/psb_zsymbmm.f90 +base/serial/psb_cgelp.f90 +base/serial/psb_dnumbmm.f90 +base/serial/psb_csymbmm.f90 +base/serial/psb_zgelp.f90 +base/serial/psb_dsymbmm.f90 +base/serial/psb_damax_s.f90 +base/serial/psb_snumbmm.f90 +base/serial/psb_drwextd.f90 +base/serial/psb_spge_dot.f90 +base/serial/psb_spdot_srtd.f90 +base/serial/psb_crwextd.f90 +base/internals/psb_indx_map_fnd_owner.F90 +base/internals/psi_desc_index.F90 +base/internals/psi_fnd_owner.F90 +base/internals/psi_extrct_dl.F90 +base/tools/psb_icdasb.F90 +base/tools/psb_dsphalo.F90 +base/tools/psb_zcdbldext.F90 +base/tools/psb_scdbldext.F90 +base/tools/psb_zsphalo.F90 +base/tools/psb_ccdbldext.F90 +base/tools/psb_cdcpy.F90 +base/tools/psb_ssphalo.F90 +base/tools/psb_csphalo.F90 +base/tools/psb_dcdbldext.F90 +base/modules/psb_penv_mod.F90 +base/modules/psi_comm_buffers_mod.F90 +base/modules/psi_p2p_mod.F90 +base/modules/desc/psb_desc_mod.F90 +base/modules/psi_penv_mod.F90 +base/modules/psb_error_impl.F90 +base/modules/psb_realloc_mod.F90 +base/modules/psb_error_mod.F90 +base/modules/psblas/psb_s_psblas_mod.F90 +base/modules/psblas/psb_d_psblas_mod.F90 +base/modules/psblas/psb_c_psblas_mod.F90 +base/modules/psblas/psb_z_psblas_mod.F90 +base/modules/psi_reduce_mod.F90 +base/modules/psb_const_mod.F90 +base/modules/serial/psb_i_vect_mod.F90 +base/modules/serial/psb_c_vect_mod.F90 +base/modules/serial/psb_d_vect_mod.F90 +base/modules/serial/psb_z_vect_mod.F90 +base/modules/serial/psb_s_vect_mod.F90 +base/modules/psi_bcast_mod.F90 +base/comm/psb_zspgather.F90 +base/comm/psb_dscatter.F90 +base/comm/psb_zscatter.F90 +base/comm/internals/psi_dswapdata.F90 +base/comm/internals/psi_sswaptran.F90 +base/comm/internals/psi_sswapdata.F90 +base/comm/internals/psi_cswaptran.F90 +base/comm/internals/psi_iswapdata.F90 +base/comm/internals/psi_zswaptran.F90 +base/comm/internals/psi_iswaptran.F90 +base/comm/internals/psi_dswaptran.F90 +base/comm/internals/psi_zswapdata.F90 +base/comm/internals/psi_cswapdata.F90 +base/comm/psb_cspgather.F90 +base/comm/psb_iscatter.F90 +base/comm/psb_sscatter.F90 +base/comm/psb_sspgather.F90 +base/comm/psb_cscatter.F90 +base/comm/psb_dspgather.F90 +base/serial/impl/psb_c_base_mat_impl.F90 +base/serial/impl/psb_s_mat_impl.F90 +base/serial/impl/psb_z_mat_impl.F90 +base/serial/impl/psb_d_base_mat_impl.F90 +base/serial/impl/psb_c_mat_impl.F90 +base/serial/impl/psb_s_base_mat_impl.F90 +base/serial/impl/psb_d_mat_impl.F90 +base/serial/impl/psb_z_base_mat_impl.F90 +base/modules/fakempi.c +base/modules/cutil.c +) From 3612330339b48db5f1d14a014e8be9b84f19a945 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Wed, 13 Dec 2017 11:57:59 -0800 Subject: [PATCH 06/48] Move add_library from main CMakeLists to base dir --- CMakeLists.txt | 362 +------------------------------------------- base/CMakeLists.txt | 361 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 362 insertions(+), 361 deletions(-) create mode 100644 base/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f4761af3..3cd311fb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -604,364 +604,4 @@ endif() #include(cmake/AddInstallationScriptTest.cmake ) #add_installation_script_test(installation-scripts.sh src/tests/installation/) -add_library(base -base/internals/psi_desc_impl.f90 -base/internals/psi_crea_bnd_elem.f90 -base/internals/psi_bld_tmphalo.f90 -base/internals/psi_list_search.f90 -base/internals/psi_crea_ovr_elem.f90 -base/internals/psi_compute_size.f90 -base/internals/psi_dl_check.f90 -base/internals/psi_exist_ovr_elem.f90 -base/internals/psi_srtlist.f90 -base/internals/psi_bld_tmpovrl.f90 -base/internals/psi_crea_index.f90 -base/internals/psi_sort_dl.f90 -base/tools/psb_iallc.f90 -base/tools/psb_c_map.f90 -base/tools/psb_dspalloc.f90 -base/tools/psb_cspasb.f90 -base/tools/psb_dins.f90 -base/tools/psb_iasb.f90 -base/tools/psb_sspfree.f90 -base/tools/psb_cd_lstext.f90 -base/tools/psb_dsprn.f90 -base/tools/psb_cins.f90 -base/tools/psb_csprn.f90 -base/tools/psb_ifree.f90 -base/tools/psb_sspasb.f90 -base/tools/psb_z_map.f90 -base/tools/psb_zspins.f90 -base/tools/psb_sins.f90 -base/tools/psb_cdins.f90 -base/tools/psb_cspfree.f90 -base/tools/psb_cdalv.f90 -base/tools/psb_zallc.f90 -base/tools/psb_cspins.f90 -base/tools/psb_dallc.f90 -base/tools/psb_cdrep.f90 -base/tools/psb_dspfree.f90 -base/tools/psb_zspfree.f90 -base/tools/psb_get_overlap.f90 -base/tools/psb_cdals.f90 -base/tools/psb_dfree.f90 -base/tools/psb_dasb.f90 -base/tools/psb_zfree.f90 -base/tools/psb_zins.f90 -base/tools/psb_cd_switch_ovl_indxmap.f90 -base/tools/psb_sasb.f90 -base/tools/psb_callc.f90 -base/tools/psb_cd_reinit.f90 -base/tools/psb_cd_set_bld.f90 -base/tools/psb_s_map.f90 -base/tools/psb_cdprt.f90 -base/tools/psb_glob_to_loc.f90 -base/tools/psb_zasb.f90 -base/tools/psb_zspalloc.f90 -base/tools/psb_cspalloc.f90 -base/tools/psb_iins.f90 -base/tools/psb_d_map.f90 -base/tools/psb_cdren.f90 -base/tools/psb_casb.f90 -base/tools/psb_zsprn.f90 -base/tools/psb_sspins.f90 -base/tools/psb_zspasb.f90 -base/tools/psb_loc_to_glob.f90 -base/tools/psb_dspasb.f90 -base/tools/psb_cdall.f90 -base/tools/psb_sallc.f90 -base/tools/psb_ssprn.f90 -base/tools/psb_dspins.f90 -base/tools/psb_sspalloc.f90 -base/tools/psb_cd_inloc.f90 -base/tools/psb_sfree.f90 -base/tools/psb_cfree.f90 -base/modules/psi_c_mod.f90 -base/modules/psi_mod.f90 -base/modules/aux/psb_string_mod.f90 -base/modules/aux/psb_sort_mod.f90 -base/modules/aux/psb_s_sort_mod.f90 -base/modules/aux/psi_d_serial_mod.f90 -base/modules/aux/psi_serial_mod.f90 -base/modules/aux/psb_i_sort_mod.f90 -base/modules/aux/psi_z_serial_mod.f90 -base/modules/aux/psi_i_serial_mod.f90 -base/modules/aux/psb_ip_reord_mod.f90 -base/modules/aux/psb_c_sort_mod.f90 -base/modules/aux/psb_hash_mod.f90 -base/modules/aux/psb_d_sort_mod.f90 -base/modules/aux/psi_s_serial_mod.f90 -base/modules/aux/psi_c_serial_mod.f90 -base/modules/aux/psb_z_sort_mod.f90 -base/modules/psb_base_mod.f90 -base/modules/psi_z_mod.f90 -base/modules/desc/psb_indx_map_mod.f90 -base/modules/desc/psb_repl_map_mod.f90 -base/modules/desc/psb_desc_const_mod.f90 -base/modules/desc/psb_gen_block_map_mod.f90 -base/modules/desc/psb_hash_map_mod.f90 -base/modules/desc/psb_glist_map_mod.f90 -base/modules/desc/psb_list_map_mod.f90 -base/modules/psi_d_mod.f90 -base/modules/tools/psb_i_tools_mod.f90 -base/modules/tools/psb_d_tools_mod.f90 -base/modules/tools/psb_s_tools_mod.f90 -base/modules/tools/psb_tools_mod.f90 -base/modules/tools/psb_cd_tools_mod.f90 -base/modules/tools/psb_z_tools_mod.f90 -base/modules/tools/psb_c_tools_mod.f90 -base/modules/psi_s_mod.f90 -base/modules/comm/psb_d_linmap_mod.f90 -base/modules/comm/psb_s_linmap_mod.f90 -base/modules/comm/psb_base_linmap_mod.f90 -base/modules/comm/psb_i_comm_mod.f90 -base/modules/comm/psb_c_linmap_mod.f90 -base/modules/comm/psb_c_comm_mod.f90 -base/modules/comm/psb_z_comm_mod.f90 -base/modules/comm/psb_z_linmap_mod.f90 -base/modules/comm/psb_s_comm_mod.f90 -base/modules/comm/psb_d_comm_mod.f90 -base/modules/comm/psb_comm_mod.f90 -base/modules/comm/psb_linmap_mod.f90 -base/modules/psblas/psb_psblas_mod.f90 -base/modules/psi_i_mod.f90 -base/modules/serial/psb_s_csr_mat_mod.f90 -base/modules/serial/psb_z_mat_mod.f90 -base/modules/serial/psb_s_base_mat_mod.f90 -base/modules/serial/psb_s_base_vect_mod.f90 -base/modules/serial/psb_z_csc_mat_mod.f90 -base/modules/serial/psb_d_csr_mat_mod.f90 -base/modules/serial/psb_s_csc_mat_mod.f90 -base/modules/serial/psb_i_base_vect_mod.f90 -base/modules/serial/psb_z_base_vect_mod.f90 -base/modules/serial/psb_c_csr_mat_mod.f90 -base/modules/serial/psb_c_serial_mod.f90 -base/modules/serial/psb_c_base_vect_mod.f90 -base/modules/serial/psb_s_serial_mod.f90 -base/modules/serial/psb_d_csc_mat_mod.f90 -base/modules/serial/psb_vect_mod.f90 -base/modules/serial/psb_base_mat_mod.f90 -base/modules/serial/psb_c_csc_mat_mod.f90 -base/modules/serial/psb_z_base_mat_mod.f90 -base/modules/serial/psb_z_csr_mat_mod.f90 -base/modules/serial/psb_c_mat_mod.f90 -base/modules/serial/psb_d_base_mat_mod.f90 -base/modules/serial/psb_d_serial_mod.f90 -base/modules/serial/psb_c_base_mat_mod.f90 -base/modules/serial/psb_d_base_vect_mod.f90 -base/modules/serial/psb_serial_mod.f90 -base/modules/serial/psb_s_mat_mod.f90 -base/modules/serial/psb_z_serial_mod.f90 -base/modules/serial/psb_d_mat_mod.f90 -base/modules/serial/psb_mat_mod.f90 -base/modules/error.f90 -base/modules/psb_check_mod.f90 -base/comm/psb_shalo.f90 -base/comm/psb_dhalo.f90 -base/comm/psb_igather.f90 -base/comm/internals/psi_iovrl_restr.f90 -base/comm/internals/psi_covrl_upd.f90 -base/comm/internals/psi_covrl_save.f90 -base/comm/internals/psi_sovrl_upd.f90 -base/comm/internals/psi_dovrl_restr.f90 -base/comm/internals/psi_zovrl_restr.f90 -base/comm/internals/psi_dovrl_save.f90 -base/comm/internals/psi_zovrl_save.f90 -base/comm/internals/psi_sovrl_restr.f90 -base/comm/internals/psi_zovrl_upd.f90 -base/comm/internals/psi_sovrl_save.f90 -base/comm/internals/psi_iovrl_upd.f90 -base/comm/internals/psi_covrl_restr.f90 -base/comm/internals/psi_iovrl_save.f90 -base/comm/internals/psi_dovrl_upd.f90 -base/comm/psb_iovrl.f90 -base/comm/psb_cgather.f90 -base/comm/psb_covrl.f90 -base/comm/psb_zovrl.f90 -base/comm/psb_ihalo.f90 -base/comm/psb_dgather.f90 -base/comm/psb_sovrl.f90 -base/comm/psb_dovrl.f90 -base/comm/psb_zgather.f90 -base/comm/psb_zhalo.f90 -base/comm/psb_sgather.f90 -base/comm/psb_chalo.f90 -base/psblas/psb_snrmi.f90 -base/psblas/psb_dspmm.f90 -base/psblas/psb_samax.f90 -base/psblas/psb_sxdot.f90 -base/psblas/psb_dspnrm1.f90 -base/psblas/psb_sspnrm1.f90 -base/psblas/psb_sspmm.f90 -base/psblas/psb_dnrmi.f90 -base/psblas/psb_zamax.f90 -base/psblas/psb_cspmm.f90 -base/psblas/psb_dspsm.f90 -base/psblas/psb_casum.f90 -base/psblas/psb_cnrmi.f90 -base/psblas/psb_znrm2.f90 -base/psblas/psb_zspsm.f90 -base/psblas/psb_camax.f90 -base/psblas/psb_dnrm2.f90 -base/psblas/psb_znrmi.f90 -base/psblas/psb_cspsm.f90 -base/psblas/psb_sdot.f90 -base/psblas/psb_dasum.f90 -base/psblas/psb_zasum.f90 -base/psblas/psb_damax.f90 -base/psblas/psb_zspmm.f90 -base/psblas/psb_cnrm2.f90 -base/psblas/psb_ddot.f90 -base/psblas/psb_caxpby.f90 -base/psblas/psb_cdot.f90 -base/psblas/psb_snrm2.f90 -base/psblas/psb_sspsm.f90 -base/psblas/psb_daxpby.f90 -base/psblas/psb_zdot.f90 -base/psblas/psb_zaxpby.f90 -base/psblas/psb_zspnrm1.f90 -base/psblas/psb_sasum.f90 -base/psblas/psb_saxpby.f90 -base/psblas/psb_cspnrm1.f90 -base/serial/psb_zspspmm.f90 -base/serial/psi_z_serial_impl.f90 -base/serial/psb_dgelp.f90 -base/serial/psb_zrwextd.f90 -base/serial/sort/psb_c_hsort_impl.f90 -base/serial/sort/psb_d_msort_impl.f90 -base/serial/sort/psi_acx_mod.f90 -base/serial/sort/psb_s_hsort_impl.f90 -base/serial/sort/psb_i_isort_impl.f90 -base/serial/sort/psb_z_qsort_impl.f90 -base/serial/sort/psi_lcx_mod.f90 -base/serial/sort/psb_s_isort_impl.f90 -base/serial/sort/psb_i_msort_impl.f90 -base/serial/sort/psi_alcx_mod.f90 -base/serial/sort/psb_c_qsort_impl.f90 -base/serial/sort/psb_c_msort_impl.f90 -base/serial/sort/psb_z_hsort_impl.f90 -base/serial/sort/psb_z_isort_impl.f90 -base/serial/sort/psb_d_qsort_impl.f90 -base/serial/sort/psb_s_qsort_impl.f90 -base/serial/sort/psb_d_hsort_impl.f90 -base/serial/sort/psb_c_isort_impl.f90 -base/serial/sort/psb_i_hsort_impl.f90 -base/serial/sort/psb_s_msort_impl.f90 -base/serial/sort/psb_z_msort_impl.f90 -base/serial/sort/psb_d_isort_impl.f90 -base/serial/sort/psb_i_qsort_impl.f90 -base/serial/psb_dgeprt.f90 -base/serial/psb_sgelp.f90 -base/serial/psb_zgeprt.f90 -base/serial/psb_casum_s.f90 -base/serial/psb_lsame.f90 -base/serial/psb_dasum_s.f90 -base/serial/impl/psb_z_coo_impl.f90 -base/serial/impl/psb_z_csr_impl.f90 -base/serial/impl/psb_d_csc_impl.f90 -base/serial/impl/psb_base_mat_impl.f90 -base/serial/impl/psb_d_coo_impl.f90 -base/serial/impl/psb_z_csc_impl.f90 -base/serial/impl/psb_d_csr_impl.f90 -base/serial/impl/psb_s_coo_impl.f90 -base/serial/impl/psb_c_csr_impl.f90 -base/serial/impl/psb_s_csr_impl.f90 -base/serial/impl/psb_s_csc_impl.f90 -base/serial/impl/psb_c_csc_impl.f90 -base/serial/impl/psb_c_coo_impl.f90 -base/serial/smmp.f90 -base/serial/psb_srwextd.f90 -base/serial/psb_camax_s.f90 -base/serial/psb_ssymbmm.f90 -base/serial/psb_cgeprt.f90 -base/serial/psb_zasum_s.f90 -base/serial/psi_d_serial_impl.f90 -base/serial/psb_znumbmm.f90 -base/serial/psb_cspspmm.f90 -base/serial/psb_sgeprt.f90 -base/serial/psb_samax_s.f90 -base/serial/psb_sasum_s.f90 -base/serial/psi_i_serial_impl.f90 -base/serial/psb_aspxpby.f90 -base/serial/psb_zamax_s.f90 -base/serial/psi_c_serial_impl.f90 -base/serial/psb_sspspmm.f90 -base/serial/psb_cnumbmm.f90 -base/serial/psi_s_serial_impl.f90 -base/serial/psb_dspspmm.f90 -base/serial/psb_zsymbmm.f90 -base/serial/psb_cgelp.f90 -base/serial/psb_dnumbmm.f90 -base/serial/psb_csymbmm.f90 -base/serial/psb_zgelp.f90 -base/serial/psb_dsymbmm.f90 -base/serial/psb_damax_s.f90 -base/serial/psb_snumbmm.f90 -base/serial/psb_drwextd.f90 -base/serial/psb_spge_dot.f90 -base/serial/psb_spdot_srtd.f90 -base/serial/psb_crwextd.f90 -base/internals/psb_indx_map_fnd_owner.F90 -base/internals/psi_desc_index.F90 -base/internals/psi_fnd_owner.F90 -base/internals/psi_extrct_dl.F90 -base/tools/psb_icdasb.F90 -base/tools/psb_dsphalo.F90 -base/tools/psb_zcdbldext.F90 -base/tools/psb_scdbldext.F90 -base/tools/psb_zsphalo.F90 -base/tools/psb_ccdbldext.F90 -base/tools/psb_cdcpy.F90 -base/tools/psb_ssphalo.F90 -base/tools/psb_csphalo.F90 -base/tools/psb_dcdbldext.F90 -base/modules/psb_penv_mod.F90 -base/modules/psi_comm_buffers_mod.F90 -base/modules/psi_p2p_mod.F90 -base/modules/desc/psb_desc_mod.F90 -base/modules/psi_penv_mod.F90 -base/modules/psb_error_impl.F90 -base/modules/psb_realloc_mod.F90 -base/modules/psb_error_mod.F90 -base/modules/psblas/psb_s_psblas_mod.F90 -base/modules/psblas/psb_d_psblas_mod.F90 -base/modules/psblas/psb_c_psblas_mod.F90 -base/modules/psblas/psb_z_psblas_mod.F90 -base/modules/psi_reduce_mod.F90 -base/modules/psb_const_mod.F90 -base/modules/serial/psb_i_vect_mod.F90 -base/modules/serial/psb_c_vect_mod.F90 -base/modules/serial/psb_d_vect_mod.F90 -base/modules/serial/psb_z_vect_mod.F90 -base/modules/serial/psb_s_vect_mod.F90 -base/modules/psi_bcast_mod.F90 -base/comm/psb_zspgather.F90 -base/comm/psb_dscatter.F90 -base/comm/psb_zscatter.F90 -base/comm/internals/psi_dswapdata.F90 -base/comm/internals/psi_sswaptran.F90 -base/comm/internals/psi_sswapdata.F90 -base/comm/internals/psi_cswaptran.F90 -base/comm/internals/psi_iswapdata.F90 -base/comm/internals/psi_zswaptran.F90 -base/comm/internals/psi_iswaptran.F90 -base/comm/internals/psi_dswaptran.F90 -base/comm/internals/psi_zswapdata.F90 -base/comm/internals/psi_cswapdata.F90 -base/comm/psb_cspgather.F90 -base/comm/psb_iscatter.F90 -base/comm/psb_sscatter.F90 -base/comm/psb_sspgather.F90 -base/comm/psb_cscatter.F90 -base/comm/psb_dspgather.F90 -base/serial/impl/psb_c_base_mat_impl.F90 -base/serial/impl/psb_s_mat_impl.F90 -base/serial/impl/psb_z_mat_impl.F90 -base/serial/impl/psb_d_base_mat_impl.F90 -base/serial/impl/psb_c_mat_impl.F90 -base/serial/impl/psb_s_base_mat_impl.F90 -base/serial/impl/psb_d_mat_impl.F90 -base/serial/impl/psb_z_base_mat_impl.F90 -base/modules/fakempi.c -base/modules/cutil.c -) +add_subdirectory(base) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt new file mode 100644 index 000000000..1b1ac486a --- /dev/null +++ b/base/CMakeLists.txt @@ -0,0 +1,361 @@ +add_library(base +internals/psi_desc_impl.f90 +internals/psi_crea_bnd_elem.f90 +internals/psi_bld_tmphalo.f90 +internals/psi_list_search.f90 +internals/psi_crea_ovr_elem.f90 +internals/psi_compute_size.f90 +internals/psi_dl_check.f90 +internals/psi_exist_ovr_elem.f90 +internals/psi_srtlist.f90 +internals/psi_bld_tmpovrl.f90 +internals/psi_crea_index.f90 +internals/psi_sort_dl.f90 +tools/psb_iallc.f90 +tools/psb_c_map.f90 +tools/psb_dspalloc.f90 +tools/psb_cspasb.f90 +tools/psb_dins.f90 +tools/psb_iasb.f90 +tools/psb_sspfree.f90 +tools/psb_cd_lstext.f90 +tools/psb_dsprn.f90 +tools/psb_cins.f90 +tools/psb_csprn.f90 +tools/psb_ifree.f90 +tools/psb_sspasb.f90 +tools/psb_z_map.f90 +tools/psb_zspins.f90 +tools/psb_sins.f90 +tools/psb_cdins.f90 +tools/psb_cspfree.f90 +tools/psb_cdalv.f90 +tools/psb_zallc.f90 +tools/psb_cspins.f90 +tools/psb_dallc.f90 +tools/psb_cdrep.f90 +tools/psb_dspfree.f90 +tools/psb_zspfree.f90 +tools/psb_get_overlap.f90 +tools/psb_cdals.f90 +tools/psb_dfree.f90 +tools/psb_dasb.f90 +tools/psb_zfree.f90 +tools/psb_zins.f90 +tools/psb_cd_switch_ovl_indxmap.f90 +tools/psb_sasb.f90 +./internals/psi_desc_impl.f90 +./internals/psi_crea_bnd_elem.f90 +./internals/psi_bld_tmphalo.f90 +./internals/psi_list_search.f90 +./internals/psi_crea_ovr_elem.f90 +./internals/psi_compute_size.f90 +./internals/psi_dl_check.f90 +./internals/psi_exist_ovr_elem.f90 +./internals/psi_srtlist.f90 +./internals/psi_bld_tmpovrl.f90 +./internals/psi_crea_index.f90 +./internals/psi_sort_dl.f90 +./tools/psb_iallc.f90 +./tools/psb_c_map.f90 +./tools/psb_dspalloc.f90 +./tools/psb_cspasb.f90 +./tools/psb_dins.f90 +./tools/psb_iasb.f90 +./tools/psb_sspfree.f90 +./tools/psb_cd_lstext.f90 +./tools/psb_dsprn.f90 +./tools/psb_cins.f90 +./tools/psb_csprn.f90 +./tools/psb_ifree.f90 +./tools/psb_sspasb.f90 +./tools/psb_z_map.f90 +./tools/psb_zspins.f90 +./tools/psb_sins.f90 +./tools/psb_cdins.f90 +./tools/psb_cspfree.f90 +./tools/psb_cdalv.f90 +./tools/psb_zallc.f90 +./tools/psb_cspins.f90 +./tools/psb_dallc.f90 +./tools/psb_cdrep.f90 +./tools/psb_dspfree.f90 +./tools/psb_zspfree.f90 +./tools/psb_get_overlap.f90 +./tools/psb_cdals.f90 +./tools/psb_dfree.f90 +./tools/psb_dasb.f90 +./tools/psb_zfree.f90 +./tools/psb_zins.f90 +./tools/psb_cd_switch_ovl_indxmap.f90 +./tools/psb_sasb.f90 +./tools/psb_callc.f90 +./tools/psb_cd_reinit.f90 +./tools/psb_cd_set_bld.f90 +./tools/psb_s_map.f90 +./tools/psb_cdprt.f90 +./tools/psb_glob_to_loc.f90 +./tools/psb_zasb.f90 +./tools/psb_zspalloc.f90 +./tools/psb_cspalloc.f90 +./tools/psb_iins.f90 +./tools/psb_d_map.f90 +./tools/psb_cdren.f90 +./tools/psb_casb.f90 +./tools/psb_zsprn.f90 +./tools/psb_sspins.f90 +./tools/psb_zspasb.f90 +./tools/psb_loc_to_glob.f90 +./tools/psb_dspasb.f90 +./tools/psb_cdall.f90 +./tools/psb_sallc.f90 +./tools/psb_ssprn.f90 +./tools/psb_dspins.f90 +./tools/psb_sspalloc.f90 +./tools/psb_cd_inloc.f90 +./tools/psb_sfree.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/psb_base_mod.f90 +./modules/psi_z_mod.f90 +./modules/desc/psb_indx_map_mod.f90 +./modules/desc/psb_repl_map_mod.f90 +./modules/desc/psb_desc_const_mod.f90 +./modules/desc/psb_gen_block_map_mod.f90 +./modules/desc/psb_hash_map_mod.f90 +./modules/desc/psb_glist_map_mod.f90 +./modules/desc/psb_list_map_mod.f90 +./modules/psi_d_mod.f90 +./modules/tools/psb_i_tools_mod.f90 +./modules/tools/psb_d_tools_mod.f90 +./modules/tools/psb_s_tools_mod.f90 +./modules/tools/psb_tools_mod.f90 +./modules/tools/psb_cd_tools_mod.f90 +./modules/tools/psb_z_tools_mod.f90 +./modules/tools/psb_c_tools_mod.f90 +./modules/psi_s_mod.f90 +./modules/comm/psb_d_linmap_mod.f90 +./modules/comm/psb_s_linmap_mod.f90 +./modules/comm/psb_base_linmap_mod.f90 +./modules/comm/psb_i_comm_mod.f90 +./modules/comm/psb_c_linmap_mod.f90 +./modules/comm/psb_c_comm_mod.f90 +./modules/comm/psb_z_comm_mod.f90 +./modules/comm/psb_z_linmap_mod.f90 +./modules/comm/psb_s_comm_mod.f90 +./modules/comm/psb_d_comm_mod.f90 +./modules/comm/psb_comm_mod.f90 +./modules/comm/psb_linmap_mod.f90 +./modules/psblas/psb_psblas_mod.f90 +./modules/psi_i_mod.f90 +./modules/serial/psb_s_csr_mat_mod.f90 +./modules/serial/psb_z_mat_mod.f90 +./modules/serial/psb_s_base_mat_mod.f90 +./modules/serial/psb_s_base_vect_mod.f90 +./modules/serial/psb_z_csc_mat_mod.f90 +./modules/serial/psb_d_csr_mat_mod.f90 +./modules/serial/psb_s_csc_mat_mod.f90 +./modules/serial/psb_i_base_vect_mod.f90 +./modules/serial/psb_z_base_vect_mod.f90 +./modules/serial/psb_c_csr_mat_mod.f90 +./modules/serial/psb_c_serial_mod.f90 +./modules/serial/psb_c_base_vect_mod.f90 +./modules/serial/psb_s_serial_mod.f90 +./modules/serial/psb_d_csc_mat_mod.f90 +./modules/serial/psb_vect_mod.f90 +./modules/serial/psb_base_mat_mod.f90 +./modules/serial/psb_c_csc_mat_mod.f90 +./modules/serial/psb_z_base_mat_mod.f90 +./modules/serial/psb_z_csr_mat_mod.f90 +./modules/serial/psb_c_mat_mod.f90 +./modules/serial/psb_d_base_mat_mod.f90 +./modules/serial/psb_d_serial_mod.f90 +./modules/serial/psb_c_base_mat_mod.f90 +./modules/serial/psb_d_base_vect_mod.f90 +./modules/serial/psb_serial_mod.f90 +./modules/serial/psb_s_mat_mod.f90 +./modules/serial/psb_z_serial_mod.f90 +./modules/serial/psb_d_mat_mod.f90 +./modules/serial/psb_mat_mod.f90 +./modules/error.f90 +./modules/psb_check_mod.f90 +./comm/psb_shalo.f90 +./comm/psb_dhalo.f90 +./comm/psb_igather.f90 +./comm/internals/psi_iovrl_restr.f90 +./comm/internals/psi_covrl_upd.f90 +./comm/internals/psi_covrl_save.f90 +./comm/internals/psi_sovrl_upd.f90 +./comm/internals/psi_dovrl_restr.f90 +./comm/internals/psi_zovrl_restr.f90 +./comm/internals/psi_dovrl_save.f90 +./comm/internals/psi_zovrl_save.f90 +./comm/internals/psi_sovrl_restr.f90 +./comm/internals/psi_zovrl_upd.f90 +./comm/internals/psi_sovrl_save.f90 +./comm/internals/psi_iovrl_upd.f90 +./comm/internals/psi_covrl_restr.f90 +./comm/internals/psi_iovrl_save.f90 +./comm/internals/psi_dovrl_upd.f90 +./comm/psb_iovrl.f90 +./comm/psb_cgather.f90 +./comm/psb_covrl.f90 +./comm/psb_zovrl.f90 +./comm/psb_ihalo.f90 +./comm/psb_dgather.f90 +./comm/psb_sovrl.f90 +./comm/psb_dovrl.f90 +./comm/psb_zgather.f90 +./comm/psb_zhalo.f90 +./comm/psb_sgather.f90 +./comm/psb_chalo.f90 +./psblas/psb_snrmi.f90 +./psblas/psb_dspmm.f90 +./psblas/psb_samax.f90 +./psblas/psb_sxdot.f90 +./psblas/psb_dspnrm1.f90 +./psblas/psb_sspnrm1.f90 +./psblas/psb_sspmm.f90 +./psblas/psb_dnrmi.f90 +./psblas/psb_zamax.f90 +./psblas/psb_cspmm.f90 +./psblas/psb_dspsm.f90 +./psblas/psb_casum.f90 +./psblas/psb_cnrmi.f90 +./psblas/psb_znrm2.f90 +./psblas/psb_zspsm.f90 +./psblas/psb_camax.f90 +./psblas/psb_dnrm2.f90 +./psblas/psb_znrmi.f90 +./psblas/psb_cspsm.f90 +./psblas/psb_sdot.f90 +./psblas/psb_dasum.f90 +./psblas/psb_zasum.f90 +./psblas/psb_damax.f90 +./psblas/psb_zspmm.f90 +./psblas/psb_cnrm2.f90 +./psblas/psb_ddot.f90 +./psblas/psb_caxpby.f90 +./psblas/psb_cdot.f90 +./psblas/psb_snrm2.f90 +./psblas/psb_sspsm.f90 +./psblas/psb_daxpby.f90 +./psblas/psb_zdot.f90 +./psblas/psb_zaxpby.f90 +./psblas/psb_zspnrm1.f90 +./psblas/psb_sasum.f90 +./psblas/psb_saxpby.f90 +./psblas/psb_cspnrm1.f90 +serial/impl/psb_c_coo_impl.f90 +serial/smmp.f90 +serial/psb_srwextd.f90 +serial/psb_camax_s.f90 +serial/psb_ssymbmm.f90 +serial/psb_cgeprt.f90 +serial/psb_zasum_s.f90 +serial/psi_d_serial_impl.f90 +serial/psb_znumbmm.f90 +serial/psb_cspspmm.f90 +serial/psb_sgeprt.f90 +serial/psb_samax_s.f90 +serial/psb_sasum_s.f90 +serial/psi_i_serial_impl.f90 +serial/psb_aspxpby.f90 +serial/psb_zamax_s.f90 +serial/psi_c_serial_impl.f90 +serial/psb_sspspmm.f90 +serial/psb_cnumbmm.f90 +serial/psi_s_serial_impl.f90 +serial/psb_dspspmm.f90 +serial/psb_zsymbmm.f90 +serial/psb_cgelp.f90 +serial/psb_dnumbmm.f90 +serial/psb_csymbmm.f90 +serial/psb_zgelp.f90 +serial/psb_dsymbmm.f90 +serial/psb_damax_s.f90 +serial/psb_snumbmm.f90 +serial/psb_drwextd.f90 +serial/psb_spge_dot.f90 +serial/psb_spdot_srtd.f90 +serial/psb_crwextd.f90 +internals/psb_indx_map_fnd_owner.F90 +internals/psi_desc_index.F90 +internals/psi_fnd_owner.F90 +internals/psi_extrct_dl.F90 +tools/psb_icdasb.F90 +tools/psb_dsphalo.F90 +tools/psb_zcdbldext.F90 +tools/psb_scdbldext.F90 +tools/psb_zsphalo.F90 +tools/psb_ccdbldext.F90 +tools/psb_cdcpy.F90 +tools/psb_ssphalo.F90 +tools/psb_csphalo.F90 +tools/psb_dcdbldext.F90 +modules/psb_penv_mod.F90 +modules/psi_comm_buffers_mod.F90 +modules/psi_p2p_mod.F90 +modules/desc/psb_desc_mod.F90 +modules/psi_penv_mod.F90 +modules/psb_error_impl.F90 +modules/psb_realloc_mod.F90 +modules/psb_error_mod.F90 +modules/psblas/psb_s_psblas_mod.F90 +modules/psblas/psb_d_psblas_mod.F90 +modules/psblas/psb_c_psblas_mod.F90 +modules/psblas/psb_z_psblas_mod.F90 +modules/psi_reduce_mod.F90 +modules/psb_const_mod.F90 +modules/serial/psb_i_vect_mod.F90 +modules/serial/psb_c_vect_mod.F90 +modules/serial/psb_d_vect_mod.F90 +modules/serial/psb_z_vect_mod.F90 +modules/serial/psb_s_vect_mod.F90 +modules/psi_bcast_mod.F90 +comm/psb_zspgather.F90 +comm/psb_dscatter.F90 +comm/psb_zscatter.F90 +comm/internals/psi_dswapdata.F90 +comm/internals/psi_sswaptran.F90 +comm/internals/psi_sswapdata.F90 +comm/internals/psi_cswaptran.F90 +comm/internals/psi_iswapdata.F90 +comm/internals/psi_zswaptran.F90 +comm/internals/psi_iswaptran.F90 +comm/internals/psi_dswaptran.F90 +comm/internals/psi_zswapdata.F90 +comm/internals/psi_cswapdata.F90 +comm/psb_cspgather.F90 +comm/psb_iscatter.F90 +comm/psb_sscatter.F90 +comm/psb_sspgather.F90 +comm/psb_cscatter.F90 +comm/psb_dspgather.F90 +serial/impl/psb_c_base_mat_impl.F90 +serial/impl/psb_s_mat_impl.F90 +serial/impl/psb_z_mat_impl.F90 +serial/impl/psb_d_base_mat_impl.F90 +serial/impl/psb_c_mat_impl.F90 +serial/impl/psb_s_base_mat_impl.F90 +serial/impl/psb_d_mat_impl.F90 +serial/impl/psb_z_base_mat_impl.F90 +modules/fakempi.c +modules/cutil.c +) From 9f06a734e85c91b36a92f74281fe5661fc60a1d1 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Wed, 13 Dec 2017 19:15:15 -0800 Subject: [PATCH 07/48] cmake base build fails @34% on finidng psb_sxdotvs --- CMakeLists.txt | 10 +- base/CMakeLists.txt | 478 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 486 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cd311fb5..d1f9aaf26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -506,7 +506,7 @@ define_property(TARGET #----------------------------------------------------- # Publicize installed location to other CMake projects #----------------------------------------------------- -install(EXPORT PSBLASTargets +install(EXPORT PSBLAS_Targets NAMESPACE PSBLAS:: DESTINATION @@ -604,4 +604,12 @@ endif() #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 -DSERIAL_MPI +) +# From ./configure CDEFINES section +add_definitions( + -DHAVE_METIS_ -DLowerUnderscore -DPtr64Bits +) + add_subdirectory(base) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 1b1ac486a..1e3251b9b 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -1,4 +1,91 @@ -add_library(base +if (NOT MPI_C_FOUND) + find_package(MPI REQUIRED) + + set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) + set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) + set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) + set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) + include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) +endif() + +if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") + set(gfortran_compiler true) +endif() + +include(CheckIncludeFile) +CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) +if(NOT HAVE_ALLOCA) + add_definitions(-DALLOCA_MISSING) + message(WARNING "Could not find . Assuming functionality is provided elsewhere.") +endif() + +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") +if(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +else() + set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +endif() +set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") +if(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) +else() + set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) +endif() + +set(MPI_HEADERS mpi.h) +include(CheckIncludeFiles) +CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) +if(HAVE_MPI_EXT) + add_definitions(-DHAVE_MPI_EXT_H) + set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) +endif() + +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) +set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) +set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) + +#--------------------------------------------------- +# Windows Intel MPI compatibility, see GH issue #435 +#--------------------------------------------------- +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) + +include(CheckSymbolExists) +CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) +if(HAVE_Intel_MPI AND WIN32) + add_definitions(-DUSE_GCC) +endif() +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) + +set(PSBLAS_SO_VERSION 0) +if(gfortran_compiler) + if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) + set(PSBLAS_SO_VERSION 2) + elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) + set(PSBLAS_SO_VERSION 1) + endif() +endif() + +set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") +set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") +set(MPI_LIBS "") +foreach( lib IN LISTS MPI_Fortran_LIBRARIES) + set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +endforeach() +string(STRIP "${MPI_LIBS}" MPI_LIBS) + +add_library(base SHARED internals/psi_desc_impl.f90 internals/psi_crea_bnd_elem.f90 internals/psi_bld_tmphalo.f90 @@ -359,3 +446,392 @@ serial/impl/psb_z_base_mat_impl.F90 modules/fakempi.c modules/cutil.c ) + +add_library(base_static STATIC +internals/psi_desc_impl.f90 +internals/psi_crea_bnd_elem.f90 +internals/psi_bld_tmphalo.f90 +internals/psi_list_search.f90 +internals/psi_crea_ovr_elem.f90 +internals/psi_compute_size.f90 +internals/psi_dl_check.f90 +internals/psi_exist_ovr_elem.f90 +internals/psi_srtlist.f90 +internals/psi_bld_tmpovrl.f90 +internals/psi_crea_index.f90 +internals/psi_sort_dl.f90 +tools/psb_iallc.f90 +tools/psb_c_map.f90 +tools/psb_dspalloc.f90 +tools/psb_cspasb.f90 +tools/psb_dins.f90 +tools/psb_iasb.f90 +tools/psb_sspfree.f90 +tools/psb_cd_lstext.f90 +tools/psb_dsprn.f90 +tools/psb_cins.f90 +tools/psb_csprn.f90 +tools/psb_ifree.f90 +tools/psb_sspasb.f90 +tools/psb_z_map.f90 +tools/psb_zspins.f90 +tools/psb_sins.f90 +tools/psb_cdins.f90 +tools/psb_cspfree.f90 +tools/psb_cdalv.f90 +tools/psb_zallc.f90 +tools/psb_cspins.f90 +tools/psb_dallc.f90 +tools/psb_cdrep.f90 +tools/psb_dspfree.f90 +tools/psb_zspfree.f90 +tools/psb_get_overlap.f90 +tools/psb_cdals.f90 +tools/psb_dfree.f90 +tools/psb_dasb.f90 +tools/psb_zfree.f90 +tools/psb_zins.f90 +tools/psb_cd_switch_ovl_indxmap.f90 +tools/psb_sasb.f90 +./internals/psi_desc_impl.f90 +./internals/psi_crea_bnd_elem.f90 +./internals/psi_bld_tmphalo.f90 +./internals/psi_list_search.f90 +./internals/psi_crea_ovr_elem.f90 +./internals/psi_compute_size.f90 +./internals/psi_dl_check.f90 +./internals/psi_exist_ovr_elem.f90 +./internals/psi_srtlist.f90 +./internals/psi_bld_tmpovrl.f90 +./internals/psi_crea_index.f90 +./internals/psi_sort_dl.f90 +./tools/psb_iallc.f90 +./tools/psb_c_map.f90 +./tools/psb_dspalloc.f90 +./tools/psb_cspasb.f90 +./tools/psb_dins.f90 +./tools/psb_iasb.f90 +./tools/psb_sspfree.f90 +./tools/psb_cd_lstext.f90 +./tools/psb_dsprn.f90 +./tools/psb_cins.f90 +./tools/psb_csprn.f90 +./tools/psb_ifree.f90 +./tools/psb_sspasb.f90 +./tools/psb_z_map.f90 +./tools/psb_zspins.f90 +./tools/psb_sins.f90 +./tools/psb_cdins.f90 +./tools/psb_cspfree.f90 +./tools/psb_cdalv.f90 +./tools/psb_zallc.f90 +./tools/psb_cspins.f90 +./tools/psb_dallc.f90 +./tools/psb_cdrep.f90 +./tools/psb_dspfree.f90 +./tools/psb_zspfree.f90 +./tools/psb_get_overlap.f90 +./tools/psb_cdals.f90 +./tools/psb_dfree.f90 +./tools/psb_dasb.f90 +./tools/psb_zfree.f90 +./tools/psb_zins.f90 +./tools/psb_cd_switch_ovl_indxmap.f90 +./tools/psb_sasb.f90 +./tools/psb_callc.f90 +./tools/psb_cd_reinit.f90 +./tools/psb_cd_set_bld.f90 +./tools/psb_s_map.f90 +./tools/psb_cdprt.f90 +./tools/psb_glob_to_loc.f90 +./tools/psb_zasb.f90 +./tools/psb_zspalloc.f90 +./tools/psb_cspalloc.f90 +./tools/psb_iins.f90 +./tools/psb_d_map.f90 +./tools/psb_cdren.f90 +./tools/psb_casb.f90 +./tools/psb_zsprn.f90 +./tools/psb_sspins.f90 +./tools/psb_zspasb.f90 +./tools/psb_loc_to_glob.f90 +./tools/psb_dspasb.f90 +./tools/psb_cdall.f90 +./tools/psb_sallc.f90 +./tools/psb_ssprn.f90 +./tools/psb_dspins.f90 +./tools/psb_sspalloc.f90 +./tools/psb_cd_inloc.f90 +./tools/psb_sfree.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/psb_base_mod.f90 +./modules/psi_z_mod.f90 +./modules/desc/psb_indx_map_mod.f90 +./modules/desc/psb_repl_map_mod.f90 +./modules/desc/psb_desc_const_mod.f90 +./modules/desc/psb_gen_block_map_mod.f90 +./modules/desc/psb_hash_map_mod.f90 +./modules/desc/psb_glist_map_mod.f90 +./modules/desc/psb_list_map_mod.f90 +./modules/psi_d_mod.f90 +./modules/tools/psb_i_tools_mod.f90 +./modules/tools/psb_d_tools_mod.f90 +./modules/tools/psb_s_tools_mod.f90 +./modules/tools/psb_tools_mod.f90 +./modules/tools/psb_cd_tools_mod.f90 +./modules/tools/psb_z_tools_mod.f90 +./modules/tools/psb_c_tools_mod.f90 +./modules/psi_s_mod.f90 +./modules/comm/psb_d_linmap_mod.f90 +./modules/comm/psb_s_linmap_mod.f90 +./modules/comm/psb_base_linmap_mod.f90 +./modules/comm/psb_i_comm_mod.f90 +./modules/comm/psb_c_linmap_mod.f90 +./modules/comm/psb_c_comm_mod.f90 +./modules/comm/psb_z_comm_mod.f90 +./modules/comm/psb_z_linmap_mod.f90 +./modules/comm/psb_s_comm_mod.f90 +./modules/comm/psb_d_comm_mod.f90 +./modules/comm/psb_comm_mod.f90 +./modules/comm/psb_linmap_mod.f90 +./modules/psblas/psb_psblas_mod.f90 +./modules/psi_i_mod.f90 +./modules/serial/psb_s_csr_mat_mod.f90 +./modules/serial/psb_z_mat_mod.f90 +./modules/serial/psb_s_base_mat_mod.f90 +./modules/serial/psb_s_base_vect_mod.f90 +./modules/serial/psb_z_csc_mat_mod.f90 +./modules/serial/psb_d_csr_mat_mod.f90 +./modules/serial/psb_s_csc_mat_mod.f90 +./modules/serial/psb_i_base_vect_mod.f90 +./modules/serial/psb_z_base_vect_mod.f90 +./modules/serial/psb_c_csr_mat_mod.f90 +./modules/serial/psb_c_serial_mod.f90 +./modules/serial/psb_c_base_vect_mod.f90 +./modules/serial/psb_s_serial_mod.f90 +./modules/serial/psb_d_csc_mat_mod.f90 +./modules/serial/psb_vect_mod.f90 +./modules/serial/psb_base_mat_mod.f90 +./modules/serial/psb_c_csc_mat_mod.f90 +./modules/serial/psb_z_base_mat_mod.f90 +./modules/serial/psb_z_csr_mat_mod.f90 +./modules/serial/psb_c_mat_mod.f90 +./modules/serial/psb_d_base_mat_mod.f90 +./modules/serial/psb_d_serial_mod.f90 +./modules/serial/psb_c_base_mat_mod.f90 +./modules/serial/psb_d_base_vect_mod.f90 +./modules/serial/psb_serial_mod.f90 +./modules/serial/psb_s_mat_mod.f90 +./modules/serial/psb_z_serial_mod.f90 +./modules/serial/psb_d_mat_mod.f90 +./modules/serial/psb_mat_mod.f90 +./modules/error.f90 +./modules/psb_check_mod.f90 +./comm/psb_shalo.f90 +./comm/psb_dhalo.f90 +./comm/psb_igather.f90 +./comm/internals/psi_iovrl_restr.f90 +./comm/internals/psi_covrl_upd.f90 +./comm/internals/psi_covrl_save.f90 +./comm/internals/psi_sovrl_upd.f90 +./comm/internals/psi_dovrl_restr.f90 +./comm/internals/psi_zovrl_restr.f90 +./comm/internals/psi_dovrl_save.f90 +./comm/internals/psi_zovrl_save.f90 +./comm/internals/psi_sovrl_restr.f90 +./comm/internals/psi_zovrl_upd.f90 +./comm/internals/psi_sovrl_save.f90 +./comm/internals/psi_iovrl_upd.f90 +./comm/internals/psi_covrl_restr.f90 +./comm/internals/psi_iovrl_save.f90 +./comm/internals/psi_dovrl_upd.f90 +./comm/psb_iovrl.f90 +./comm/psb_cgather.f90 +./comm/psb_covrl.f90 +./comm/psb_zovrl.f90 +./comm/psb_ihalo.f90 +./comm/psb_dgather.f90 +./comm/psb_sovrl.f90 +./comm/psb_dovrl.f90 +./comm/psb_zgather.f90 +./comm/psb_zhalo.f90 +./comm/psb_sgather.f90 +./comm/psb_chalo.f90 +./psblas/psb_snrmi.f90 +./psblas/psb_dspmm.f90 +./psblas/psb_samax.f90 +./psblas/psb_sxdot.f90 +./psblas/psb_dspnrm1.f90 +./psblas/psb_sspnrm1.f90 +./psblas/psb_sspmm.f90 +./psblas/psb_dnrmi.f90 +./psblas/psb_zamax.f90 +./psblas/psb_cspmm.f90 +./psblas/psb_dspsm.f90 +./psblas/psb_casum.f90 +./psblas/psb_cnrmi.f90 +./psblas/psb_znrm2.f90 +./psblas/psb_zspsm.f90 +./psblas/psb_camax.f90 +./psblas/psb_dnrm2.f90 +./psblas/psb_znrmi.f90 +./psblas/psb_cspsm.f90 +./psblas/psb_sdot.f90 +./psblas/psb_dasum.f90 +./psblas/psb_zasum.f90 +./psblas/psb_damax.f90 +./psblas/psb_zspmm.f90 +./psblas/psb_cnrm2.f90 +./psblas/psb_ddot.f90 +./psblas/psb_caxpby.f90 +./psblas/psb_cdot.f90 +./psblas/psb_snrm2.f90 +./psblas/psb_sspsm.f90 +./psblas/psb_daxpby.f90 +./psblas/psb_zdot.f90 +./psblas/psb_zaxpby.f90 +./psblas/psb_zspnrm1.f90 +./psblas/psb_sasum.f90 +./psblas/psb_saxpby.f90 +./psblas/psb_cspnrm1.f90 +serial/impl/psb_c_coo_impl.f90 +serial/smmp.f90 +serial/psb_srwextd.f90 +serial/psb_camax_s.f90 +serial/psb_ssymbmm.f90 +serial/psb_cgeprt.f90 +serial/psb_zasum_s.f90 +serial/psi_d_serial_impl.f90 +serial/psb_znumbmm.f90 +serial/psb_cspspmm.f90 +serial/psb_sgeprt.f90 +serial/psb_samax_s.f90 +serial/psb_sasum_s.f90 +serial/psi_i_serial_impl.f90 +serial/psb_aspxpby.f90 +serial/psb_zamax_s.f90 +serial/psi_c_serial_impl.f90 +serial/psb_sspspmm.f90 +serial/psb_cnumbmm.f90 +serial/psi_s_serial_impl.f90 +serial/psb_dspspmm.f90 +serial/psb_zsymbmm.f90 +serial/psb_cgelp.f90 +serial/psb_dnumbmm.f90 +serial/psb_csymbmm.f90 +serial/psb_zgelp.f90 +serial/psb_dsymbmm.f90 +serial/psb_damax_s.f90 +serial/psb_snumbmm.f90 +serial/psb_drwextd.f90 +serial/psb_spge_dot.f90 +serial/psb_spdot_srtd.f90 +serial/psb_crwextd.f90 +internals/psb_indx_map_fnd_owner.F90 +internals/psi_desc_index.F90 +internals/psi_fnd_owner.F90 +internals/psi_extrct_dl.F90 +tools/psb_icdasb.F90 +tools/psb_dsphalo.F90 +tools/psb_zcdbldext.F90 +tools/psb_scdbldext.F90 +tools/psb_zsphalo.F90 +tools/psb_ccdbldext.F90 +tools/psb_cdcpy.F90 +tools/psb_ssphalo.F90 +tools/psb_csphalo.F90 +tools/psb_dcdbldext.F90 +modules/psb_penv_mod.F90 +modules/psi_comm_buffers_mod.F90 +modules/psi_p2p_mod.F90 +modules/desc/psb_desc_mod.F90 +modules/psi_penv_mod.F90 +modules/psb_error_impl.F90 +modules/psb_realloc_mod.F90 +modules/psb_error_mod.F90 +modules/psblas/psb_s_psblas_mod.F90 +modules/psblas/psb_d_psblas_mod.F90 +modules/psblas/psb_c_psblas_mod.F90 +modules/psblas/psb_z_psblas_mod.F90 +modules/psi_reduce_mod.F90 +modules/psb_const_mod.F90 +modules/serial/psb_i_vect_mod.F90 +modules/serial/psb_c_vect_mod.F90 +modules/serial/psb_d_vect_mod.F90 +modules/serial/psb_z_vect_mod.F90 +modules/serial/psb_s_vect_mod.F90 +modules/psi_bcast_mod.F90 +comm/psb_zspgather.F90 +comm/psb_dscatter.F90 +comm/psb_zscatter.F90 +comm/internals/psi_dswapdata.F90 +comm/internals/psi_sswaptran.F90 +comm/internals/psi_sswapdata.F90 +comm/internals/psi_cswaptran.F90 +comm/internals/psi_iswapdata.F90 +comm/internals/psi_zswaptran.F90 +comm/internals/psi_iswaptran.F90 +comm/internals/psi_dswaptran.F90 +comm/internals/psi_zswapdata.F90 +comm/internals/psi_cswapdata.F90 +comm/psb_cspgather.F90 +comm/psb_iscatter.F90 +comm/psb_sscatter.F90 +comm/psb_sspgather.F90 +comm/psb_cscatter.F90 +comm/psb_dspgather.F90 +serial/impl/psb_c_base_mat_impl.F90 +serial/impl/psb_s_mat_impl.F90 +serial/impl/psb_z_mat_impl.F90 +serial/impl/psb_d_base_mat_impl.F90 +serial/impl/psb_c_mat_impl.F90 +serial/impl/psb_s_base_mat_impl.F90 +serial/impl/psb_d_mat_impl.F90 +serial/impl/psb_z_base_mat_impl.F90 +modules/fakempi.c +modules/cutil.c +) +target_link_libraries(base PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) +target_link_libraries(base_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) + +install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILES_MATCHING PATTERN "*.mod") + +set_target_properties( base_static + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties ( base + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties(base_static PROPERTIES OUTPUT_NAME base) +get_target_property(libbase_static base_static OUTPUT_NAME) +set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libbase_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") + +install(TARGETS base EXPORT PSBLAS_Targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) + +install(TARGETS base_static EXPORT PSBLAS_Targets + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) From 51e89d0dc860f412e82474714186d854813f1411 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 09:56:06 -0800 Subject: [PATCH 08/48] Remove legacy file: psb_sxdot.f90 --- base/CMakeLists.txt | 1 - base/psblas/psb_sxdot.f90 | 589 -------------------------------------- 2 files changed, 590 deletions(-) delete mode 100644 base/psblas/psb_sxdot.f90 diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 1e3251b9b..d2743d504 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -315,7 +315,6 @@ tools/psb_sasb.f90 ./psblas/psb_snrmi.f90 ./psblas/psb_dspmm.f90 ./psblas/psb_samax.f90 -./psblas/psb_sxdot.f90 ./psblas/psb_dspnrm1.f90 ./psblas/psb_sspnrm1.f90 ./psblas/psb_sspmm.f90 diff --git a/base/psblas/psb_sxdot.f90 b/base/psblas/psb_sxdot.f90 deleted file mode 100644 index aafe474f9..000000000 --- a/base/psblas/psb_sxdot.f90 +++ /dev/null @@ -1,589 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006, 2010, 2015, 2017 -! Salvatore Filippone Cranfield University -! Alfredo Buttari CNRS-IRIT, Toulouse -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! File: psb_sdot.f90 -! -! Function: psb_sdot -! psb_sdot forms the dot product of two distributed vectors, -! -! dot := sub( X )**T * sub( Y ) -! -! where sub( X ) denotes X(:,JX) -! -! sub( Y ) denotes Y(:,JY). -! -! Arguments: -! x(:,:) - real The input vector containing the entries of ( X ). -! y(:,:) - real The input vector containing the entries of ( Y ). -! desc_a - type(psb_desc_type). The communication descriptor. -! info - integer. Return code -! jx - integer(optional). The column offset for sub( X ). -! jy - integer(optional). The column offset for sub( Y ). -! -function psb_sxdot(x, y,desc_a, info, jx, jy) - use psb_desc_mod - use psb_check_mod - use psb_error_mod - use psb_penv_mod - implicit none - - real(psb_spk_), intent(in) :: x(:,:), y(:,:) - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(in), optional :: jx, jy - integer(psb_ipk_), intent(out) :: info - real(psb_dpk_) :: psb_sxdot - - ! locals - integer(psb_ipk_) :: ictxt, np, me, idx, ndm,& - & err_act, iix, jjx, ix, ijx, iy, ijy, iiy, jjy, i, m - real(psb_dpk_) :: dot_local - real(psb_dpk_) :: sxdot - character(len=20) :: name, ch_err - - name='psb_sdot' - if(psb_get_errstatus() /= 0) return - info=psb_success_ - call psb_erractionsave(err_act) - - ictxt=desc_a%get_context() - call psb_info(ictxt, me, np) - if (np == -ione) then - info = psb_err_context_error_ - call psb_errpush(info,name) - goto 9999 - endif - - ix = ione - if (present(jx)) then - ijx = jx - else - ijx = ione - endif - - iy = ione - if (present(jy)) then - ijy = jy - else - ijy = ione - endif - - if(ijx /= ijy) then - info=3050 - call psb_errpush(info,name) - goto 9999 - end if - - m = desc_a%get_global_rows() - - ! check vector correctness - call psb_chkvect(m,ione,size(x,1),ix,ijx,desc_a,info,iix,jjx) - if (info == psb_success_) & - & call psb_chkvect(m,ione,size(y,1),iy,ijy,desc_a,info,iiy,jjy) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - ch_err='psb_chkvect' - call psb_errpush(info,name,a_err=ch_err) - goto 9999 - end if - - if ((iix /= ione).or.(iiy /= ione)) then - info=psb_err_ix_n1_iy_n1_unsupported_ - call psb_errpush(info,name) - goto 9999 - end if - - if(m /= 0) then - if(desc_a%get_local_rows() > 0) then - dot_local = sxdot(desc_a%get_local_rows(),& - & x(iix,jjx),ione,y(iiy,jjy),ione) - ! adjust dot_local because overlapped elements are computed more than once - do i=1,size(desc_a%ovrlap_elem,1) - idx = desc_a%ovrlap_elem(i,1) - ndm = desc_a%ovrlap_elem(i,2) - dot_local = dot_local - (real(ndm-1)/real(ndm))*(x(idx,jjx)*y(idx,jjy)) - end do - else - dot_local=0.0 - end if - else - dot_local=0.0 - end if - - ! compute global sum - call psb_sum(ictxt, dot_local) - - psb_sxdot = dot_local - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - - if (err_act == psb_act_abort_) then - call psb_error(ictxt) - return - end if - return -end function psb_sxdot - - - - -!!$ -!!$ Parallel Sparse BLAS version 3.5 -!!$ (C) Copyright 2006, 2010, 2015, 2017 -!!$ Salvatore Filippone University of Rome Tor Vergata -!!$ Alfredo Buttari CNRS-IRIT, Toulouse -!!$ -!!$ Redistribution and use in source and binary forms, with or without -!!$ modification, are permitted provided that the following conditions -!!$ are met: -!!$ 1. Redistributions of source code must retain the above copyright -!!$ notice, this list of conditions and the following disclaimer. -!!$ 2. Redistributions in binary form must reproduce the above copyright -!!$ notice, this list of conditions, and the following disclaimer in the -!!$ documentation and/or other materials provided with the distribution. -!!$ 3. The name of the PSBLAS group or the names of its contributors may -!!$ not be used to endorse or promote products derived from this -!!$ software without specific written permission. -!!$ -!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -!!$ POSSIBILITY OF SUCH DAMAGE. -!!$ -!!$ -! -! Function: psb_sdotv -! psb_sdotv forms the dot product of two distributed vectors, -! -! dot := X**T * Y -! -! Arguments: -! x(:) - real The input vector containing the entries of X. -! y(:) - real The input vector containing the entries of Y. -! desc_a - type(psb_desc_type). The communication descriptor. -! info - integer. Return code -! -function psb_sxdotv(x, y,desc_a, info) - use psb_desc_mod - use psb_check_mod - use psb_error_mod - use psb_penv_mod - implicit none - - real(psb_spk_), intent(in) :: x(:), y(:) - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(out) :: info - real(psb_dpk_) :: psb_sxdotv - - ! locals - integer(psb_ipk_) :: ictxt, np, me, idx, ndm,& - & err_act, iix, jjx, ix, jx, iy, jy, iiy, jjy, i, m - real(psb_dpk_) :: dot_local - real(psb_dpk_) :: sxdot - character(len=20) :: name, ch_err - - name='psb_sdot' - if(psb_get_errstatus() /= 0) return - info=psb_success_ - call psb_erractionsave(err_act) - - ictxt=desc_a%get_context() - - call psb_info(ictxt, me, np) - if (np == -ione) then - info = psb_err_context_error_ - call psb_errpush(info,name) - goto 9999 - endif - - ix = ione - iy = ione - jx = ione - jy = ione - m = desc_a%get_global_rows() - - ! check vector correctness - call psb_chkvect(m,ione,size(x,1),ix,jx,desc_a,info,iix,jjx) - if (info == psb_success_) & - & call psb_chkvect(m,ione,size(y,1),iy,jy,desc_a,info,iiy,jjy) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - ch_err='psb_chkvect' - call psb_errpush(info,name,a_err=ch_err) - goto 9999 - end if - - if ((iix /= ione).or.(iiy /= ione)) then - info=psb_err_ix_n1_iy_n1_unsupported_ - call psb_errpush(info,name) - goto 9999 - end if - - if(m /= 0) then - if(desc_a%get_local_rows() > 0) then - dot_local = sxdot(desc_a%get_local_rows(),& - & x,ione,y,ione) - ! adjust dot_local because overlapped elements are computed more than once - do i=1,size(desc_a%ovrlap_elem,1) - idx = desc_a%ovrlap_elem(i,1) - ndm = desc_a%ovrlap_elem(i,2) - dot_local = dot_local - (real(ndm-1)/real(ndm))*(x(idx)*y(idx)) - end do - else - dot_local=0.0 - end if - else - dot_local=0.0 - end if - - ! compute global sum - call psb_sum(ictxt, dot_local) - - psb_sxdotv = dot_local - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - - if (err_act == psb_act_abort_) then - call psb_error(ictxt) - return - end if - return -end function psb_sxdotv - -function sxdot(n,x,ix,y,iy) - use psb_const_mod - real(psb_dpk_) :: sxdot - integer(psb_ipk_) :: n,ix,iy - real(psb_spk_) :: x(*),y(*) - real(psb_dpk_) :: tmp - integer(psb_ipk_) :: i - - if ((ix /= 1).or.(iy /= 1)) then - write(psb_err_unit,*) 'WARNING unimplemented case in SXDOT' - sxdot=dzero - return - end if - - tmp = dzero - do i=1, n - tmp = tmp + dble(x(i))*dble(y(i)) - end do - sxdot = tmp - -end function sxdot - - -!!$ -!!$ Parallel Sparse BLAS version 3.5 -!!$ (C) Copyright 2006, 2010, 2015, 2017 -!!$ Salvatore Filippone University of Rome Tor Vergata -!!$ Alfredo Buttari CNRS-IRIT, Toulouse -!!$ -!!$ Redistribution and use in source and binary forms, with or without -!!$ modification, are permitted provided that the following conditions -!!$ are met: -!!$ 1. Redistributions of source code must retain the above copyright -!!$ notice, this list of conditions and the following disclaimer. -!!$ 2. Redistributions in binary form must reproduce the above copyright -!!$ notice, this list of conditions, and the following disclaimer in the -!!$ documentation and/or other materials provided with the distribution. -!!$ 3. The name of the PSBLAS group or the names of its contributors may -!!$ not be used to endorse or promote products derived from this -!!$ software without specific written permission. -!!$ -!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -!!$ POSSIBILITY OF SUCH DAMAGE. -!!$ -!!$ -! -! Subroutine: psb_sdotvs -! psb_sdotvs forms the dot product of two distributed vectors, -! -! dot := X**T * Y -! -! Arguments: -! res - real The result. -! x(:) - real The input vector containing the entries of X. -! y(:) - real The input vector containing the entries of Y. -! desc_a - type(psb_desc_type). The communication descriptor. -! info - integer. Return code -! -subroutine psb_sxdotvs(res, x, y,desc_a, info) - use psb_base_mod, psb_protect_name => psb_sxdotvs - implicit none - - real(psb_spk_), intent(in) :: x(:), y(:) - real(psb_dpk_), intent(out) :: res - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(out) :: info - - ! locals - integer(psb_ipk_) :: ictxt, np, me, idx, ndm,& - & err_act, iix, jjx, ix, iy, iiy, jjy, i, m - real(psb_dpk_) :: dot_local - real(psb_dpk_) :: sxdot - character(len=20) :: name, ch_err - - name='psb_sdot' - if(psb_get_errstatus() /= 0) return - info=psb_success_ - call psb_erractionsave(err_act) - - ictxt=desc_a%get_context() - - call psb_info(ictxt, me, np) - if (np == -ione) then - info = psb_err_context_error_ - call psb_errpush(info,name) - goto 9999 - endif - - ix = ione - iy = ione - m = desc_a%get_global_rows() - ! check vector correctness - call psb_chkvect(m,ione,size(x,1),ix,ix,desc_a,info,iix,jjx) - if (info == psb_success_) & - & call psb_chkvect(m,ione,size(y,1),iy,iy,desc_a,info,iiy,jjy) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - ch_err='psb_chkvect' - call psb_errpush(info,name,a_err=ch_err) - goto 9999 - end if - - if ((iix /= ione).or.(iiy /= ione)) then - info=psb_err_ix_n1_iy_n1_unsupported_ - call psb_errpush(info,name) - goto 9999 - end if - - if(m /= 0) then - if(desc_a%get_local_rows() > 0) then - dot_local = sxdot(desc_a%get_local_rows(),& - & x,ione,y,ione) - ! adjust dot_local because overlapped elements are computed more than once - do i=1,size(desc_a%ovrlap_elem,1) - idx = desc_a%ovrlap_elem(i,1) - ndm = desc_a%ovrlap_elem(i,2) - dot_local = dot_local - (real(ndm-1)/real(ndm))*(x(idx)*y(idx)) - end do - else - dot_local=0.0 - end if - else - dot_local=0.0 - end if - - ! compute global sum - call psb_sum(ictxt, dot_local) - - res = dot_local - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - - if (err_act == psb_act_abort_) then - call psb_error(ictxt) - return - end if - return -end subroutine psb_sxdotvs - - - - -!!$ -!!$ Parallel Sparse BLAS version 3.5 -!!$ (C) Copyright 2006, 2010, 2015, 2017 -!!$ Salvatore Filippone University of Rome Tor Vergata -!!$ Alfredo Buttari CNRS-IRIT, Toulouse -!!$ -!!$ Redistribution and use in source and binary forms, with or without -!!$ modification, are permitted provided that the following conditions -!!$ are met: -!!$ 1. Redistributions of source code must retain the above copyright -!!$ notice, this list of conditions and the following disclaimer. -!!$ 2. Redistributions in binary form must reproduce the above copyright -!!$ notice, this list of conditions, and the following disclaimer in the -!!$ documentation and/or other materials provided with the distribution. -!!$ 3. The name of the PSBLAS group or the names of its contributors may -!!$ not be used to endorse or promote products derived from this -!!$ software without specific written permission. -!!$ -!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -!!$ POSSIBILITY OF SUCH DAMAGE. -!!$ -!!$ -! -! Subroutine: psb_smdots -! psb_smdots forms the dot product of multiple distributed vectors, -! -! res(i) := ( X(:,i) )**T * ( Y(:,i) ) -! -! Arguments: -! res(:) - real. The result. -! x(:,:) - real The input vector containing the entries of ( X ). -! y(:,:) - real The input vector containing the entries of ( Y ). -! desc_a - type(psb_desc_type). The communication descriptor. -! info - integer. Return code -! -subroutine psb_sxmdots(res, x, y, desc_a, info) - use psb_base_mod, psb_protect_name => psb_sxmdots - implicit none - - real(psb_spk_), intent(in) :: x(:,:), y(:,:) - real(psb_dpk_), intent(out) :: res(:) - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(out) :: info - - ! locals - integer(psb_ipk_) :: ictxt, np, me, idx, ndm,& - & err_act, iix, jjx, ix, iy, iiy, jjy, i, m, j, k - real(psb_dpk_),allocatable :: dot_local(:) - real(psb_dpk_) :: sxdot - character(len=20) :: name, ch_err - - name='psb_smdots' - if(psb_get_errstatus() /= 0) return - info=psb_success_ - call psb_erractionsave(err_act) - - ictxt=desc_a%get_context() - - call psb_info(ictxt, me, np) - if (np == -ione) then - info = psb_err_context_error_ - call psb_errpush(info,name) - goto 9999 - endif - - ix = ione - iy = ione - - m = desc_a%get_global_rows() - - ! check vector correctness - call psb_chkvect(m,ione,size(x,1),ix,ix,desc_a,info,iix,jjx) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - ch_err='psb_chkvect' - call psb_errpush(info,name,a_err=ch_err) - goto 9999 - end if - call psb_chkvect(m,ione,size(y,1),iy,iy,desc_a,info,iiy,jjy) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - ch_err='psb_chkvect' - call psb_errpush(info,name,a_err=ch_err) - goto 9999 - end if - - if ((ix /= ione).or.(iy /= ione)) then - info=psb_err_ix_n1_iy_n1_unsupported_ - call psb_errpush(info,name) - goto 9999 - end if - - k = min(size(x,2),size(y,2)) - allocate(dot_local(k)) - - if(m /= 0) then - if(desc_a%get_local_rows() > 0) then - do j=1,k - dot_local(j) = sxdot(desc_a%get_local_rows(),& - & x(1,j),ione,y(1,j),ione) - ! adjust dot_local because overlapped elements are computed more than once - end do - do i=1,size(desc_a%ovrlap_elem,1) - idx = desc_a%ovrlap_elem(i,1) - ndm = desc_a%ovrlap_elem(i,2) - dot_local(1:k) = dot_local(1:k) - (real(ndm-1)/real(ndm))*(x(idx,1:k)*y(idx,1:k)) - end do - else - dot_local(:)=0.0 - end if - else - dot_local(:)=0.0 - end if - - ! compute global sum - call psb_sum(ictxt, dot_local(1:k)) - - res(1:k) = dot_local(1:k) - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - - if (err_act == psb_act_abort_) then - call psb_error(ictxt) - return - end if - return -end subroutine psb_sxmdots From 5c72f3fad2e0b53c8a36c3cb3a7e14732e45c0ea Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 09:58:34 -0800 Subject: [PATCH 09/48] Remove unnecessary -DSERIAL_MPI Also remove psb_sxdot.f90 from CMakeLists.txt to be consistent with the file removal in the previous commit. --- CMakeLists.txt | 2 +- base/CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1f9aaf26..69cfd82ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -605,7 +605,7 @@ endif() #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 -DSERIAL_MPI + -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 ) # From ./configure CDEFINES section add_definitions( diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index d2743d504..44859d5ef 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -676,7 +676,6 @@ tools/psb_sasb.f90 ./psblas/psb_snrmi.f90 ./psblas/psb_dspmm.f90 ./psblas/psb_samax.f90 -./psblas/psb_sxdot.f90 ./psblas/psb_dspnrm1.f90 ./psblas/psb_sspnrm1.f90 ./psblas/psb_sspmm.f90 From a1daf4e306029a5af78b29c4432359b856856b21 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 10:17:33 -0800 Subject: [PATCH 10/48] Work around CMake bug: #if (defined)->#ifdef --- base/modules/psi_comm_buffers_mod.F90 | 180 +++++++++++++------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/base/modules/psi_comm_buffers_mod.F90 b/base/modules/psi_comm_buffers_mod.F90 index fb418bb41..7c761226a 100644 --- a/base/modules/psi_comm_buffers_mod.F90 +++ b/base/modules/psi_comm_buffers_mod.F90 @@ -1,9 +1,9 @@ -! +! ! Parallel Sparse BLAS version 3.5 ! (C) Copyright 2006, 2010, 2015, 2017 ! Salvatore Filippone Cranfield University ! Alfredo Buttari CNRS-IRIT, Toulouse -! +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -15,7 +15,7 @@ ! 3. The name of the PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -27,9 +27,9 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! -#if defined(SERIAL_MPI) +! +! +#ifdef SERIAL_MPI ! Provide a fake mpi module just to keep the compiler(s) happy. module mpi use psb_const_mod @@ -40,17 +40,17 @@ module mpi integer(psb_mpik_), parameter :: mpi_integer8 = 2 integer(psb_mpik_), parameter :: mpi_real = 3 integer(psb_mpik_), parameter :: mpi_double_precision = 4 - integer(psb_mpik_), parameter :: mpi_complex = 5 - integer(psb_mpik_), parameter :: mpi_double_complex = 6 + integer(psb_mpik_), parameter :: mpi_complex = 5 + integer(psb_mpik_), parameter :: mpi_double_complex = 6 integer(psb_mpik_), parameter :: mpi_character = 7 integer(psb_mpik_), parameter :: mpi_logical = 8 integer(psb_mpik_), parameter :: mpi_integer2 = 9 integer(psb_mpik_), parameter :: mpi_comm_null = -1 integer(psb_mpik_), parameter :: mpi_comm_world = 1 - + real(psb_dpk_), external :: mpi_wtime end module mpi -#endif +#endif module psi_comm_buffers_mod use psb_const_mod @@ -69,7 +69,7 @@ module psi_comm_buffers_mod type psb_buffer_node integer(psb_mpik_) :: request - integer(psb_mpik_) :: icontxt + integer(psb_mpik_) :: icontxt integer(psb_mpik_) :: buffer_type integer(psb_ipk_), allocatable :: intbuf(:) integer(psb_long_int_k_), allocatable :: int8buf(:) @@ -112,25 +112,25 @@ module psi_comm_buffers_mod module procedure psi_i2snd end interface #endif - + contains subroutine psb_init_queue(mesg_queue,info) - implicit none + implicit none type(psb_buffer_queue), intent(inout) :: mesg_queue integer(psb_ipk_), intent(out) :: info info = 0 if ((.not.associated(mesg_queue%head)).and.& - & (.not.associated(mesg_queue%tail))) then + & (.not.associated(mesg_queue%tail))) then ! Nothing to do return end if if ((.not.associated(mesg_queue%head)).or.& - & (.not.associated(mesg_queue%tail))) then + & (.not.associated(mesg_queue%tail))) then ! If we are here one is associated, the other is not. - ! This is impossible. + ! This is impossible. info = -1 write(psb_err_unit,*) 'Wrong status on init ' return @@ -142,12 +142,12 @@ subroutine psb_wait_buffer(node, info) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif type(psb_buffer_node), intent(inout) :: node - integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), intent(out) :: info integer(psb_mpik_) :: status(mpi_status_size),minfo minfo = mpi_success call mpi_wait(node%request,status,minfo) @@ -158,13 +158,13 @@ subroutine psb_test_buffer(node, flag, info) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif type(psb_buffer_node), intent(inout) :: node logical, intent(out) :: flag - integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), intent(out) :: info integer(psb_mpik_) :: status(mpi_status_size), minfo minfo = mpi_success #if defined(SERIAL_MPI) @@ -174,7 +174,7 @@ subroutine psb_test_buffer(node, flag, info) #endif info=minfo end subroutine psb_test_buffer - + subroutine psb_close_context(mesg_queue,icontxt) type(psb_buffer_queue), intent(inout) :: mesg_queue @@ -183,10 +183,10 @@ subroutine psb_close_context(mesg_queue,icontxt) type(psb_buffer_node), pointer :: node, nextnode node => mesg_queue%head - do + do if (.not.associated(node)) exit nextnode => node%next - if (node%icontxt == icontxt) then + if (node%icontxt == icontxt) then call psb_wait_buffer(node,info) call psb_delete_node(mesg_queue,node) end if @@ -198,9 +198,9 @@ subroutine psb_close_all_context(mesg_queue) type(psb_buffer_queue), intent(inout) :: mesg_queue type(psb_buffer_node), pointer :: node, nextnode integer(psb_ipk_) :: info - + node => mesg_queue%head - do + do if (.not.associated(node)) exit nextnode => node%next call psb_wait_buffer(node,info) @@ -214,8 +214,8 @@ subroutine psb_delete_node(mesg_queue,node) type(psb_buffer_queue), intent(inout) :: mesg_queue type(psb_buffer_node), pointer :: node type(psb_buffer_node), pointer :: prevnode - - if (.not.associated(node)) then + + if (.not.associated(node)) then return end if prevnode => node%prev @@ -224,7 +224,7 @@ subroutine psb_delete_node(mesg_queue,node) if (associated(prevnode)) prevnode%next => node%next if (associated(node%next)) node%next%prev => prevnode deallocate(node) - + end subroutine psb_delete_node subroutine psb_insert_node(mesg_queue,node) @@ -234,7 +234,7 @@ subroutine psb_insert_node(mesg_queue,node) node%next => null() node%prev => null() if ((.not.associated(mesg_queue%head)).and.& - & (.not.associated(mesg_queue%tail))) then + & (.not.associated(mesg_queue%tail))) then mesg_Queue%head => node mesg_queue%tail => node return @@ -250,13 +250,13 @@ subroutine psb_test_nodes(mesg_queue) type(psb_buffer_node), pointer :: node, nextnode integer(psb_ipk_) :: info logical :: flag - + node => mesg_queue%head - do + do if (.not.associated(node)) exit nextnode => node%next call psb_test_buffer(node,flag,info) - if (flag) then + if (flag) then call psb_delete_node(mesg_queue,node) end if node => nextnode @@ -270,14 +270,14 @@ end subroutine psb_test_nodes ! to a node in the mesg queue, then it is sent. ! Thus the calling process should guarantee that ! the buffer is dispensable, i.e. the user data - ! has already been copied. + ! has already been copied. ! ! !!!!!!!!!!!!!!!!! subroutine psi_isnd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -287,16 +287,16 @@ subroutine psi_isnd(icontxt,tag,dest,buffer,mesg_queue) type(psb_buffer_node), pointer :: node integer(psb_ipk_) :: info integer(psb_mpik_) :: minfo - + allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_int_type call move_alloc(buffer,node%intbuf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if @@ -304,7 +304,7 @@ subroutine psi_isnd(icontxt,tag,dest,buffer,mesg_queue) & dest,tag,icontxt,node%request,minfo) info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) end subroutine psi_isnd @@ -314,7 +314,7 @@ subroutine psi_i4snd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -324,24 +324,24 @@ subroutine psi_i4snd(icontxt,tag,dest,buffer,mesg_queue) type(psb_buffer_node), pointer :: node integer(psb_mpik_) :: info integer(psb_mpik_) :: minfo - + allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_int4_type call move_alloc(buffer,node%int4buf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if call mpi_isend(node%int4buf,size(node%int4buf),psb_mpi_def_integer,& & dest,tag,icontxt,node%request,minfo) - info = minfo + info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) end subroutine psi_i4snd @@ -352,7 +352,7 @@ subroutine psi_i8snd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -362,24 +362,24 @@ subroutine psi_i8snd(icontxt,tag,dest,buffer,mesg_queue) type(psb_buffer_node), pointer :: node integer(psb_ipk_) :: info integer(psb_mpik_) :: minfo - + allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_int8_type call move_alloc(buffer,node%int8buf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if call mpi_isend(node%int8buf,size(node%int8buf),psb_mpi_lng_integer,& & dest,tag,icontxt,node%request,minfo) - info = minfo + info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) end subroutine psi_i8snd @@ -390,7 +390,7 @@ subroutine psi_i2snd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -400,16 +400,16 @@ subroutine psi_i2snd(icontxt,tag,dest,buffer,mesg_queue) type(psb_buffer_node), pointer :: node integer(psb_ipk_) :: info integer(psb_mpik_) :: minfo - + allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_int2_type call move_alloc(buffer,node%int2buf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if @@ -417,7 +417,7 @@ subroutine psi_i2snd(icontxt,tag,dest,buffer,mesg_queue) & dest,tag,icontxt,node%request,minfo) info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) end subroutine psi_i2snd @@ -427,7 +427,7 @@ subroutine psi_ssnd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -439,14 +439,14 @@ subroutine psi_ssnd(icontxt,tag,dest,buffer,mesg_queue) integer(psb_mpik_) :: minfo allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_real_type call move_alloc(buffer,node%realbuf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if @@ -454,16 +454,16 @@ subroutine psi_ssnd(icontxt,tag,dest,buffer,mesg_queue) & dest,tag,icontxt,node%request,minfo) info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) - + end subroutine psi_ssnd subroutine psi_dsnd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -475,14 +475,14 @@ subroutine psi_dsnd(icontxt,tag,dest,buffer,mesg_queue) integer(psb_mpik_) :: minfo allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_double_type call move_alloc(buffer,node%doublebuf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if @@ -490,16 +490,16 @@ subroutine psi_dsnd(icontxt,tag,dest,buffer,mesg_queue) & dest,tag,icontxt,node%request,minfo) info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) - + end subroutine psi_dsnd - + subroutine psi_csnd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -511,31 +511,31 @@ subroutine psi_csnd(icontxt,tag,dest,buffer,mesg_queue) integer(psb_mpik_) :: minfo allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_complex_type call move_alloc(buffer,node%complexbuf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if call mpi_isend(node%complexbuf,size(node%complexbuf),psb_mpi_c_spk_,& & dest,tag,icontxt,node%request,minfo) - info = minfo + info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) - + end subroutine psi_csnd subroutine psi_zsnd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -545,16 +545,16 @@ subroutine psi_zsnd(icontxt,tag,dest,buffer,mesg_queue) type(psb_buffer_node), pointer :: node integer(psb_ipk_) :: info integer(psb_mpik_) :: minfo - + allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_dcomplex_type call move_alloc(buffer,node%dcomplbuf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if @@ -562,9 +562,9 @@ subroutine psi_zsnd(icontxt,tag,dest,buffer,mesg_queue) & dest,tag,icontxt,node%request,minfo) info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) - + end subroutine psi_zsnd @@ -572,7 +572,7 @@ subroutine psi_lsnd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -582,16 +582,16 @@ subroutine psi_lsnd(icontxt,tag,dest,buffer,mesg_queue) type(psb_buffer_node), pointer :: node integer(psb_ipk_) :: info integer(psb_mpik_) :: minfo - + allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_logical_type call move_alloc(buffer,node%logbuf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if @@ -599,9 +599,9 @@ subroutine psi_lsnd(icontxt,tag,dest,buffer,mesg_queue) & dest,tag,icontxt,node%request,minfo) info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) - + end subroutine psi_lsnd @@ -609,7 +609,7 @@ subroutine psi_hsnd(icontxt,tag,dest,buffer,mesg_queue) #ifdef MPI_MOD use mpi #endif - implicit none + implicit none #ifdef MPI_H include 'mpif.h' #endif @@ -619,16 +619,16 @@ subroutine psi_hsnd(icontxt,tag,dest,buffer,mesg_queue) type(psb_buffer_node), pointer :: node integer(psb_ipk_) :: info integer(psb_mpik_) :: minfo - + allocate(node, stat=info) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if node%icontxt = icontxt node%buffer_type = psb_char_type call move_alloc(buffer,node%charbuf) - if (info /= 0) then + if (info /= 0) then write(psb_err_unit,*) 'Fatal memory error inside communication subsystem' return end if @@ -636,9 +636,9 @@ subroutine psi_hsnd(icontxt,tag,dest,buffer,mesg_queue) & dest,tag,icontxt,node%request,minfo) info = minfo call psb_insert_node(mesg_queue,node) - + call psb_test_nodes(mesg_queue) - + end subroutine psi_hsnd From 936ee0f2c20aa40b898af696a6330b24568353fe Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 10:51:29 -0800 Subject: [PATCH 11/48] Add subdirectories CMakeLists.txt files have been created for krylov/ prec/ util/ Skipping cbind/ for now and skipping serial build for now. --- CMakeLists.txt | 4 + base/CMakeLists.txt | 5 +- krylov/CMakeLists.txt | 206 ++++++++++++++++++++++++++++++++++++ prec/CMakeLists.txt | 237 ++++++++++++++++++++++++++++++++++++++++++ util/CMakeLists.txt | 182 ++++++++++++++++++++++++++++++++ 5 files changed, 632 insertions(+), 2 deletions(-) create mode 100644 krylov/CMakeLists.txt create mode 100644 prec/CMakeLists.txt create mode 100644 util/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 69cfd82ba..d973266b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -613,3 +613,7 @@ add_definitions( ) add_subdirectory(base) +add_subdirectory(prec) +add_subdirectory(krylov) +add_subdirectory(util) +#add_subdirectory(cbind) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 44859d5ef..723aa533d 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -442,10 +442,12 @@ serial/impl/psb_c_mat_impl.F90 serial/impl/psb_s_base_mat_impl.F90 serial/impl/psb_d_mat_impl.F90 serial/impl/psb_z_base_mat_impl.F90 -modules/fakempi.c modules/cutil.c ) +# Add this above and below if the SERIAL_MPI flag is passed: +# modules/fakempi.c + add_library(base_static STATIC internals/psi_desc_impl.f90 internals/psi_crea_bnd_elem.f90 @@ -803,7 +805,6 @@ serial/impl/psb_c_mat_impl.F90 serial/impl/psb_s_base_mat_impl.F90 serial/impl/psb_d_mat_impl.F90 serial/impl/psb_z_base_mat_impl.F90 -modules/fakempi.c modules/cutil.c ) target_link_libraries(base PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) diff --git a/krylov/CMakeLists.txt b/krylov/CMakeLists.txt new file mode 100644 index 000000000..78e52f4b1 --- /dev/null +++ b/krylov/CMakeLists.txt @@ -0,0 +1,206 @@ +if (NOT MPI_C_FOUND) + find_package(MPI REQUIRED) + + set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) + set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) + set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) + set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) + include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) +endif() + +if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") + set(gfortran_compiler true) +endif() + +include(CheckIncludeFile) +CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) +if(NOT HAVE_ALLOCA) + add_definitions(-DALLOCA_MISSING) + message(WARNING "Could not find . Assuming functionality is provided elsewhere.") +endif() + +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") +if(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +else() + set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +endif() +set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") +if(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) +else() + set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) +endif() + +set(MPI_HEADERS mpi.h) +include(CheckIncludeFiles) +CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) +if(HAVE_MPI_EXT) + add_definitions(-DHAVE_MPI_EXT_H) + set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) +endif() + +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) +set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) +set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) + +#--------------------------------------------------- +# Windows Intel MPI compatibility, see GH issue #435 +#--------------------------------------------------- +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) + +include(CheckSymbolExists) +CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) +if(HAVE_Intel_MPI AND WIN32) + add_definitions(-DUSE_GCC) +endif() +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) + +set(PSBLAS_SO_VERSION 0) +if(gfortran_compiler) + if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) + set(PSBLAS_SO_VERSION 2) + elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) + set(PSBLAS_SO_VERSION 1) + endif() +endif() + +set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") +set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") +set(MPI_LIBS "") +foreach( lib IN LISTS MPI_Fortran_LIBRARIES) + set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +endforeach() +string(STRIP "${MPI_LIBS}" MPI_LIBS) + +add_library(krylov SHARED +psb_base_krylov_conv_mod.f90 +psb_cbicg.f90 +psb_ccg.F90 +psb_ccgs.f90 +psb_ccgstab.f90 +psb_ccgstabl.f90 +psb_cfcg.F90 +psb_cgcr.f90 +psb_c_krylov_conv_mod.f90 +psb_ckrylov.f90 +psb_crgmres.f90 +psb_dbicg.f90 +psb_dcg.F90 +psb_dcgs.f90 +psb_dcgstab.f90 +psb_dcgstabl.f90 +psb_dfcg.F90 +psb_dgcr.f90 +psb_d_krylov_conv_mod.f90 +psb_dkrylov.f90 +psb_drgmres.f90 +psb_krylov_conv_mod.f90 +psb_krylov_mod.f90 +psb_sbicg.f90 +psb_scg.F90 +psb_scgs.f90 +psb_scgstab.f90 +psb_scgstabl.f90 +psb_sfcg.F90 +psb_sgcr.f90 +psb_s_krylov_conv_mod.f90 +psb_skrylov.f90 +psb_srgmres.f90 +psb_zbicg.f90 +psb_zcg.F90 +psb_zcgs.f90 +psb_zcgstab.f90 +psb_zcgstabl.f90 +psb_zfcg.F90 +psb_zgcr.f90 +psb_z_krylov_conv_mod.f90 +psb_zkrylov.f90 +psb_zrgmres.f90 +) + +add_library(krylov_static STATIC +psb_base_krylov_conv_mod.f90 +psb_cbicg.f90 +psb_ccg.F90 +psb_ccgs.f90 +psb_ccgstab.f90 +psb_ccgstabl.f90 +psb_cfcg.F90 +psb_cgcr.f90 +psb_c_krylov_conv_mod.f90 +psb_ckrylov.f90 +psb_crgmres.f90 +psb_dbicg.f90 +psb_dcg.F90 +psb_dcgs.f90 +psb_dcgstab.f90 +psb_dcgstabl.f90 +psb_dfcg.F90 +psb_dgcr.f90 +psb_d_krylov_conv_mod.f90 +psb_dkrylov.f90 +psb_drgmres.f90 +psb_krylov_conv_mod.f90 +psb_krylov_mod.f90 +psb_sbicg.f90 +psb_scg.F90 +psb_scgs.f90 +psb_scgstab.f90 +psb_scgstabl.f90 +psb_sfcg.F90 +psb_sgcr.f90 +psb_s_krylov_conv_mod.f90 +psb_skrylov.f90 +psb_srgmres.f90 +psb_zbicg.f90 +psb_zcg.F90 +psb_zcgs.f90 +psb_zcgstab.f90 +psb_zcgstabl.f90 +psb_zfcg.F90 +psb_zgcr.f90 +psb_z_krylov_conv_mod.f90 +psb_zkrylov.f90 +psb_zrgmres.f90 +) + +target_link_libraries(krylov PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec) +target_link_libraries(krylov_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec) + +install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILES_MATCHING PATTERN "*.mod") + +set_target_properties( krylov_static + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties ( krylov + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties(krylov_static PROPERTIES OUTPUT_NAME krylov) +get_target_property(libkrylov_static krylov_static OUTPUT_NAME) +set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libkrylov_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") + +install(TARGETS krylov EXPORT PSBLAS_Targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) + +install(TARGETS krylov_static EXPORT PSBLAS_Targets + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) diff --git a/prec/CMakeLists.txt b/prec/CMakeLists.txt new file mode 100644 index 000000000..d2d05b629 --- /dev/null +++ b/prec/CMakeLists.txt @@ -0,0 +1,237 @@ +if (NOT MPI_C_FOUND) + find_package(MPI REQUIRED) + + set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) + set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) + set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) + set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) + include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) +endif() + +if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") + set(gfortran_compiler true) +endif() + +include(CheckIncludeFile) +CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) +if(NOT HAVE_ALLOCA) + add_definitions(-DALLOCA_MISSING) + message(WARNING "Could not find . Assuming functionality is provided elsewhere.") +endif() + +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") +if(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +else() + set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +endif() +set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") +if(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) +else() + set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) +endif() + +set(MPI_HEADERS mpi.h) +include(CheckIncludeFiles) +CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) +if(HAVE_MPI_EXT) + add_definitions(-DHAVE_MPI_EXT_H) + set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) +endif() + +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) +set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) +set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) + +#--------------------------------------------------- +# Windows Intel MPI compatibility, see GH issue #435 +#--------------------------------------------------- +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) + +include(CheckSymbolExists) +CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) +if(HAVE_Intel_MPI AND WIN32) + add_definitions(-DUSE_GCC) +endif() +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) + +set(PSBLAS_SO_VERSION 0) +if(gfortran_compiler) + if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) + set(PSBLAS_SO_VERSION 2) + elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) + set(PSBLAS_SO_VERSION 1) + endif() +endif() + +set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") +set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") +set(MPI_LIBS "") +foreach( lib IN LISTS MPI_Fortran_LIBRARIES) + set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +endforeach() +string(STRIP "${MPI_LIBS}" MPI_LIBS) + +add_library(prec SHARED +./psb_prec_const_mod.f90 +./psb_c_prec_mod.f90 +./psb_c_base_prec_mod.f90 +./psb_d_bjacprec.f90 +./psb_z_base_prec_mod.f90 +./psb_d_diagprec.f90 +./impl/psb_dprecbld.f90 +./impl/psb_cprecinit.f90 +./impl/psb_dprecinit.f90 +./impl/psb_zilu_fct.f90 +./impl/psb_silu_fct.f90 +./impl/psb_cprecset.f90 +./impl/psb_s_prec_type_impl.f90 +./impl/psb_dilu_fct.f90 +./impl/psb_cprecbld.f90 +./impl/psb_c_diagprec_impl.f90 +./impl/psb_s_bjacprec_impl.f90 +./impl/psb_z_prec_type_impl.f90 +./impl/psb_d_nullprec_impl.f90 +./impl/psb_c_nullprec_impl.f90 +./impl/psb_d_diagprec_impl.f90 +./impl/psb_zprecinit.f90 +./impl/psb_d_prec_type_impl.f90 +./impl/psb_c_prec_type_impl.f90 +./impl/psb_s_nullprec_impl.f90 +./impl/psb_sprecinit.f90 +./impl/psb_z_bjacprec_impl.f90 +./impl/psb_d_bjacprec_impl.f90 +./impl/psb_z_nullprec_impl.f90 +./impl/psb_dprecset.f90 +./impl/psb_c_bjacprec_impl.f90 +./impl/psb_zprecset.f90 +./impl/psb_sprecbld.f90 +./impl/psb_cilu_fct.f90 +./impl/psb_z_diagprec_impl.f90 +./impl/psb_sprecset.f90 +./impl/psb_zprecbld.f90 +./impl/psb_s_diagprec_impl.f90 +./psb_s_base_prec_mod.f90 +./psb_s_bjacprec.f90 +./psb_c_prec_type.f90 +./psb_s_nullprec.f90 +./psb_d_nullprec.f90 +./psb_prec_mod.f90 +./psb_d_prec_type.f90 +./psb_z_prec_type.f90 +./psb_z_prec_mod.f90 +./psb_z_nullprec.f90 +./psb_c_diagprec.f90 +./psb_z_bjacprec.f90 +./psb_s_prec_type.f90 +./psb_c_nullprec.f90 +./psb_prec_type.f90 +./psb_d_prec_mod.f90 +./psb_s_diagprec.f90 +./psb_c_bjacprec.f90 +./psb_s_prec_mod.f90 +./psb_z_diagprec.f90 +./psb_d_base_prec_mod.f90 +) +add_library(prec_static STATIC +./psb_prec_const_mod.f90 +./psb_c_prec_mod.f90 +./psb_c_base_prec_mod.f90 +./psb_d_bjacprec.f90 +./psb_z_base_prec_mod.f90 +./psb_d_diagprec.f90 +./impl/psb_dprecbld.f90 +./impl/psb_cprecinit.f90 +./impl/psb_dprecinit.f90 +./impl/psb_zilu_fct.f90 +./impl/psb_silu_fct.f90 +./impl/psb_cprecset.f90 +./impl/psb_s_prec_type_impl.f90 +./impl/psb_dilu_fct.f90 +./impl/psb_cprecbld.f90 +./impl/psb_c_diagprec_impl.f90 +./impl/psb_s_bjacprec_impl.f90 +./impl/psb_z_prec_type_impl.f90 +./impl/psb_d_nullprec_impl.f90 +./impl/psb_c_nullprec_impl.f90 +./impl/psb_d_diagprec_impl.f90 +./impl/psb_zprecinit.f90 +./impl/psb_d_prec_type_impl.f90 +./impl/psb_c_prec_type_impl.f90 +./impl/psb_s_nullprec_impl.f90 +./impl/psb_sprecinit.f90 +./impl/psb_z_bjacprec_impl.f90 +./impl/psb_d_bjacprec_impl.f90 +./impl/psb_z_nullprec_impl.f90 +./impl/psb_dprecset.f90 +./impl/psb_c_bjacprec_impl.f90 +./impl/psb_zprecset.f90 +./impl/psb_sprecbld.f90 +./impl/psb_cilu_fct.f90 +./impl/psb_z_diagprec_impl.f90 +./impl/psb_sprecset.f90 +./impl/psb_zprecbld.f90 +./impl/psb_s_diagprec_impl.f90 +./psb_s_base_prec_mod.f90 +./psb_s_bjacprec.f90 +./psb_c_prec_type.f90 +./psb_s_nullprec.f90 +./psb_d_nullprec.f90 +./psb_prec_mod.f90 +./psb_d_prec_type.f90 +./psb_z_prec_type.f90 +./psb_z_prec_mod.f90 +./psb_z_nullprec.f90 +./psb_c_diagprec.f90 +./psb_z_bjacprec.f90 +./psb_s_prec_type.f90 +./psb_c_nullprec.f90 +./psb_prec_type.f90 +./psb_d_prec_mod.f90 +./psb_s_diagprec.f90 +./psb_c_bjacprec.f90 +./psb_s_prec_mod.f90 +./psb_z_diagprec.f90 +./psb_d_base_prec_mod.f90 +) + +target_link_libraries(prec PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) +target_link_libraries(prec_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) + +install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILES_MATCHING PATTERN "*.mod") + +set_target_properties( prec_static + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties ( prec + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties(prec_static PROPERTIES OUTPUT_NAME prec) +get_target_property(libprec_static prec_static OUTPUT_NAME) +set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libprec_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") + +install(TARGETS prec EXPORT PSBLAS_Targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) + +install(TARGETS prec_static EXPORT PSBLAS_Targets + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt new file mode 100644 index 000000000..b99d8c19b --- /dev/null +++ b/util/CMakeLists.txt @@ -0,0 +1,182 @@ +if (NOT MPI_C_FOUND) + find_package(MPI REQUIRED) + + set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) + set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) + set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) + set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) + include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) +endif() + +if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") + set(gfortran_compiler true) +endif() + +include(CheckIncludeFile) +CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) +if(NOT HAVE_ALLOCA) + add_definitions(-DALLOCA_MISSING) + message(WARNING "Could not find . Assuming functionality is provided elsewhere.") +endif() + +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") +if(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +else() + set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +endif() +set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") +if(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) +else() + set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) +endif() + +set(MPI_HEADERS mpi.h) +include(CheckIncludeFiles) +CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) +if(HAVE_MPI_EXT) + add_definitions(-DHAVE_MPI_EXT_H) + set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) +endif() + +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) +set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) +set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) + +#--------------------------------------------------- +# Windows Intel MPI compatibility, see GH issue #435 +#--------------------------------------------------- +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) + +include(CheckSymbolExists) +CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) +if(HAVE_Intel_MPI AND WIN32) + add_definitions(-DUSE_GCC) +endif() +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) + +set(PSBLAS_SO_VERSION 0) +if(gfortran_compiler) + if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) + set(PSBLAS_SO_VERSION 2) + elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) + set(PSBLAS_SO_VERSION 1) + endif() +endif() + +set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") +set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") +set(MPI_LIBS "") +foreach( lib IN LISTS MPI_Fortran_LIBRARIES) + set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +endforeach() +string(STRIP "${MPI_LIBS}" MPI_LIBS) + +add_library(util SHARED +metis_int.c +psb_amd_order.c +psb_blockpart_mod.f90 +psb_c_hbio_impl.f90 +psb_c_mat_dist_impl.f90 +psb_c_mat_dist_mod.f90 +psb_c_mmio_impl.f90 +psb_c_renum_impl.F90 +psb_d_hbio_impl.f90 +psb_d_mat_dist_impl.f90 +psb_d_mat_dist_mod.f90 +psb_d_mmio_impl.f90 +psb_d_renum_impl.F90 +psb_gps_mod.f90 +psb_hbio_mod.f90 +psb_i_mmio_impl.f90 +psb_mat_dist_mod.f90 +psb_metispart_mod.F90 +psb_mmio_mod.F90 +psb_renum_mod.f90 +psb_s_hbio_impl.f90 +psb_s_mat_dist_impl.f90 +psb_s_mat_dist_mod.f90 +psb_s_mmio_impl.f90 +psb_s_renum_impl.F90 +psb_util_mod.f90 +psb_z_hbio_impl.f90 +psb_z_mat_dist_impl.f90 +psb_z_mat_dist_mod.f90 +psb_z_mmio_impl.f90 +psb_z_renum_impl.F90 +) + +add_library(util_static STATIC +metis_int.c +psb_amd_order.c +psb_blockpart_mod.f90 +psb_c_hbio_impl.f90 +psb_c_mat_dist_impl.f90 +psb_c_mat_dist_mod.f90 +psb_c_mmio_impl.f90 +psb_c_renum_impl.F90 +psb_d_hbio_impl.f90 +psb_d_mat_dist_impl.f90 +psb_d_mat_dist_mod.f90 +psb_d_mmio_impl.f90 +psb_d_renum_impl.F90 +psb_gps_mod.f90 +psb_hbio_mod.f90 +psb_i_mmio_impl.f90 +psb_mat_dist_mod.f90 +psb_metispart_mod.F90 +psb_mmio_mod.F90 +psb_renum_mod.f90 +psb_s_hbio_impl.f90 +psb_s_mat_dist_impl.f90 +psb_s_mat_dist_mod.f90 +psb_s_mmio_impl.f90 +psb_s_renum_impl.F90 +psb_util_mod.f90 +psb_z_hbio_impl.f90 +psb_z_mat_dist_impl.f90 +psb_z_mat_dist_mod.f90 +psb_z_mmio_impl.f90 +psb_z_renum_impl.F90 +) + +target_link_libraries(util PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) +target_link_libraries(util_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) + +install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILES_MATCHING PATTERN "*.mod") + +set_target_properties( util_static + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties ( util + PROPERTIES + SOVERSION ${PSBLAS_SO_VERSION} +) +set_target_properties(util_static PROPERTIES OUTPUT_NAME util) +get_target_property(libutil_static util_static OUTPUT_NAME) +set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libutil_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") + +install(TARGETS util EXPORT PSBLAS_Targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) + +install(TARGETS util_static EXPORT PSBLAS_Targets + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) From 9d15f21659702f5cc7346ba23ab2bded1c2cdc60 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 14:50:58 -0800 Subject: [PATCH 12/48] CMake build works for base, krylov, prec, util --- CMakeLists.txt | 10 +- base/CMakeLists.txt | 396 +++--------------------------------------- krylov/CMakeLists.txt | 64 ++----- prec/CMakeLists.txt | 81 ++------- util/CMakeLists.txt | 52 ++---- 5 files changed, 67 insertions(+), 536 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d973266b6..b849e1338 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -501,8 +501,6 @@ define_property(TARGET #------------------------------- #include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src) -#add_subdirectory(src) - #----------------------------------------------------- # Publicize installed location to other CMake projects #----------------------------------------------------- @@ -612,8 +610,8 @@ add_definitions( -DHAVE_METIS_ -DLowerUnderscore -DPtr64Bits ) -add_subdirectory(base) -add_subdirectory(prec) -add_subdirectory(krylov) -add_subdirectory(util) +set(directory_list base prec krylov util) # TODO: add cbind +foreach(directory ${directory_list}) + add_subdirectory("${directory}") +endforeach() #add_subdirectory(cbind) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 723aa533d..0ebc102e0 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -85,7 +85,7 @@ foreach( lib IN LISTS MPI_Fortran_LIBRARIES) endforeach() string(STRIP "${MPI_LIBS}" MPI_LIBS) -add_library(base SHARED +set(base_source_files internals/psi_desc_impl.f90 internals/psi_crea_bnd_elem.f90 internals/psi_bld_tmphalo.f90 @@ -444,368 +444,26 @@ serial/impl/psb_d_mat_impl.F90 serial/impl/psb_z_base_mat_impl.F90 modules/cutil.c ) +if (SERIAL_MPI) + set(base_source_files ${base_source_files} modules/fakempi.c) +endif() -# Add this above and below if the SERIAL_MPI flag is passed: -# modules/fakempi.c +add_library(base SHARED ${base_source_files}) +add_library(base_static STATIC ${base_source_files}) -add_library(base_static STATIC -internals/psi_desc_impl.f90 -internals/psi_crea_bnd_elem.f90 -internals/psi_bld_tmphalo.f90 -internals/psi_list_search.f90 -internals/psi_crea_ovr_elem.f90 -internals/psi_compute_size.f90 -internals/psi_dl_check.f90 -internals/psi_exist_ovr_elem.f90 -internals/psi_srtlist.f90 -internals/psi_bld_tmpovrl.f90 -internals/psi_crea_index.f90 -internals/psi_sort_dl.f90 -tools/psb_iallc.f90 -tools/psb_c_map.f90 -tools/psb_dspalloc.f90 -tools/psb_cspasb.f90 -tools/psb_dins.f90 -tools/psb_iasb.f90 -tools/psb_sspfree.f90 -tools/psb_cd_lstext.f90 -tools/psb_dsprn.f90 -tools/psb_cins.f90 -tools/psb_csprn.f90 -tools/psb_ifree.f90 -tools/psb_sspasb.f90 -tools/psb_z_map.f90 -tools/psb_zspins.f90 -tools/psb_sins.f90 -tools/psb_cdins.f90 -tools/psb_cspfree.f90 -tools/psb_cdalv.f90 -tools/psb_zallc.f90 -tools/psb_cspins.f90 -tools/psb_dallc.f90 -tools/psb_cdrep.f90 -tools/psb_dspfree.f90 -tools/psb_zspfree.f90 -tools/psb_get_overlap.f90 -tools/psb_cdals.f90 -tools/psb_dfree.f90 -tools/psb_dasb.f90 -tools/psb_zfree.f90 -tools/psb_zins.f90 -tools/psb_cd_switch_ovl_indxmap.f90 -tools/psb_sasb.f90 -./internals/psi_desc_impl.f90 -./internals/psi_crea_bnd_elem.f90 -./internals/psi_bld_tmphalo.f90 -./internals/psi_list_search.f90 -./internals/psi_crea_ovr_elem.f90 -./internals/psi_compute_size.f90 -./internals/psi_dl_check.f90 -./internals/psi_exist_ovr_elem.f90 -./internals/psi_srtlist.f90 -./internals/psi_bld_tmpovrl.f90 -./internals/psi_crea_index.f90 -./internals/psi_sort_dl.f90 -./tools/psb_iallc.f90 -./tools/psb_c_map.f90 -./tools/psb_dspalloc.f90 -./tools/psb_cspasb.f90 -./tools/psb_dins.f90 -./tools/psb_iasb.f90 -./tools/psb_sspfree.f90 -./tools/psb_cd_lstext.f90 -./tools/psb_dsprn.f90 -./tools/psb_cins.f90 -./tools/psb_csprn.f90 -./tools/psb_ifree.f90 -./tools/psb_sspasb.f90 -./tools/psb_z_map.f90 -./tools/psb_zspins.f90 -./tools/psb_sins.f90 -./tools/psb_cdins.f90 -./tools/psb_cspfree.f90 -./tools/psb_cdalv.f90 -./tools/psb_zallc.f90 -./tools/psb_cspins.f90 -./tools/psb_dallc.f90 -./tools/psb_cdrep.f90 -./tools/psb_dspfree.f90 -./tools/psb_zspfree.f90 -./tools/psb_get_overlap.f90 -./tools/psb_cdals.f90 -./tools/psb_dfree.f90 -./tools/psb_dasb.f90 -./tools/psb_zfree.f90 -./tools/psb_zins.f90 -./tools/psb_cd_switch_ovl_indxmap.f90 -./tools/psb_sasb.f90 -./tools/psb_callc.f90 -./tools/psb_cd_reinit.f90 -./tools/psb_cd_set_bld.f90 -./tools/psb_s_map.f90 -./tools/psb_cdprt.f90 -./tools/psb_glob_to_loc.f90 -./tools/psb_zasb.f90 -./tools/psb_zspalloc.f90 -./tools/psb_cspalloc.f90 -./tools/psb_iins.f90 -./tools/psb_d_map.f90 -./tools/psb_cdren.f90 -./tools/psb_casb.f90 -./tools/psb_zsprn.f90 -./tools/psb_sspins.f90 -./tools/psb_zspasb.f90 -./tools/psb_loc_to_glob.f90 -./tools/psb_dspasb.f90 -./tools/psb_cdall.f90 -./tools/psb_sallc.f90 -./tools/psb_ssprn.f90 -./tools/psb_dspins.f90 -./tools/psb_sspalloc.f90 -./tools/psb_cd_inloc.f90 -./tools/psb_sfree.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/psb_base_mod.f90 -./modules/psi_z_mod.f90 -./modules/desc/psb_indx_map_mod.f90 -./modules/desc/psb_repl_map_mod.f90 -./modules/desc/psb_desc_const_mod.f90 -./modules/desc/psb_gen_block_map_mod.f90 -./modules/desc/psb_hash_map_mod.f90 -./modules/desc/psb_glist_map_mod.f90 -./modules/desc/psb_list_map_mod.f90 -./modules/psi_d_mod.f90 -./modules/tools/psb_i_tools_mod.f90 -./modules/tools/psb_d_tools_mod.f90 -./modules/tools/psb_s_tools_mod.f90 -./modules/tools/psb_tools_mod.f90 -./modules/tools/psb_cd_tools_mod.f90 -./modules/tools/psb_z_tools_mod.f90 -./modules/tools/psb_c_tools_mod.f90 -./modules/psi_s_mod.f90 -./modules/comm/psb_d_linmap_mod.f90 -./modules/comm/psb_s_linmap_mod.f90 -./modules/comm/psb_base_linmap_mod.f90 -./modules/comm/psb_i_comm_mod.f90 -./modules/comm/psb_c_linmap_mod.f90 -./modules/comm/psb_c_comm_mod.f90 -./modules/comm/psb_z_comm_mod.f90 -./modules/comm/psb_z_linmap_mod.f90 -./modules/comm/psb_s_comm_mod.f90 -./modules/comm/psb_d_comm_mod.f90 -./modules/comm/psb_comm_mod.f90 -./modules/comm/psb_linmap_mod.f90 -./modules/psblas/psb_psblas_mod.f90 -./modules/psi_i_mod.f90 -./modules/serial/psb_s_csr_mat_mod.f90 -./modules/serial/psb_z_mat_mod.f90 -./modules/serial/psb_s_base_mat_mod.f90 -./modules/serial/psb_s_base_vect_mod.f90 -./modules/serial/psb_z_csc_mat_mod.f90 -./modules/serial/psb_d_csr_mat_mod.f90 -./modules/serial/psb_s_csc_mat_mod.f90 -./modules/serial/psb_i_base_vect_mod.f90 -./modules/serial/psb_z_base_vect_mod.f90 -./modules/serial/psb_c_csr_mat_mod.f90 -./modules/serial/psb_c_serial_mod.f90 -./modules/serial/psb_c_base_vect_mod.f90 -./modules/serial/psb_s_serial_mod.f90 -./modules/serial/psb_d_csc_mat_mod.f90 -./modules/serial/psb_vect_mod.f90 -./modules/serial/psb_base_mat_mod.f90 -./modules/serial/psb_c_csc_mat_mod.f90 -./modules/serial/psb_z_base_mat_mod.f90 -./modules/serial/psb_z_csr_mat_mod.f90 -./modules/serial/psb_c_mat_mod.f90 -./modules/serial/psb_d_base_mat_mod.f90 -./modules/serial/psb_d_serial_mod.f90 -./modules/serial/psb_c_base_mat_mod.f90 -./modules/serial/psb_d_base_vect_mod.f90 -./modules/serial/psb_serial_mod.f90 -./modules/serial/psb_s_mat_mod.f90 -./modules/serial/psb_z_serial_mod.f90 -./modules/serial/psb_d_mat_mod.f90 -./modules/serial/psb_mat_mod.f90 -./modules/error.f90 -./modules/psb_check_mod.f90 -./comm/psb_shalo.f90 -./comm/psb_dhalo.f90 -./comm/psb_igather.f90 -./comm/internals/psi_iovrl_restr.f90 -./comm/internals/psi_covrl_upd.f90 -./comm/internals/psi_covrl_save.f90 -./comm/internals/psi_sovrl_upd.f90 -./comm/internals/psi_dovrl_restr.f90 -./comm/internals/psi_zovrl_restr.f90 -./comm/internals/psi_dovrl_save.f90 -./comm/internals/psi_zovrl_save.f90 -./comm/internals/psi_sovrl_restr.f90 -./comm/internals/psi_zovrl_upd.f90 -./comm/internals/psi_sovrl_save.f90 -./comm/internals/psi_iovrl_upd.f90 -./comm/internals/psi_covrl_restr.f90 -./comm/internals/psi_iovrl_save.f90 -./comm/internals/psi_dovrl_upd.f90 -./comm/psb_iovrl.f90 -./comm/psb_cgather.f90 -./comm/psb_covrl.f90 -./comm/psb_zovrl.f90 -./comm/psb_ihalo.f90 -./comm/psb_dgather.f90 -./comm/psb_sovrl.f90 -./comm/psb_dovrl.f90 -./comm/psb_zgather.f90 -./comm/psb_zhalo.f90 -./comm/psb_sgather.f90 -./comm/psb_chalo.f90 -./psblas/psb_snrmi.f90 -./psblas/psb_dspmm.f90 -./psblas/psb_samax.f90 -./psblas/psb_dspnrm1.f90 -./psblas/psb_sspnrm1.f90 -./psblas/psb_sspmm.f90 -./psblas/psb_dnrmi.f90 -./psblas/psb_zamax.f90 -./psblas/psb_cspmm.f90 -./psblas/psb_dspsm.f90 -./psblas/psb_casum.f90 -./psblas/psb_cnrmi.f90 -./psblas/psb_znrm2.f90 -./psblas/psb_zspsm.f90 -./psblas/psb_camax.f90 -./psblas/psb_dnrm2.f90 -./psblas/psb_znrmi.f90 -./psblas/psb_cspsm.f90 -./psblas/psb_sdot.f90 -./psblas/psb_dasum.f90 -./psblas/psb_zasum.f90 -./psblas/psb_damax.f90 -./psblas/psb_zspmm.f90 -./psblas/psb_cnrm2.f90 -./psblas/psb_ddot.f90 -./psblas/psb_caxpby.f90 -./psblas/psb_cdot.f90 -./psblas/psb_snrm2.f90 -./psblas/psb_sspsm.f90 -./psblas/psb_daxpby.f90 -./psblas/psb_zdot.f90 -./psblas/psb_zaxpby.f90 -./psblas/psb_zspnrm1.f90 -./psblas/psb_sasum.f90 -./psblas/psb_saxpby.f90 -./psblas/psb_cspnrm1.f90 -serial/impl/psb_c_coo_impl.f90 -serial/smmp.f90 -serial/psb_srwextd.f90 -serial/psb_camax_s.f90 -serial/psb_ssymbmm.f90 -serial/psb_cgeprt.f90 -serial/psb_zasum_s.f90 -serial/psi_d_serial_impl.f90 -serial/psb_znumbmm.f90 -serial/psb_cspspmm.f90 -serial/psb_sgeprt.f90 -serial/psb_samax_s.f90 -serial/psb_sasum_s.f90 -serial/psi_i_serial_impl.f90 -serial/psb_aspxpby.f90 -serial/psb_zamax_s.f90 -serial/psi_c_serial_impl.f90 -serial/psb_sspspmm.f90 -serial/psb_cnumbmm.f90 -serial/psi_s_serial_impl.f90 -serial/psb_dspspmm.f90 -serial/psb_zsymbmm.f90 -serial/psb_cgelp.f90 -serial/psb_dnumbmm.f90 -serial/psb_csymbmm.f90 -serial/psb_zgelp.f90 -serial/psb_dsymbmm.f90 -serial/psb_damax_s.f90 -serial/psb_snumbmm.f90 -serial/psb_drwextd.f90 -serial/psb_spge_dot.f90 -serial/psb_spdot_srtd.f90 -serial/psb_crwextd.f90 -internals/psb_indx_map_fnd_owner.F90 -internals/psi_desc_index.F90 -internals/psi_fnd_owner.F90 -internals/psi_extrct_dl.F90 -tools/psb_icdasb.F90 -tools/psb_dsphalo.F90 -tools/psb_zcdbldext.F90 -tools/psb_scdbldext.F90 -tools/psb_zsphalo.F90 -tools/psb_ccdbldext.F90 -tools/psb_cdcpy.F90 -tools/psb_ssphalo.F90 -tools/psb_csphalo.F90 -tools/psb_dcdbldext.F90 -modules/psb_penv_mod.F90 -modules/psi_comm_buffers_mod.F90 -modules/psi_p2p_mod.F90 -modules/desc/psb_desc_mod.F90 -modules/psi_penv_mod.F90 -modules/psb_error_impl.F90 -modules/psb_realloc_mod.F90 -modules/psb_error_mod.F90 -modules/psblas/psb_s_psblas_mod.F90 -modules/psblas/psb_d_psblas_mod.F90 -modules/psblas/psb_c_psblas_mod.F90 -modules/psblas/psb_z_psblas_mod.F90 -modules/psi_reduce_mod.F90 -modules/psb_const_mod.F90 -modules/serial/psb_i_vect_mod.F90 -modules/serial/psb_c_vect_mod.F90 -modules/serial/psb_d_vect_mod.F90 -modules/serial/psb_z_vect_mod.F90 -modules/serial/psb_s_vect_mod.F90 -modules/psi_bcast_mod.F90 -comm/psb_zspgather.F90 -comm/psb_dscatter.F90 -comm/psb_zscatter.F90 -comm/internals/psi_dswapdata.F90 -comm/internals/psi_sswaptran.F90 -comm/internals/psi_sswapdata.F90 -comm/internals/psi_cswaptran.F90 -comm/internals/psi_iswapdata.F90 -comm/internals/psi_zswaptran.F90 -comm/internals/psi_iswaptran.F90 -comm/internals/psi_dswaptran.F90 -comm/internals/psi_zswapdata.F90 -comm/internals/psi_cswapdata.F90 -comm/psb_cspgather.F90 -comm/psb_iscatter.F90 -comm/psb_sscatter.F90 -comm/psb_sspgather.F90 -comm/psb_cscatter.F90 -comm/psb_dspgather.F90 -serial/impl/psb_c_base_mat_impl.F90 -serial/impl/psb_s_mat_impl.F90 -serial/impl/psb_z_mat_impl.F90 -serial/impl/psb_d_base_mat_impl.F90 -serial/impl/psb_c_mat_impl.F90 -serial/impl/psb_s_base_mat_impl.F90 -serial/impl/psb_d_mat_impl.F90 -serial/impl/psb_z_base_mat_impl.F90 -modules/cutil.c +set_target_properties(base + PROPERTIES + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + SOVERSION ${PSBLAS_SO_VERSION} + OUTPUT_NAME base +) +set_target_properties(base_static + PROPERTIES + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + SOVERSION ${PSBLAS_SO_VERSION} + OUTPUT_NAME base_static ) target_link_libraries(base PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) target_link_libraries(base_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) @@ -813,24 +471,16 @@ target_link_libraries(base_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRA install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") -set_target_properties( base_static - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} -) -set_target_properties ( base - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} -) -set_target_properties(base_static PROPERTIES OUTPUT_NAME base) get_target_property(libbase_static base_static OUTPUT_NAME) set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libbase_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") -install(TARGETS base EXPORT PSBLAS_Targets +install(TARGETS base + EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) - -install(TARGETS base_static EXPORT PSBLAS_Targets +install(TARGETS base_static + EXPORT PSBLAS_Targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) diff --git a/krylov/CMakeLists.txt b/krylov/CMakeLists.txt index 78e52f4b1..f929cae60 100644 --- a/krylov/CMakeLists.txt +++ b/krylov/CMakeLists.txt @@ -85,7 +85,7 @@ foreach( lib IN LISTS MPI_Fortran_LIBRARIES) endforeach() string(STRIP "${MPI_LIBS}" MPI_LIBS) -add_library(krylov SHARED +set(krylov_source_files psb_base_krylov_conv_mod.f90 psb_cbicg.f90 psb_ccg.F90 @@ -131,67 +131,30 @@ psb_zkrylov.f90 psb_zrgmres.f90 ) -add_library(krylov_static STATIC -psb_base_krylov_conv_mod.f90 -psb_cbicg.f90 -psb_ccg.F90 -psb_ccgs.f90 -psb_ccgstab.f90 -psb_ccgstabl.f90 -psb_cfcg.F90 -psb_cgcr.f90 -psb_c_krylov_conv_mod.f90 -psb_ckrylov.f90 -psb_crgmres.f90 -psb_dbicg.f90 -psb_dcg.F90 -psb_dcgs.f90 -psb_dcgstab.f90 -psb_dcgstabl.f90 -psb_dfcg.F90 -psb_dgcr.f90 -psb_d_krylov_conv_mod.f90 -psb_dkrylov.f90 -psb_drgmres.f90 -psb_krylov_conv_mod.f90 -psb_krylov_mod.f90 -psb_sbicg.f90 -psb_scg.F90 -psb_scgs.f90 -psb_scgstab.f90 -psb_scgstabl.f90 -psb_sfcg.F90 -psb_sgcr.f90 -psb_s_krylov_conv_mod.f90 -psb_skrylov.f90 -psb_srgmres.f90 -psb_zbicg.f90 -psb_zcg.F90 -psb_zcgs.f90 -psb_zcgstab.f90 -psb_zcgstabl.f90 -psb_zfcg.F90 -psb_zgcr.f90 -psb_z_krylov_conv_mod.f90 -psb_zkrylov.f90 -psb_zrgmres.f90 -) +add_library(krylov SHARED ${krylov_source_files}) +add_library(krylov_static STATIC ${krylov_source_files}) target_link_libraries(krylov PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec) -target_link_libraries(krylov_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec) +target_link_libraries(krylov_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec_static) install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") -set_target_properties( krylov_static +set_target_properties ( krylov PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME krylov ) -set_target_properties ( krylov +set_target_properties( krylov_static PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME krylov_static ) -set_target_properties(krylov_static PROPERTIES OUTPUT_NAME krylov) + get_target_property(libkrylov_static krylov_static OUTPUT_NAME) set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libkrylov_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") @@ -199,7 +162,6 @@ install(TARGETS krylov EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) - install(TARGETS krylov_static EXPORT PSBLAS_Targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" diff --git a/prec/CMakeLists.txt b/prec/CMakeLists.txt index d2d05b629..313f3097f 100644 --- a/prec/CMakeLists.txt +++ b/prec/CMakeLists.txt @@ -85,68 +85,7 @@ foreach( lib IN LISTS MPI_Fortran_LIBRARIES) endforeach() string(STRIP "${MPI_LIBS}" MPI_LIBS) -add_library(prec SHARED -./psb_prec_const_mod.f90 -./psb_c_prec_mod.f90 -./psb_c_base_prec_mod.f90 -./psb_d_bjacprec.f90 -./psb_z_base_prec_mod.f90 -./psb_d_diagprec.f90 -./impl/psb_dprecbld.f90 -./impl/psb_cprecinit.f90 -./impl/psb_dprecinit.f90 -./impl/psb_zilu_fct.f90 -./impl/psb_silu_fct.f90 -./impl/psb_cprecset.f90 -./impl/psb_s_prec_type_impl.f90 -./impl/psb_dilu_fct.f90 -./impl/psb_cprecbld.f90 -./impl/psb_c_diagprec_impl.f90 -./impl/psb_s_bjacprec_impl.f90 -./impl/psb_z_prec_type_impl.f90 -./impl/psb_d_nullprec_impl.f90 -./impl/psb_c_nullprec_impl.f90 -./impl/psb_d_diagprec_impl.f90 -./impl/psb_zprecinit.f90 -./impl/psb_d_prec_type_impl.f90 -./impl/psb_c_prec_type_impl.f90 -./impl/psb_s_nullprec_impl.f90 -./impl/psb_sprecinit.f90 -./impl/psb_z_bjacprec_impl.f90 -./impl/psb_d_bjacprec_impl.f90 -./impl/psb_z_nullprec_impl.f90 -./impl/psb_dprecset.f90 -./impl/psb_c_bjacprec_impl.f90 -./impl/psb_zprecset.f90 -./impl/psb_sprecbld.f90 -./impl/psb_cilu_fct.f90 -./impl/psb_z_diagprec_impl.f90 -./impl/psb_sprecset.f90 -./impl/psb_zprecbld.f90 -./impl/psb_s_diagprec_impl.f90 -./psb_s_base_prec_mod.f90 -./psb_s_bjacprec.f90 -./psb_c_prec_type.f90 -./psb_s_nullprec.f90 -./psb_d_nullprec.f90 -./psb_prec_mod.f90 -./psb_d_prec_type.f90 -./psb_z_prec_type.f90 -./psb_z_prec_mod.f90 -./psb_z_nullprec.f90 -./psb_c_diagprec.f90 -./psb_z_bjacprec.f90 -./psb_s_prec_type.f90 -./psb_c_nullprec.f90 -./psb_prec_type.f90 -./psb_d_prec_mod.f90 -./psb_s_diagprec.f90 -./psb_c_bjacprec.f90 -./psb_s_prec_mod.f90 -./psb_z_diagprec.f90 -./psb_d_base_prec_mod.f90 -) -add_library(prec_static STATIC +set(prec_source_files ./psb_prec_const_mod.f90 ./psb_c_prec_mod.f90 ./psb_c_base_prec_mod.f90 @@ -208,21 +147,30 @@ add_library(prec_static STATIC ./psb_d_base_prec_mod.f90 ) +add_library(prec SHARED ${prec_source_files}) +add_library(prec_static STATIC ${prec_source_files}) + target_link_libraries(prec PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) -target_link_libraries(prec_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) +target_link_libraries(prec_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base_static) install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") -set_target_properties( prec_static +set_target_properties ( prec PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME prec ) -set_target_properties ( prec +set_target_properties( prec_static PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME prec_static ) -set_target_properties(prec_static PROPERTIES OUTPUT_NAME prec) + get_target_property(libprec_static prec_static OUTPUT_NAME) set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libprec_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") @@ -230,7 +178,6 @@ install(TARGETS prec EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) - install(TARGETS prec_static EXPORT PSBLAS_Targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index b99d8c19b..07178d66c 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -85,7 +85,7 @@ foreach( lib IN LISTS MPI_Fortran_LIBRARIES) endforeach() string(STRIP "${MPI_LIBS}" MPI_LIBS) -add_library(util SHARED +set(util_source_files metis_int.c psb_amd_order.c psb_blockpart_mod.f90 @@ -119,55 +119,30 @@ psb_z_mmio_impl.f90 psb_z_renum_impl.F90 ) -add_library(util_static STATIC -metis_int.c -psb_amd_order.c -psb_blockpart_mod.f90 -psb_c_hbio_impl.f90 -psb_c_mat_dist_impl.f90 -psb_c_mat_dist_mod.f90 -psb_c_mmio_impl.f90 -psb_c_renum_impl.F90 -psb_d_hbio_impl.f90 -psb_d_mat_dist_impl.f90 -psb_d_mat_dist_mod.f90 -psb_d_mmio_impl.f90 -psb_d_renum_impl.F90 -psb_gps_mod.f90 -psb_hbio_mod.f90 -psb_i_mmio_impl.f90 -psb_mat_dist_mod.f90 -psb_metispart_mod.F90 -psb_mmio_mod.F90 -psb_renum_mod.f90 -psb_s_hbio_impl.f90 -psb_s_mat_dist_impl.f90 -psb_s_mat_dist_mod.f90 -psb_s_mmio_impl.f90 -psb_s_renum_impl.F90 -psb_util_mod.f90 -psb_z_hbio_impl.f90 -psb_z_mat_dist_impl.f90 -psb_z_mat_dist_mod.f90 -psb_z_mmio_impl.f90 -psb_z_renum_impl.F90 -) +add_library(util SHARED ${util_source_files}) +add_library(util_static STATIC ${util_source_files}) target_link_libraries(util PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) -target_link_libraries(util_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) +target_link_libraries(util_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base_static) install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") -set_target_properties( util_static +set_target_properties ( util PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME util ) -set_target_properties ( util +set_target_properties( util_static PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME util_static ) -set_target_properties(util_static PROPERTIES OUTPUT_NAME util) + get_target_property(libutil_static util_static OUTPUT_NAME) set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libutil_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") @@ -175,7 +150,6 @@ install(TARGETS util EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) - install(TARGETS util_static EXPORT PSBLAS_Targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" From b63f63ba6107b4269805b1ef9aadd7f2e3ceb198 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 15:19:28 -0800 Subject: [PATCH 13/48] Correct typo in a comment --- test/util/dhb2mm.f90 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/util/dhb2mm.f90 b/test/util/dhb2mm.f90 index 1e66608b1..e31b143c1 100644 --- a/test/util/dhb2mm.f90 +++ b/test/util/dhb2mm.f90 @@ -1,9 +1,9 @@ -! +! ! Parallel Sparse BLAS version 3.5 ! (C) Copyright 2006, 2010, 2015, 2017 ! Salvatore Filippone Cranfield University ! Alfredo Buttari CNRS-IRIT, Toulouse -! +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -15,7 +15,7 @@ ! 3. The name of the PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -27,22 +27,22 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! ! -! Storage conversion filter: reads from standar input a sparse matrix -! stored in Harwell-Boeing format, and writes to standard output in MatrixMarket +! +! +! Storage conversion filter: reads from standard input a sparse matrix +! stored in Harwell-Boeing format, and writes to standard output in MatrixMarket ! format ! program dhb2mm use psb_base_mod use psb_util_mod type(psb_dspmat_type) :: a - + integer(psb_ipk_) :: info character(len=72) :: mtitle - + call hb_read(a,info,mtitle=mtitle) call mm_mat_write(a,mtitle,info) @@ -51,4 +51,4 @@ program dhb2mm end program dhb2mm - + From 37c4024bf59f7bad11b485174b2ad443269ab1ea Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 15:33:45 -0800 Subject: [PATCH 14/48] Match CMake lib OUTPUT_NAME to current practice --- base/CMakeLists.txt | 4 ++-- krylov/CMakeLists.txt | 4 ++-- prec/CMakeLists.txt | 4 ++-- util/CMakeLists.txt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 0ebc102e0..5e543441c 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -456,14 +456,14 @@ set_target_properties(base Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE SOVERSION ${PSBLAS_SO_VERSION} - OUTPUT_NAME base + OUTPUT_NAME psb_base ) set_target_properties(base_static PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE SOVERSION ${PSBLAS_SO_VERSION} - OUTPUT_NAME base_static + OUTPUT_NAME psb_base ) target_link_libraries(base PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) target_link_libraries(base_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) diff --git a/krylov/CMakeLists.txt b/krylov/CMakeLists.txt index f929cae60..6bab1b0f0 100644 --- a/krylov/CMakeLists.txt +++ b/krylov/CMakeLists.txt @@ -145,14 +145,14 @@ set_target_properties ( krylov SOVERSION ${PSBLAS_SO_VERSION} Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME krylov + OUTPUT_NAME psb_krylov ) set_target_properties( krylov_static PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME krylov_static + OUTPUT_NAME psb_krylov ) get_target_property(libkrylov_static krylov_static OUTPUT_NAME) diff --git a/prec/CMakeLists.txt b/prec/CMakeLists.txt index 313f3097f..1fd0a887d 100644 --- a/prec/CMakeLists.txt +++ b/prec/CMakeLists.txt @@ -161,14 +161,14 @@ set_target_properties ( prec SOVERSION ${PSBLAS_SO_VERSION} Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME prec + OUTPUT_NAME psb_prec ) set_target_properties( prec_static PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME prec_static + OUTPUT_NAME psb_prec ) get_target_property(libprec_static prec_static OUTPUT_NAME) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 07178d66c..d618497a8 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -133,14 +133,14 @@ set_target_properties ( util SOVERSION ${PSBLAS_SO_VERSION} Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME util + OUTPUT_NAME psb_util ) set_target_properties( util_static PROPERTIES SOVERSION ${PSBLAS_SO_VERSION} Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME util_static + OUTPUT_NAME psb_util ) get_target_property(libutil_static util_static OUTPUT_NAME) From c171e9addbbcbc3b675626970b97b1a05e45ea99 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Thu, 14 Dec 2017 16:40:49 -0800 Subject: [PATCH 15/48] WIP: Add test subdirectory; tests fail to link --- CMakeLists.txt | 2 +- test/CMakeLists.txt | 94 ++++++++++++++++++++++++++++++++++++ test/fileread/CMakeLists.txt | 11 +++++ test/hello/CMakeLists.txt | 7 +++ test/kernel/CMakeLists.txt | 9 ++++ test/pargen/CMakeLists.txt | 11 +++++ test/serial/CMakeLists.txt | 8 +++ test/torture/CMakeLists.txt | 11 +++++ test/util/CMakeLists.txt | 11 +++++ 9 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 test/CMakeLists.txt create mode 100644 test/fileread/CMakeLists.txt create mode 100644 test/hello/CMakeLists.txt create mode 100644 test/kernel/CMakeLists.txt create mode 100644 test/pargen/CMakeLists.txt create mode 100644 test/serial/CMakeLists.txt create mode 100644 test/torture/CMakeLists.txt create mode 100644 test/util/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index b849e1338..31e39bc04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -610,7 +610,7 @@ add_definitions( -DHAVE_METIS_ -DLowerUnderscore -DPtr64Bits ) -set(directory_list base prec krylov util) # TODO: add cbind +set(directory_list base prec krylov util test) # TODO: add cbind foreach(directory ${directory_list}) add_subdirectory("${directory}") endforeach() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000..a21d76983 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,94 @@ +if (NOT MPI_C_FOUND) + find_package(MPI REQUIRED) + + set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) + set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) + set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) + set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) + include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) +endif() + +if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") + set(gfortran_compiler true) +endif() + +include(CheckIncludeFile) +CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) +if(NOT HAVE_ALLOCA) + add_definitions(-DALLOCA_MISSING) + message(WARNING "Could not find . Assuming functionality is provided elsewhere.") +endif() + +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") +if(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +else() + set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) +endif() +set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") +if(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) +else() + set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) +endif() + +set(MPI_HEADERS mpi.h) +include(CheckIncludeFiles) +CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) +if(HAVE_MPI_EXT) + add_definitions(-DHAVE_MPI_EXT_H) + set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) +endif() + +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) +set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) +set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) + +#--------------------------------------------------- +# Windows Intel MPI compatibility, see GH issue #435 +#--------------------------------------------------- +set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") +if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) +else() + set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) +endif() +CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) + +include(CheckSymbolExists) +CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) +if(HAVE_Intel_MPI AND WIN32) + add_definitions(-DUSE_GCC) +endif() +set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) + +set(PSBLAS_SO_VERSION 0) +if(gfortran_compiler) + if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) + set(PSBLAS_SO_VERSION 2) + elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) + set(PSBLAS_SO_VERSION 1) + endif() +endif() + +set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") +set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") +set(MPI_LIBS "") +foreach( lib IN LISTS MPI_Fortran_LIBRARIES) + set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +endforeach() +string(STRIP "${MPI_LIBS}" MPI_LIBS) + +set(directory_list fileread hello kernel pargen torture util) +if (SERIAL_MPI) + set(directory_list ${directory_list} serial) +endif() +foreach(directory ${directory_list}) + add_subdirectory("${directory}") +endforeach() diff --git a/test/fileread/CMakeLists.txt b/test/fileread/CMakeLists.txt new file mode 100644 index 000000000..4362687d0 --- /dev/null +++ b/test/fileread/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") + +add_executable(psb_cf_sample psb_cf_sample.f90 getp.f90) +add_executable(psb_df_sample psb_df_sample.f90 getp.f90) +add_executable(psb_sf_sample psb_sf_sample.f90 getp.f90) +add_executable(psb_zf_sample psb_zf_sample.f90 getp.f90) + +target_link_libraries(psb_cf_sample krylov util base) +target_link_libraries(psb_df_sample krylov util base) +target_link_libraries(psb_sf_sample krylov util base) +target_link_libraries(psb_zf_sample krylov util base) diff --git a/test/hello/CMakeLists.txt b/test/hello/CMakeLists.txt new file mode 100644 index 000000000..e3884fad3 --- /dev/null +++ b/test/hello/CMakeLists.txt @@ -0,0 +1,7 @@ +include_directories("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") + +add_executable(hello hello.f90) +add_executable(pingpong pingpong.f90) + +target_link_libraries(hello base) +target_link_libraries(pingpong base) diff --git a/test/kernel/CMakeLists.txt b/test/kernel/CMakeLists.txt new file mode 100644 index 000000000..f80eff8b7 --- /dev/null +++ b/test/kernel/CMakeLists.txt @@ -0,0 +1,9 @@ +include_directories("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") + +add_executable(d_file_spmv d_file_spmv.f90) +add_executable(pdgenspmv pdgenspmv.f90) +add_executable(s_file_spmv s_file_spmv.f90) + +target_link_libraries(d_file_spmv util) +target_link_libraries(pdgenspmv util) +target_link_libraries(s_file_spmv util) diff --git a/test/pargen/CMakeLists.txt b/test/pargen/CMakeLists.txt new file mode 100644 index 000000000..443c1f6ef --- /dev/null +++ b/test/pargen/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") + +add_executable(psb_d_pde2d psb_d_pde2d.f90) +add_executable(psb_d_pde3d psb_d_pde3d.f90) +add_executable(psb_s_pde2d psb_s_pde2d.f90) +add_executable(psb_s_pde3d psb_s_pde3d.f90) + +target_link_libraries(psb_d_pde2d krylov util) +target_link_libraries(psb_d_pde3d krylov util) +target_link_libraries(psb_s_pde2d krylov util) +target_link_libraries(psb_s_pde3d krylov util) diff --git a/test/serial/CMakeLists.txt b/test/serial/CMakeLists.txt new file mode 100644 index 000000000..3556f8b39 --- /dev/null +++ b/test/serial/CMakeLists.txt @@ -0,0 +1,8 @@ +include_directories("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") + +add_executable( d_matgen + psb_d_xyz_impl.f90 + psb_d_xyz_mat_mod.f90 + d_matgen.F90 # Main program +) +target_link_libraries(d_matgen base) diff --git a/test/torture/CMakeLists.txt b/test/torture/CMakeLists.txt new file mode 100644 index 000000000..7c5c27517 --- /dev/null +++ b/test/torture/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") + +add_executable(fortran_interface_test + psb_c_mvsv_tester.f90 + psb_d_mvsv_tester.f90 + psb_mvsv_tester.f90 + psb_s_mvsv_tester.f90 + psbtf.f90 # Main program + psb_z_mvsv_tester.f90 +) +target_link_libraries(fortran_interface_test base) diff --git a/test/util/CMakeLists.txt b/test/util/CMakeLists.txt new file mode 100644 index 000000000..a38e54c2a --- /dev/null +++ b/test/util/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") + +add_executable(dhb2mm dhb2mm.f90) +add_executable(dmm2hb dmm2hb.f90) +add_executable(zhb2mm zhb2mm.f90) +add_executable(zmm2hb zmm2hb.f90) + +target_link_libraries(dhb2mm util) +target_link_libraries(dmm2hb util) +target_link_libraries(zhb2mm util) +target_link_libraries(zmm2hb util) From 5a582ac16f3a8ba04d646d4ab8d8b985517f3b44 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Mon, 18 Dec 2017 17:45:21 -0500 Subject: [PATCH 16/48] Only build static OR shared libs - Use canonical -DBUILD_SHARED_LIBS=TRUE (CMake) --- base/CMakeLists.txt | 19 +------------------ krylov/CMakeLists.txt | 18 +----------------- prec/CMakeLists.txt | 19 ++----------------- util/CMakeLists.txt | 18 +----------------- 4 files changed, 5 insertions(+), 69 deletions(-) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 5e543441c..f0fd66ea3 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -448,8 +448,7 @@ if (SERIAL_MPI) set(base_source_files ${base_source_files} modules/fakempi.c) endif() -add_library(base SHARED ${base_source_files}) -add_library(base_static STATIC ${base_source_files}) +add_library(base ${base_source_files}) set_target_properties(base PROPERTIES @@ -458,29 +457,13 @@ set_target_properties(base SOVERSION ${PSBLAS_SO_VERSION} OUTPUT_NAME psb_base ) -set_target_properties(base_static - PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - SOVERSION ${PSBLAS_SO_VERSION} - OUTPUT_NAME psb_base -) target_link_libraries(base PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) -target_link_libraries(base_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") -get_target_property(libbase_static base_static OUTPUT_NAME) -set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libbase_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") - install(TARGETS base EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) -install(TARGETS base_static - EXPORT PSBLAS_Targets - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) diff --git a/krylov/CMakeLists.txt b/krylov/CMakeLists.txt index 6bab1b0f0..7316066eb 100644 --- a/krylov/CMakeLists.txt +++ b/krylov/CMakeLists.txt @@ -131,11 +131,9 @@ psb_zkrylov.f90 psb_zrgmres.f90 ) -add_library(krylov SHARED ${krylov_source_files}) -add_library(krylov_static STATIC ${krylov_source_files}) +add_library(krylov ${krylov_source_files}) target_link_libraries(krylov PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec) -target_link_libraries(krylov_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec_static) install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") @@ -147,22 +145,8 @@ set_target_properties ( krylov POSITION_INDEPENDENT_CODE TRUE OUTPUT_NAME psb_krylov ) -set_target_properties( krylov_static - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME psb_krylov -) - -get_target_property(libkrylov_static krylov_static OUTPUT_NAME) -set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libkrylov_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") install(TARGETS krylov EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) -install(TARGETS krylov_static EXPORT PSBLAS_Targets - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) diff --git a/prec/CMakeLists.txt b/prec/CMakeLists.txt index 1fd0a887d..a34af9c1c 100644 --- a/prec/CMakeLists.txt +++ b/prec/CMakeLists.txt @@ -147,11 +147,10 @@ set(prec_source_files ./psb_d_base_prec_mod.f90 ) -add_library(prec SHARED ${prec_source_files}) -add_library(prec_static STATIC ${prec_source_files}) +add_library(prec ${prec_source_files}) + target_link_libraries(prec PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) -target_link_libraries(prec_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base_static) install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") @@ -163,22 +162,8 @@ set_target_properties ( prec POSITION_INDEPENDENT_CODE TRUE OUTPUT_NAME psb_prec ) -set_target_properties( prec_static - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME psb_prec -) - -get_target_property(libprec_static prec_static OUTPUT_NAME) -set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libprec_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") install(TARGETS prec EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) -install(TARGETS prec_static EXPORT PSBLAS_Targets - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index d618497a8..201b836ad 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -119,11 +119,9 @@ psb_z_mmio_impl.f90 psb_z_renum_impl.F90 ) -add_library(util SHARED ${util_source_files}) -add_library(util_static STATIC ${util_source_files}) +add_library(util ${util_source_files}) target_link_libraries(util PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) -target_link_libraries(util_static PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base_static) install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") @@ -135,22 +133,8 @@ set_target_properties ( util POSITION_INDEPENDENT_CODE TRUE OUTPUT_NAME psb_util ) -set_target_properties( util_static - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME psb_util -) - -get_target_property(libutil_static util_static OUTPUT_NAME) -set(PSBLAS_LIBS "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${libutil_static}${CMAKE_STATIC_LIBRARY_SUFFIX}") install(TARGETS util EXPORT PSBLAS_Targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) -install(TARGETS util_static EXPORT PSBLAS_Targets - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) From 2ec9106309ebb026f5acdaee9625f6a941b3f92b Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Mon, 18 Dec 2017 18:17:37 -0500 Subject: [PATCH 17/48] Build a smaller subset of tests - I think there is some special stuff that needs to happen to get the others working --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a21d76983..93464741a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -85,7 +85,7 @@ foreach( lib IN LISTS MPI_Fortran_LIBRARIES) endforeach() string(STRIP "${MPI_LIBS}" MPI_LIBS) -set(directory_list fileread hello kernel pargen torture util) +set(directory_list hello )#fileread hello kernel pargen torture util) if (SERIAL_MPI) set(directory_list ${directory_list} serial) endif() From fe2569ecc5441f45755f41d4b1222be36d9122d4 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Tue, 2 Jan 2018 09:42:16 -0500 Subject: [PATCH 18/48] mv aux->auxil for windows & abstract/trim buildsys --- .VERSION | 3 +- .gitattributes | 33 ++ CMakeLists.txt | 325 ++++-------------- Changelog | 2 + base/CMakeLists.txt | 30 +- base/modules/Makefile | 52 +-- .../modules/{aux => auxil}/psb_c_sort_mod.f90 | 0 .../modules/{aux => auxil}/psb_d_sort_mod.f90 | 0 base/modules/{aux => auxil}/psb_hash_mod.f90 | 0 .../modules/{aux => auxil}/psb_i_sort_mod.f90 | 0 .../{aux => auxil}/psb_ip_reord_mod.f90 | 0 .../modules/{aux => auxil}/psb_s_sort_mod.f90 | 0 base/modules/{aux => auxil}/psb_sort_mod.f90 | 0 .../modules/{aux => auxil}/psb_string_mod.f90 | 0 .../modules/{aux => auxil}/psb_z_sort_mod.f90 | 0 .../{aux => auxil}/psi_c_serial_mod.f90 | 0 .../{aux => auxil}/psi_d_serial_mod.f90 | 0 .../{aux => auxil}/psi_i_serial_mod.f90 | 0 .../{aux => auxil}/psi_s_serial_mod.f90 | 0 .../modules/{aux => auxil}/psi_serial_mod.f90 | 0 .../{aux => auxil}/psi_z_serial_mod.f90 | 0 cmake/AddInstallationScriptTest.cmake | 14 - cmake/pkg/PSBLASConfig.cmake.in | 18 +- cmake/setVersion.cmake | 90 +++++ 24 files changed, 252 insertions(+), 315 deletions(-) create mode 100644 .gitattributes rename base/modules/{aux => auxil}/psb_c_sort_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_d_sort_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_hash_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_i_sort_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_ip_reord_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_s_sort_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_sort_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_string_mod.f90 (100%) rename base/modules/{aux => auxil}/psb_z_sort_mod.f90 (100%) rename base/modules/{aux => auxil}/psi_c_serial_mod.f90 (100%) rename base/modules/{aux => auxil}/psi_d_serial_mod.f90 (100%) rename base/modules/{aux => auxil}/psi_i_serial_mod.f90 (100%) rename base/modules/{aux => auxil}/psi_s_serial_mod.f90 (100%) rename base/modules/{aux => auxil}/psi_serial_mod.f90 (100%) rename base/modules/{aux => auxil}/psi_z_serial_mod.f90 (100%) delete mode 100644 cmake/AddInstallationScriptTest.cmake create mode 100644 cmake/setVersion.cmake diff --git a/.VERSION b/.VERSION index 026477da9..c805380c6 100644 --- a/.VERSION +++ b/.VERSION @@ -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$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..8ee3e4fea --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 31e39bc04..7e533ae75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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__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 " - FULL_DOCS "Property to mark executable targets run as tests that they require at least images to run" + PROPERTY MIN_RANKS + BRIEF_DOCS "Minimum allowable ranks for the test " + FULL_DOCS "Property to mark executable targets run as tests that they require at least 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 ) diff --git a/Changelog b/Changelog index 49cb9d172..3b9e103b0 100644 --- a/Changelog +++ b/Changelog @@ -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 diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index f0fd66ea3..fb5ce5e75 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -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 diff --git a/base/modules/Makefile b/base/modules/Makefile index ec53f942c..cde7ee900 100644 --- a/base/modules/Makefile +++ b/base/modules/Makefile @@ -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 diff --git a/base/modules/aux/psb_c_sort_mod.f90 b/base/modules/auxil/psb_c_sort_mod.f90 similarity index 100% rename from base/modules/aux/psb_c_sort_mod.f90 rename to base/modules/auxil/psb_c_sort_mod.f90 diff --git a/base/modules/aux/psb_d_sort_mod.f90 b/base/modules/auxil/psb_d_sort_mod.f90 similarity index 100% rename from base/modules/aux/psb_d_sort_mod.f90 rename to base/modules/auxil/psb_d_sort_mod.f90 diff --git a/base/modules/aux/psb_hash_mod.f90 b/base/modules/auxil/psb_hash_mod.f90 similarity index 100% rename from base/modules/aux/psb_hash_mod.f90 rename to base/modules/auxil/psb_hash_mod.f90 diff --git a/base/modules/aux/psb_i_sort_mod.f90 b/base/modules/auxil/psb_i_sort_mod.f90 similarity index 100% rename from base/modules/aux/psb_i_sort_mod.f90 rename to base/modules/auxil/psb_i_sort_mod.f90 diff --git a/base/modules/aux/psb_ip_reord_mod.f90 b/base/modules/auxil/psb_ip_reord_mod.f90 similarity index 100% rename from base/modules/aux/psb_ip_reord_mod.f90 rename to base/modules/auxil/psb_ip_reord_mod.f90 diff --git a/base/modules/aux/psb_s_sort_mod.f90 b/base/modules/auxil/psb_s_sort_mod.f90 similarity index 100% rename from base/modules/aux/psb_s_sort_mod.f90 rename to base/modules/auxil/psb_s_sort_mod.f90 diff --git a/base/modules/aux/psb_sort_mod.f90 b/base/modules/auxil/psb_sort_mod.f90 similarity index 100% rename from base/modules/aux/psb_sort_mod.f90 rename to base/modules/auxil/psb_sort_mod.f90 diff --git a/base/modules/aux/psb_string_mod.f90 b/base/modules/auxil/psb_string_mod.f90 similarity index 100% rename from base/modules/aux/psb_string_mod.f90 rename to base/modules/auxil/psb_string_mod.f90 diff --git a/base/modules/aux/psb_z_sort_mod.f90 b/base/modules/auxil/psb_z_sort_mod.f90 similarity index 100% rename from base/modules/aux/psb_z_sort_mod.f90 rename to base/modules/auxil/psb_z_sort_mod.f90 diff --git a/base/modules/aux/psi_c_serial_mod.f90 b/base/modules/auxil/psi_c_serial_mod.f90 similarity index 100% rename from base/modules/aux/psi_c_serial_mod.f90 rename to base/modules/auxil/psi_c_serial_mod.f90 diff --git a/base/modules/aux/psi_d_serial_mod.f90 b/base/modules/auxil/psi_d_serial_mod.f90 similarity index 100% rename from base/modules/aux/psi_d_serial_mod.f90 rename to base/modules/auxil/psi_d_serial_mod.f90 diff --git a/base/modules/aux/psi_i_serial_mod.f90 b/base/modules/auxil/psi_i_serial_mod.f90 similarity index 100% rename from base/modules/aux/psi_i_serial_mod.f90 rename to base/modules/auxil/psi_i_serial_mod.f90 diff --git a/base/modules/aux/psi_s_serial_mod.f90 b/base/modules/auxil/psi_s_serial_mod.f90 similarity index 100% rename from base/modules/aux/psi_s_serial_mod.f90 rename to base/modules/auxil/psi_s_serial_mod.f90 diff --git a/base/modules/aux/psi_serial_mod.f90 b/base/modules/auxil/psi_serial_mod.f90 similarity index 100% rename from base/modules/aux/psi_serial_mod.f90 rename to base/modules/auxil/psi_serial_mod.f90 diff --git a/base/modules/aux/psi_z_serial_mod.f90 b/base/modules/auxil/psi_z_serial_mod.f90 similarity index 100% rename from base/modules/aux/psi_z_serial_mod.f90 rename to base/modules/auxil/psi_z_serial_mod.f90 diff --git a/cmake/AddInstallationScriptTest.cmake b/cmake/AddInstallationScriptTest.cmake deleted file mode 100644 index d6f7f9168..000000000 --- a/cmake/AddInstallationScriptTest.cmake +++ /dev/null @@ -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) diff --git a/cmake/pkg/PSBLASConfig.cmake.in b/cmake/pkg/PSBLASConfig.cmake.in index 93b403daa..02070671a 100644 --- a/cmake/pkg/PSBLASConfig.cmake.in +++ b/cmake/pkg/PSBLASConfig.cmake.in @@ -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@" ) + diff --git a/cmake/setVersion.cmake b/cmake/setVersion.cmake new file mode 100644 index 000000000..f79ee6195 --- /dev/null +++ b/cmake/setVersion.cmake @@ -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() From e5571d1b530cce1061989bdb49fd4cf4f565a6fc Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Tue, 2 Jan 2018 12:55:13 -0500 Subject: [PATCH 19/48] Fix CMake errors --- CMakeLists.txt | 3 ++- base/CMakeLists.txt | 2 +- cmake/pkg/{PSBLASConfig.cmake.in => psblasConfig.cmake.in} | 1 - krylov/CMakeLists.txt | 2 +- prec/CMakeLists.txt | 2 +- util/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename cmake/pkg/{PSBLASConfig.cmake.in => psblasConfig.cmake.in} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e533ae75..50300ebad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -336,7 +336,8 @@ write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake" VERSION "${psblas_VERSION}" COMPATIBILITY SameMajorVersion -) + ) + configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg/${CMAKE_PROJECT_NAME}Config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${CMAKE_PROJECT_NAME}Config.cmake" @ONLY) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index fb5ce5e75..cf8b8cad1 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -463,7 +463,7 @@ install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION FILES_MATCHING PATTERN "*.mod") install(TARGETS base - EXPORT PSBLAS_Targets + EXPORT ${CMAKE_PROJECT_NAME}-targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) diff --git a/cmake/pkg/PSBLASConfig.cmake.in b/cmake/pkg/psblasConfig.cmake.in similarity index 99% rename from cmake/pkg/PSBLASConfig.cmake.in rename to cmake/pkg/psblasConfig.cmake.in index 02070671a..3fe60345b 100644 --- a/cmake/pkg/PSBLASConfig.cmake.in +++ b/cmake/pkg/psblasConfig.cmake.in @@ -14,4 +14,3 @@ 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@" ) - diff --git a/krylov/CMakeLists.txt b/krylov/CMakeLists.txt index 7316066eb..eed33a90f 100644 --- a/krylov/CMakeLists.txt +++ b/krylov/CMakeLists.txt @@ -146,7 +146,7 @@ set_target_properties ( krylov OUTPUT_NAME psb_krylov ) -install(TARGETS krylov EXPORT PSBLAS_Targets +install(TARGETS krylov EXPORT ${CMAKE_PROJECT_NAME}-targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) diff --git a/prec/CMakeLists.txt b/prec/CMakeLists.txt index a34af9c1c..b007acf52 100644 --- a/prec/CMakeLists.txt +++ b/prec/CMakeLists.txt @@ -163,7 +163,7 @@ set_target_properties ( prec OUTPUT_NAME psb_prec ) -install(TARGETS prec EXPORT PSBLAS_Targets +install(TARGETS prec EXPORT ${CMAKE_PROJECT_NAME}-targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 201b836ad..747f8dcd2 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -134,7 +134,7 @@ set_target_properties ( util OUTPUT_NAME psb_util ) -install(TARGETS util EXPORT PSBLAS_Targets +install(TARGETS util EXPORT ${CMAKE_PROJECT_NAME}-targets DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) From dde3bb6cb662d986d9a7028e731c34e091560398 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Tue, 6 Feb 2018 16:03:16 -0500 Subject: [PATCH 20/48] White space changes only - Delete trainling white space - Use native line endings (hopefully) --- krylov/psb_cgcr.f90 | 740 ++++++++++++++++++++++---------------------- krylov/psb_dgcr.f90 | 740 ++++++++++++++++++++++---------------------- krylov/psb_sgcr.f90 | 740 ++++++++++++++++++++++---------------------- krylov/psb_zgcr.f90 | 740 ++++++++++++++++++++++---------------------- 4 files changed, 1476 insertions(+), 1484 deletions(-) diff --git a/krylov/psb_cgcr.f90 b/krylov/psb_cgcr.f90 index 76f581605..2d537bde7 100644 --- a/krylov/psb_cgcr.f90 +++ b/krylov/psb_cgcr.f90 @@ -1,371 +1,369 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006, 2010, 2015, 2017 -! Salvatore Filippone Cranfield University -! Alfredo Buttari CNRS-IRIT, Toulouse -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! File: psb_cgcr.f90 -!! -!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) -!! -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! C C -! C References: C -! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C -! C Level 3 basic linear algebra subprograms for sparse C -! C matrices: a user level interface C -! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C -! C C -! C C -! C [2] S. Filippone, M. Colajanni C -! C PSBLAS: A library for parallel linear algebra C -! C computation on sparse matrices C -! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C -! C C -! C [3] M. Arioli, I. Duff, M. Ruiz C -! C Stopping criteria for iterative solvers C -! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C -! C C -! C C -! C [4] R. Barrett et al C -! C Templates for the solution of linear systems C -! C SIAM, 1993 -! C C -! C [4] Notay, Yvan C -! C Aggregation-based algebraic multigrid method C -! C SIAM Journal on Scientific Computing 34, C -! C pp. A2288-A2316, 2012 C -! C C -! C C -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! File: psb_cgcr.f90 -! -! Subroutine: psb_cgcr -! This subroutine implements the GCR method. -! -! -! Arguments: -! -! a - type(psb_cspmat_type) Input: sparse matrix containing A. -! prec - class(psb_cprec_type) Input: preconditioner -! b(:) - real Input: vector containing the -! right hand side B -! x(:) - real Input/Output: vector containing the -! initial guess and final solution X. -! eps - real Input: Stopping tolerance; the iteration is -! stopped when the error estimate |err| <= eps -! desc_a - type(psb_desc_type). Input: The communication descriptor. -! info - integer. Output: Return code -! -! itmax - integer(optional) Input: maximum number of iterations to be -! performed. -! iter - integer(optional) Output: how many iterations have been -! performed. -! performed. -! err - real (optional) Output: error estimate on exit. If the -! denominator of the estimate is exactly -! 0, it is changed into 1. -! itrace - integer(optional) Input: print an informational message -! with the error estimate every itrace -! iterations -! istop - integer(optional) Input: stopping criterion, or how -! to estimate the error. -! 1: err = |r|/(|a||x|+|b|); here the iteration is -! stopped when |r| <= eps * (|a||x|+|b|) -! 2: err = |r|/|b|; here the iteration is -! stopped when |r| <= eps * |b| -! where r is the (preconditioned, recursive -! estimate of) residual. -! -! irst - integer(optional) Input: restart parameter -! - -subroutine psb_cgcr_vect(a,prec,b,x,eps,desc_a,info,& - & itmax,iter,err,itrace, irst, istop) - use psb_base_mod - use psb_prec_mod - use psb_c_krylov_conv_mod - use psb_krylov_mod - implicit none - - - type(psb_cspmat_type), intent(in) :: a - Type(psb_desc_type), Intent(in) :: desc_a - class(psb_cprec_type), intent(inout) :: prec - type(psb_c_vect_type), Intent(inout) :: b - type(psb_c_vect_type), Intent(inout) :: x - real(psb_spk_), Intent(in) :: eps - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop - integer(psb_ipk_), Optional, Intent(out) :: iter - real(psb_spk_), Optional, Intent(out) :: err - ! = local data - complex(psb_spk_), allocatable :: alpha(:), h(:,:) - type(psb_c_vect_type), allocatable :: z(:), c(:), c_scale(:) - type(psb_c_vect_type) :: r - - real(psb_dpk_) :: r_norm, b_norm, a_norm, derr - integer(psb_ipk_) :: n_col, mglob, naux, err_act - integer(psb_ipk_) :: debug_level, debug_unit - integer(psb_ipk_) :: np, me, ictxt - integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst - complex(psb_spk_) :: hjj - complex(psb_spk_), allocatable, target :: aux(:) - character(len=20) :: name - type(psb_itconv_type) :: stopdat - character(len=*), parameter :: methdname='GCR' - integer(psb_ipk_) ::int_err(5) - info = psb_success_ - name = 'psb_cgcr' - call psb_erractionsave(err_act) - debug_unit = psb_get_debug_unit() - debug_level = psb_get_debug_level() - - ictxt = desc_a%get_context() - - call psb_info(ictxt, me, np) - if (.not.allocated(b%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - if (.not.allocated(x%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - - mglob = desc_a%get_global_rows() - n_col = desc_a%get_local_cols() - - if (present(istop)) then - istop_ = istop - else - istop_ = 2 - endif - - ! - ! ISTOP_ = 1: Normwise backward error, infinity norm - ! ISTOP_ = 2: ||r||/||b||, 2-norm - ! - - if ((istop_ < 1 ).or.(istop_ > 2 ) ) then - info=psb_err_invalid_istop_ - int_err(1)=istop_ - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - - call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) - if (info == psb_success_)& - & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - call psb_errpush(info,name,a_err='psb_chkvect on X/B') - goto 9999 - end if - - if (present(itmax)) then - itmax_ = itmax - else - itmax_ = 1000 - endif - - if (present(itrace)) then - itrace_ = itrace - else - itrace_ = 0 - end if - - if (present(irst)) then - nl = irst - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' present: irst: ',irst,nl - else - nl = 10 - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' not present: irst: ',irst,nl - endif - - if (nl <=0 ) then - info=psb_err_invalid_istop_ - int_err(1)=nl - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - naux=4*n_col - allocate(aux(naux),h(nl+1,nl+1),& - &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) - - h = czero - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) - - do i =1,nl+1 - call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) - end do - - itx = 0 - - nrst = -1 - call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) - restart: do - if (itx>= itmax_) exit restart - h = czero - - it = 0 - ! compute r0 = b-ax0 - - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - - call psb_geaxpby(cone, b, czero, r, desc_a, info) - call psb_spmm(-cone,a,x,cone,r,desc_a,info,work=aux) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - nrst = nrst + 1 - - iteration: do - - itx = itx + 1 - it = it + 1 - j = it - !Apply preconditioner - call prec%apply(r,z(j),desc_a,info,work=aux) - - call psb_spmm(cone,a,z(j),czero,c(1),desc_a,info,work=aux) - do i =1, j - 1 - - h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) - - call psb_geaxpby(cone, c(i), czero, c(i+1), desc_a, info) - call psb_geaxpby(-h(i,j), c_scale(i), cone, c(i+1), desc_a, info) - end do - - h(j,j) = psb_norm2(c(j), desc_a, info) - hjj = cone/h(j,j) - call psb_geaxpby(hjj, c(j), czero, c_scale(j), desc_a, info) - - alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) - - !Update residual - call psb_geaxpby(cone, r, czero, r, desc_a, info) - call psb_geaxpby(-alpha(j), c_scale(j), cone, r, desc_a, info) - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - if (j >= irst) exit iteration - - - end do iteration - - m = j - - !Compute solution - - call ctrsm('l','u','n','n',m,1,cone,h,size(h,1),alpha,size(alpha,1)) - - if (nrst == 0 ) then - call x%set(czero) - endif - do i=1,m - call psb_geaxpby(alpha(i), z(i), cone, x, desc_a, info) - enddo - - - - - end do restart - m = j - !Compute solution - call ctrsm('l','u','n','n',m,1,cone,h,size(h,1),alpha,size(alpha,1)) - call x%set(czero) - do i=1,m - call psb_geaxpby(alpha(i), z(i), cone, x, desc_a, info) - enddo - - iter = j - - call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) - if (present(err)) err = derr - - if (info == psb_success_) call psb_gefree(r,desc_a,info) - - do j = 1,m - if (info == psb_success_) call psb_gefree(z(j),desc_a,info) - if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) - enddo - - do i =1,nl+1 - if (info == psb_success_) call psb_gefree(c(i),desc_a,info) - end do - - if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - if (err_act.eq.psb_act_abort_) then - call psb_error() - return - end if - - return -end subroutine psb_cgcr_vect - - +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006, 2010, 2015, 2017 +! Salvatore Filippone Cranfield University +! Alfredo Buttari CNRS-IRIT, Toulouse +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_cgcr.f90 +!! +!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) +!! +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! C C +! C References: C +! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C +! C Level 3 basic linear algebra subprograms for sparse C +! C matrices: a user level interface C +! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C +! C C +! C C +! C [2] S. Filippone, M. Colajanni C +! C PSBLAS: A library for parallel linear algebra C +! C computation on sparse matrices C +! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C +! C C +! C [3] M. Arioli, I. Duff, M. Ruiz C +! C Stopping criteria for iterative solvers C +! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C +! C C +! C C +! C [4] R. Barrett et al C +! C Templates for the solution of linear systems C +! C SIAM, 1993 +! C C +! C [4] Notay, Yvan C +! C Aggregation-based algebraic multigrid method C +! C SIAM Journal on Scientific Computing 34, C +! C pp. A2288-A2316, 2012 C +! C C +! C C +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! File: psb_cgcr.f90 +! +! Subroutine: psb_cgcr +! This subroutine implements the GCR method. +! +! +! Arguments: +! +! a - type(psb_cspmat_type) Input: sparse matrix containing A. +! prec - class(psb_cprec_type) Input: preconditioner +! b(:) - real Input: vector containing the +! right hand side B +! x(:) - real Input/Output: vector containing the +! initial guess and final solution X. +! eps - real Input: Stopping tolerance; the iteration is +! stopped when the error estimate |err| <= eps +! desc_a - type(psb_desc_type). Input: The communication descriptor. +! info - integer. Output: Return code +! +! itmax - integer(optional) Input: maximum number of iterations to be +! performed. +! iter - integer(optional) Output: how many iterations have been +! performed. +! performed. +! err - real (optional) Output: error estimate on exit. If the +! denominator of the estimate is exactly +! 0, it is changed into 1. +! itrace - integer(optional) Input: print an informational message +! with the error estimate every itrace +! iterations +! istop - integer(optional) Input: stopping criterion, or how +! to estimate the error. +! 1: err = |r|/(|a||x|+|b|); here the iteration is +! stopped when |r| <= eps * (|a||x|+|b|) +! 2: err = |r|/|b|; here the iteration is +! stopped when |r| <= eps * |b| +! where r is the (preconditioned, recursive +! estimate of) residual. +! +! irst - integer(optional) Input: restart parameter +! + +subroutine psb_cgcr_vect(a,prec,b,x,eps,desc_a,info,& + & itmax,iter,err,itrace, irst, istop) + use psb_base_mod + use psb_prec_mod + use psb_c_krylov_conv_mod + use psb_krylov_mod + implicit none + + + type(psb_cspmat_type), intent(in) :: a + Type(psb_desc_type), Intent(in) :: desc_a + class(psb_cprec_type), intent(inout) :: prec + type(psb_c_vect_type), Intent(inout) :: b + type(psb_c_vect_type), Intent(inout) :: x + real(psb_spk_), Intent(in) :: eps + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop + integer(psb_ipk_), Optional, Intent(out) :: iter + real(psb_spk_), Optional, Intent(out) :: err + ! = local data + complex(psb_spk_), allocatable :: alpha(:), h(:,:) + type(psb_c_vect_type), allocatable :: z(:), c(:), c_scale(:) + type(psb_c_vect_type) :: r + + real(psb_dpk_) :: r_norm, b_norm, a_norm, derr + integer(psb_ipk_) :: n_col, mglob, naux, err_act + integer(psb_ipk_) :: debug_level, debug_unit + integer(psb_ipk_) :: np, me, ictxt + integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst + complex(psb_spk_) :: hjj + complex(psb_spk_), allocatable, target :: aux(:) + character(len=20) :: name + type(psb_itconv_type) :: stopdat + character(len=*), parameter :: methdname='GCR' + integer(psb_ipk_) ::int_err(5) + info = psb_success_ + name = 'psb_cgcr' + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ictxt = desc_a%get_context() + + call psb_info(ictxt, me, np) + if (.not.allocated(b%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + if (.not.allocated(x%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + + mglob = desc_a%get_global_rows() + n_col = desc_a%get_local_cols() + + if (present(istop)) then + istop_ = istop + else + istop_ = 2 + endif + + ! + ! ISTOP_ = 1: Normwise backward error, infinity norm + ! ISTOP_ = 2: ||r||/||b||, 2-norm + ! + + if ((istop_ < 1 ).or.(istop_ > 2 ) ) then + info=psb_err_invalid_istop_ + int_err(1)=istop_ + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + + call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) + if (info == psb_success_)& + & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) + if(info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='psb_chkvect on X/B') + goto 9999 + end if + + if (present(itmax)) then + itmax_ = itmax + else + itmax_ = 1000 + endif + + if (present(itrace)) then + itrace_ = itrace + else + itrace_ = 0 + end if + + if (present(irst)) then + nl = irst + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' present: irst: ',irst,nl + else + nl = 10 + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' not present: irst: ',irst,nl + endif + + if (nl <=0 ) then + info=psb_err_invalid_istop_ + int_err(1)=nl + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + naux=4*n_col + allocate(aux(naux),h(nl+1,nl+1),& + &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) + + h = czero + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) + + do i =1,nl+1 + call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) + end do + + itx = 0 + + nrst = -1 + call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) + restart: do + if (itx>= itmax_) exit restart + h = czero + + it = 0 + ! compute r0 = b-ax0 + + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + + call psb_geaxpby(cone, b, czero, r, desc_a, info) + call psb_spmm(-cone,a,x,cone,r,desc_a,info,work=aux) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + nrst = nrst + 1 + + iteration: do + + itx = itx + 1 + it = it + 1 + j = it + !Apply preconditioner + call prec%apply(r,z(j),desc_a,info,work=aux) + + call psb_spmm(cone,a,z(j),czero,c(1),desc_a,info,work=aux) + do i =1, j - 1 + + h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) + + call psb_geaxpby(cone, c(i), czero, c(i+1), desc_a, info) + call psb_geaxpby(-h(i,j), c_scale(i), cone, c(i+1), desc_a, info) + end do + + h(j,j) = psb_norm2(c(j), desc_a, info) + hjj = cone/h(j,j) + call psb_geaxpby(hjj, c(j), czero, c_scale(j), desc_a, info) + + alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) + + !Update residual + call psb_geaxpby(cone, r, czero, r, desc_a, info) + call psb_geaxpby(-alpha(j), c_scale(j), cone, r, desc_a, info) + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + if (j >= irst) exit iteration + + + end do iteration + + m = j + + !Compute solution + + call ctrsm('l','u','n','n',m,1,cone,h,size(h,1),alpha,size(alpha,1)) + + if (nrst == 0 ) then + call x%set(czero) + endif + do i=1,m + call psb_geaxpby(alpha(i), z(i), cone, x, desc_a, info) + enddo + + + + + end do restart + m = j + !Compute solution + call ctrsm('l','u','n','n',m,1,cone,h,size(h,1),alpha,size(alpha,1)) + call x%set(czero) + do i=1,m + call psb_geaxpby(alpha(i), z(i), cone, x, desc_a, info) + enddo + + iter = j + + call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) + if (present(err)) err = derr + + if (info == psb_success_) call psb_gefree(r,desc_a,info) + + do j = 1,m + if (info == psb_success_) call psb_gefree(z(j),desc_a,info) + if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) + enddo + + do i =1,nl+1 + if (info == psb_success_) call psb_gefree(c(i),desc_a,info) + end do + + if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_erractionrestore(err_act) + return + +9999 continue + call psb_erractionrestore(err_act) + if (err_act.eq.psb_act_abort_) then + call psb_error() + return + end if + + return +end subroutine psb_cgcr_vect diff --git a/krylov/psb_dgcr.f90 b/krylov/psb_dgcr.f90 index 7d90720a1..365684a31 100644 --- a/krylov/psb_dgcr.f90 +++ b/krylov/psb_dgcr.f90 @@ -1,371 +1,369 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006, 2010, 2015, 2017 -! Salvatore Filippone Cranfield University -! Alfredo Buttari CNRS-IRIT, Toulouse -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! File: psb_dgcr.f90 -!! -!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) -!! -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! C C -! C References: C -! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C -! C Level 3 basic linear algebra subprograms for sparse C -! C matrices: a user level interface C -! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C -! C C -! C C -! C [2] S. Filippone, M. Colajanni C -! C PSBLAS: A library for parallel linear algebra C -! C computation on sparse matrices C -! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C -! C C -! C [3] M. Arioli, I. Duff, M. Ruiz C -! C Stopping criteria for iterative solvers C -! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C -! C C -! C C -! C [4] R. Barrett et al C -! C Templates for the solution of linear systems C -! C SIAM, 1993 -! C C -! C [4] Notay, Yvan C -! C Aggregation-based algebraic multigrid method C -! C SIAM Journal on Scientific Computing 34, C -! C pp. A2288-A2316, 2012 C -! C C -! C C -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! File: psb_dgcr.f90 -! -! Subroutine: psb_dgcr -! This subroutine implements the GCR method. -! -! -! Arguments: -! -! a - type(psb_dspmat_type) Input: sparse matrix containing A. -! prec - class(psb_dprec_type) Input: preconditioner -! b(:) - real Input: vector containing the -! right hand side B -! x(:) - real Input/Output: vector containing the -! initial guess and final solution X. -! eps - real Input: Stopping tolerance; the iteration is -! stopped when the error estimate |err| <= eps -! desc_a - type(psb_desc_type). Input: The communication descriptor. -! info - integer. Output: Return code -! -! itmax - integer(optional) Input: maximum number of iterations to be -! performed. -! iter - integer(optional) Output: how many iterations have been -! performed. -! performed. -! err - real (optional) Output: error estimate on exit. If the -! denominator of the estimate is exactly -! 0, it is changed into 1. -! itrace - integer(optional) Input: print an informational message -! with the error estimate every itrace -! iterations -! istop - integer(optional) Input: stopping criterion, or how -! to estimate the error. -! 1: err = |r|/(|a||x|+|b|); here the iteration is -! stopped when |r| <= eps * (|a||x|+|b|) -! 2: err = |r|/|b|; here the iteration is -! stopped when |r| <= eps * |b| -! where r is the (preconditioned, recursive -! estimate of) residual. -! -! irst - integer(optional) Input: restart parameter -! - -subroutine psb_dgcr_vect(a,prec,b,x,eps,desc_a,info,& - & itmax,iter,err,itrace, irst, istop) - use psb_base_mod - use psb_prec_mod - use psb_d_krylov_conv_mod - use psb_krylov_mod - implicit none - - - type(psb_dspmat_type), intent(in) :: a - Type(psb_desc_type), Intent(in) :: desc_a - class(psb_dprec_type), intent(inout) :: prec - type(psb_d_vect_type), Intent(inout) :: b - type(psb_d_vect_type), Intent(inout) :: x - real(psb_dpk_), Intent(in) :: eps - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop - integer(psb_ipk_), Optional, Intent(out) :: iter - real(psb_dpk_), Optional, Intent(out) :: err - ! = local data - real(psb_dpk_), allocatable :: alpha(:), h(:,:) - type(psb_d_vect_type), allocatable :: z(:), c(:), c_scale(:) - type(psb_d_vect_type) :: r - - real(psb_dpk_) :: r_norm, b_norm, a_norm, derr - integer(psb_ipk_) :: n_col, mglob, naux, err_act - integer(psb_ipk_) :: debug_level, debug_unit - integer(psb_ipk_) :: np, me, ictxt - integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst - real(psb_dpk_) :: hjj - real(psb_dpk_), allocatable, target :: aux(:) - character(len=20) :: name - type(psb_itconv_type) :: stopdat - character(len=*), parameter :: methdname='GCR' - integer(psb_ipk_) ::int_err(5) - info = psb_success_ - name = 'psb_dgcr' - call psb_erractionsave(err_act) - debug_unit = psb_get_debug_unit() - debug_level = psb_get_debug_level() - - ictxt = desc_a%get_context() - - call psb_info(ictxt, me, np) - if (.not.allocated(b%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - if (.not.allocated(x%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - - mglob = desc_a%get_global_rows() - n_col = desc_a%get_local_cols() - - if (present(istop)) then - istop_ = istop - else - istop_ = 2 - endif - - ! - ! ISTOP_ = 1: Normwise backward error, infinity norm - ! ISTOP_ = 2: ||r||/||b||, 2-norm - ! - - if ((istop_ < 1 ).or.(istop_ > 2 ) ) then - info=psb_err_invalid_istop_ - int_err(1)=istop_ - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - - call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) - if (info == psb_success_)& - & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - call psb_errpush(info,name,a_err='psb_chkvect on X/B') - goto 9999 - end if - - if (present(itmax)) then - itmax_ = itmax - else - itmax_ = 1000 - endif - - if (present(itrace)) then - itrace_ = itrace - else - itrace_ = 0 - end if - - if (present(irst)) then - nl = irst - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' present: irst: ',irst,nl - else - nl = 10 - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' not present: irst: ',irst,nl - endif - - if (nl <=0 ) then - info=psb_err_invalid_istop_ - int_err(1)=nl - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - naux=4*n_col - allocate(aux(naux),h(nl+1,nl+1),& - &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) - - h = dzero - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) - - do i =1,nl+1 - call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) - end do - - itx = 0 - - nrst = -1 - call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) - restart: do - if (itx>= itmax_) exit restart - h = dzero - - it = 0 - ! compute r0 = b-ax0 - - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - - call psb_geaxpby(done, b, dzero, r, desc_a, info) - call psb_spmm(-done,a,x,done,r,desc_a,info,work=aux) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - nrst = nrst + 1 - - iteration: do - - itx = itx + 1 - it = it + 1 - j = it - !Apply preconditioner - call prec%apply(r,z(j),desc_a,info,work=aux) - - call psb_spmm(done,a,z(j),dzero,c(1),desc_a,info,work=aux) - do i =1, j - 1 - - h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) - - call psb_geaxpby(done, c(i), dzero, c(i+1), desc_a, info) - call psb_geaxpby(-h(i,j), c_scale(i), done, c(i+1), desc_a, info) - end do - - h(j,j) = psb_norm2(c(j), desc_a, info) - hjj = done/h(j,j) - call psb_geaxpby(hjj, c(j), dzero, c_scale(j), desc_a, info) - - alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) - - !Update residual - call psb_geaxpby(done, r, dzero, r, desc_a, info) - call psb_geaxpby(-alpha(j), c_scale(j), done, r, desc_a, info) - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - if (j >= irst) exit iteration - - - end do iteration - - m = j - - !Compute solution - - call dtrsm('l','u','n','n',m,1,done,h,size(h,1),alpha,size(alpha,1)) - - if (nrst == 0 ) then - call x%set(dzero) - endif - do i=1,m - call psb_geaxpby(alpha(i), z(i), done, x, desc_a, info) - enddo - - - - - end do restart - m = j - !Compute solution - call dtrsm('l','u','n','n',m,1,done,h,size(h,1),alpha,size(alpha,1)) - call x%set(dzero) - do i=1,m - call psb_geaxpby(alpha(i), z(i), done, x, desc_a, info) - enddo - - iter = j - - call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) - if (present(err)) err = derr - - if (info == psb_success_) call psb_gefree(r,desc_a,info) - - do j = 1,m - if (info == psb_success_) call psb_gefree(z(j),desc_a,info) - if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) - enddo - - do i =1,nl+1 - if (info == psb_success_) call psb_gefree(c(i),desc_a,info) - end do - - if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - if (err_act.eq.psb_act_abort_) then - call psb_error() - return - end if - - return -end subroutine psb_dgcr_vect - - +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006, 2010, 2015, 2017 +! Salvatore Filippone Cranfield University +! Alfredo Buttari CNRS-IRIT, Toulouse +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_dgcr.f90 +!! +!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) +!! +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! C C +! C References: C +! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C +! C Level 3 basic linear algebra subprograms for sparse C +! C matrices: a user level interface C +! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C +! C C +! C C +! C [2] S. Filippone, M. Colajanni C +! C PSBLAS: A library for parallel linear algebra C +! C computation on sparse matrices C +! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C +! C C +! C [3] M. Arioli, I. Duff, M. Ruiz C +! C Stopping criteria for iterative solvers C +! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C +! C C +! C C +! C [4] R. Barrett et al C +! C Templates for the solution of linear systems C +! C SIAM, 1993 +! C C +! C [4] Notay, Yvan C +! C Aggregation-based algebraic multigrid method C +! C SIAM Journal on Scientific Computing 34, C +! C pp. A2288-A2316, 2012 C +! C C +! C C +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! File: psb_dgcr.f90 +! +! Subroutine: psb_dgcr +! This subroutine implements the GCR method. +! +! +! Arguments: +! +! a - type(psb_dspmat_type) Input: sparse matrix containing A. +! prec - class(psb_dprec_type) Input: preconditioner +! b(:) - real Input: vector containing the +! right hand side B +! x(:) - real Input/Output: vector containing the +! initial guess and final solution X. +! eps - real Input: Stopping tolerance; the iteration is +! stopped when the error estimate |err| <= eps +! desc_a - type(psb_desc_type). Input: The communication descriptor. +! info - integer. Output: Return code +! +! itmax - integer(optional) Input: maximum number of iterations to be +! performed. +! iter - integer(optional) Output: how many iterations have been +! performed. +! performed. +! err - real (optional) Output: error estimate on exit. If the +! denominator of the estimate is exactly +! 0, it is changed into 1. +! itrace - integer(optional) Input: print an informational message +! with the error estimate every itrace +! iterations +! istop - integer(optional) Input: stopping criterion, or how +! to estimate the error. +! 1: err = |r|/(|a||x|+|b|); here the iteration is +! stopped when |r| <= eps * (|a||x|+|b|) +! 2: err = |r|/|b|; here the iteration is +! stopped when |r| <= eps * |b| +! where r is the (preconditioned, recursive +! estimate of) residual. +! +! irst - integer(optional) Input: restart parameter +! + +subroutine psb_dgcr_vect(a,prec,b,x,eps,desc_a,info,& + & itmax,iter,err,itrace, irst, istop) + use psb_base_mod + use psb_prec_mod + use psb_d_krylov_conv_mod + use psb_krylov_mod + implicit none + + + type(psb_dspmat_type), intent(in) :: a + Type(psb_desc_type), Intent(in) :: desc_a + class(psb_dprec_type), intent(inout) :: prec + type(psb_d_vect_type), Intent(inout) :: b + type(psb_d_vect_type), Intent(inout) :: x + real(psb_dpk_), Intent(in) :: eps + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop + integer(psb_ipk_), Optional, Intent(out) :: iter + real(psb_dpk_), Optional, Intent(out) :: err + ! = local data + real(psb_dpk_), allocatable :: alpha(:), h(:,:) + type(psb_d_vect_type), allocatable :: z(:), c(:), c_scale(:) + type(psb_d_vect_type) :: r + + real(psb_dpk_) :: r_norm, b_norm, a_norm, derr + integer(psb_ipk_) :: n_col, mglob, naux, err_act + integer(psb_ipk_) :: debug_level, debug_unit + integer(psb_ipk_) :: np, me, ictxt + integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst + real(psb_dpk_) :: hjj + real(psb_dpk_), allocatable, target :: aux(:) + character(len=20) :: name + type(psb_itconv_type) :: stopdat + character(len=*), parameter :: methdname='GCR' + integer(psb_ipk_) ::int_err(5) + info = psb_success_ + name = 'psb_dgcr' + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ictxt = desc_a%get_context() + + call psb_info(ictxt, me, np) + if (.not.allocated(b%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + if (.not.allocated(x%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + + mglob = desc_a%get_global_rows() + n_col = desc_a%get_local_cols() + + if (present(istop)) then + istop_ = istop + else + istop_ = 2 + endif + + ! + ! ISTOP_ = 1: Normwise backward error, infinity norm + ! ISTOP_ = 2: ||r||/||b||, 2-norm + ! + + if ((istop_ < 1 ).or.(istop_ > 2 ) ) then + info=psb_err_invalid_istop_ + int_err(1)=istop_ + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + + call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) + if (info == psb_success_)& + & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) + if(info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='psb_chkvect on X/B') + goto 9999 + end if + + if (present(itmax)) then + itmax_ = itmax + else + itmax_ = 1000 + endif + + if (present(itrace)) then + itrace_ = itrace + else + itrace_ = 0 + end if + + if (present(irst)) then + nl = irst + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' present: irst: ',irst,nl + else + nl = 10 + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' not present: irst: ',irst,nl + endif + + if (nl <=0 ) then + info=psb_err_invalid_istop_ + int_err(1)=nl + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + naux=4*n_col + allocate(aux(naux),h(nl+1,nl+1),& + &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) + + h = dzero + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) + + do i =1,nl+1 + call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) + end do + + itx = 0 + + nrst = -1 + call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) + restart: do + if (itx>= itmax_) exit restart + h = dzero + + it = 0 + ! compute r0 = b-ax0 + + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + + call psb_geaxpby(done, b, dzero, r, desc_a, info) + call psb_spmm(-done,a,x,done,r,desc_a,info,work=aux) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + nrst = nrst + 1 + + iteration: do + + itx = itx + 1 + it = it + 1 + j = it + !Apply preconditioner + call prec%apply(r,z(j),desc_a,info,work=aux) + + call psb_spmm(done,a,z(j),dzero,c(1),desc_a,info,work=aux) + do i =1, j - 1 + + h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) + + call psb_geaxpby(done, c(i), dzero, c(i+1), desc_a, info) + call psb_geaxpby(-h(i,j), c_scale(i), done, c(i+1), desc_a, info) + end do + + h(j,j) = psb_norm2(c(j), desc_a, info) + hjj = done/h(j,j) + call psb_geaxpby(hjj, c(j), dzero, c_scale(j), desc_a, info) + + alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) + + !Update residual + call psb_geaxpby(done, r, dzero, r, desc_a, info) + call psb_geaxpby(-alpha(j), c_scale(j), done, r, desc_a, info) + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + if (j >= irst) exit iteration + + + end do iteration + + m = j + + !Compute solution + + call dtrsm('l','u','n','n',m,1,done,h,size(h,1),alpha,size(alpha,1)) + + if (nrst == 0 ) then + call x%set(dzero) + endif + do i=1,m + call psb_geaxpby(alpha(i), z(i), done, x, desc_a, info) + enddo + + + + + end do restart + m = j + !Compute solution + call dtrsm('l','u','n','n',m,1,done,h,size(h,1),alpha,size(alpha,1)) + call x%set(dzero) + do i=1,m + call psb_geaxpby(alpha(i), z(i), done, x, desc_a, info) + enddo + + iter = j + + call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) + if (present(err)) err = derr + + if (info == psb_success_) call psb_gefree(r,desc_a,info) + + do j = 1,m + if (info == psb_success_) call psb_gefree(z(j),desc_a,info) + if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) + enddo + + do i =1,nl+1 + if (info == psb_success_) call psb_gefree(c(i),desc_a,info) + end do + + if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_erractionrestore(err_act) + return + +9999 continue + call psb_erractionrestore(err_act) + if (err_act.eq.psb_act_abort_) then + call psb_error() + return + end if + + return +end subroutine psb_dgcr_vect diff --git a/krylov/psb_sgcr.f90 b/krylov/psb_sgcr.f90 index 9bc81f709..23a9326ba 100644 --- a/krylov/psb_sgcr.f90 +++ b/krylov/psb_sgcr.f90 @@ -1,371 +1,369 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006, 2010, 2015, 2017 -! Salvatore Filippone Cranfield University -! Alfredo Buttari CNRS-IRIT, Toulouse -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! File: psb_sgcr.f90 -!! -!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) -!! -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! C C -! C References: C -! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C -! C Level 3 basic linear algebra subprograms for sparse C -! C matrices: a user level interface C -! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C -! C C -! C C -! C [2] S. Filippone, M. Colajanni C -! C PSBLAS: A library for parallel linear algebra C -! C computation on sparse matrices C -! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C -! C C -! C [3] M. Arioli, I. Duff, M. Ruiz C -! C Stopping criteria for iterative solvers C -! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C -! C C -! C C -! C [4] R. Barrett et al C -! C Templates for the solution of linear systems C -! C SIAM, 1993 -! C C -! C [4] Notay, Yvan C -! C Aggregation-based algebraic multigrid method C -! C SIAM Journal on Scientific Computing 34, C -! C pp. A2288-A2316, 2012 C -! C C -! C C -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! File: psb_sgcr.f90 -! -! Subroutine: psb_sgcr -! This subroutine implements the GCR method. -! -! -! Arguments: -! -! a - type(psb_sspmat_type) Input: sparse matrix containing A. -! prec - class(psb_sprec_type) Input: preconditioner -! b(:) - real Input: vector containing the -! right hand side B -! x(:) - real Input/Output: vector containing the -! initial guess and final solution X. -! eps - real Input: Stopping tolerance; the iteration is -! stopped when the error estimate |err| <= eps -! desc_a - type(psb_desc_type). Input: The communication descriptor. -! info - integer. Output: Return code -! -! itmax - integer(optional) Input: maximum number of iterations to be -! performed. -! iter - integer(optional) Output: how many iterations have been -! performed. -! performed. -! err - real (optional) Output: error estimate on exit. If the -! denominator of the estimate is exactly -! 0, it is changed into 1. -! itrace - integer(optional) Input: print an informational message -! with the error estimate every itrace -! iterations -! istop - integer(optional) Input: stopping criterion, or how -! to estimate the error. -! 1: err = |r|/(|a||x|+|b|); here the iteration is -! stopped when |r| <= eps * (|a||x|+|b|) -! 2: err = |r|/|b|; here the iteration is -! stopped when |r| <= eps * |b| -! where r is the (preconditioned, recursive -! estimate of) residual. -! -! irst - integer(optional) Input: restart parameter -! - -subroutine psb_sgcr_vect(a,prec,b,x,eps,desc_a,info,& - & itmax,iter,err,itrace, irst, istop) - use psb_base_mod - use psb_prec_mod - use psb_s_krylov_conv_mod - use psb_krylov_mod - implicit none - - - type(psb_sspmat_type), intent(in) :: a - Type(psb_desc_type), Intent(in) :: desc_a - class(psb_sprec_type), intent(inout) :: prec - type(psb_s_vect_type), Intent(inout) :: b - type(psb_s_vect_type), Intent(inout) :: x - real(psb_spk_), Intent(in) :: eps - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop - integer(psb_ipk_), Optional, Intent(out) :: iter - real(psb_spk_), Optional, Intent(out) :: err - ! = local data - real(psb_spk_), allocatable :: alpha(:), h(:,:) - type(psb_s_vect_type), allocatable :: z(:), c(:), c_scale(:) - type(psb_s_vect_type) :: r - - real(psb_dpk_) :: r_norm, b_norm, a_norm, derr - integer(psb_ipk_) :: n_col, mglob, naux, err_act - integer(psb_ipk_) :: debug_level, debug_unit - integer(psb_ipk_) :: np, me, ictxt - integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst - real(psb_spk_) :: hjj - real(psb_spk_), allocatable, target :: aux(:) - character(len=20) :: name - type(psb_itconv_type) :: stopdat - character(len=*), parameter :: methdname='GCR' - integer(psb_ipk_) ::int_err(5) - info = psb_success_ - name = 'psb_sgcr' - call psb_erractionsave(err_act) - debug_unit = psb_get_debug_unit() - debug_level = psb_get_debug_level() - - ictxt = desc_a%get_context() - - call psb_info(ictxt, me, np) - if (.not.allocated(b%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - if (.not.allocated(x%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - - mglob = desc_a%get_global_rows() - n_col = desc_a%get_local_cols() - - if (present(istop)) then - istop_ = istop - else - istop_ = 2 - endif - - ! - ! ISTOP_ = 1: Normwise backward error, infinity norm - ! ISTOP_ = 2: ||r||/||b||, 2-norm - ! - - if ((istop_ < 1 ).or.(istop_ > 2 ) ) then - info=psb_err_invalid_istop_ - int_err(1)=istop_ - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - - call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) - if (info == psb_success_)& - & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - call psb_errpush(info,name,a_err='psb_chkvect on X/B') - goto 9999 - end if - - if (present(itmax)) then - itmax_ = itmax - else - itmax_ = 1000 - endif - - if (present(itrace)) then - itrace_ = itrace - else - itrace_ = 0 - end if - - if (present(irst)) then - nl = irst - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' present: irst: ',irst,nl - else - nl = 10 - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' not present: irst: ',irst,nl - endif - - if (nl <=0 ) then - info=psb_err_invalid_istop_ - int_err(1)=nl - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - naux=4*n_col - allocate(aux(naux),h(nl+1,nl+1),& - &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) - - h = szero - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) - - do i =1,nl+1 - call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) - end do - - itx = 0 - - nrst = -1 - call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) - restart: do - if (itx>= itmax_) exit restart - h = szero - - it = 0 - ! compute r0 = b-ax0 - - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - - call psb_geaxpby(sone, b, szero, r, desc_a, info) - call psb_spmm(-sone,a,x,sone,r,desc_a,info,work=aux) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - nrst = nrst + 1 - - iteration: do - - itx = itx + 1 - it = it + 1 - j = it - !Apply preconditioner - call prec%apply(r,z(j),desc_a,info,work=aux) - - call psb_spmm(sone,a,z(j),szero,c(1),desc_a,info,work=aux) - do i =1, j - 1 - - h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) - - call psb_geaxpby(sone, c(i), szero, c(i+1), desc_a, info) - call psb_geaxpby(-h(i,j), c_scale(i), sone, c(i+1), desc_a, info) - end do - - h(j,j) = psb_norm2(c(j), desc_a, info) - hjj = sone/h(j,j) - call psb_geaxpby(hjj, c(j), szero, c_scale(j), desc_a, info) - - alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) - - !Update residual - call psb_geaxpby(sone, r, szero, r, desc_a, info) - call psb_geaxpby(-alpha(j), c_scale(j), sone, r, desc_a, info) - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - if (j >= irst) exit iteration - - - end do iteration - - m = j - - !Compute solution - - call strsm('l','u','n','n',m,1,sone,h,size(h,1),alpha,size(alpha,1)) - - if (nrst == 0 ) then - call x%set(szero) - endif - do i=1,m - call psb_geaxpby(alpha(i), z(i), sone, x, desc_a, info) - enddo - - - - - end do restart - m = j - !Compute solution - call strsm('l','u','n','n',m,1,sone,h,size(h,1),alpha,size(alpha,1)) - call x%set(szero) - do i=1,m - call psb_geaxpby(alpha(i), z(i), sone, x, desc_a, info) - enddo - - iter = j - - call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) - if (present(err)) err = derr - - if (info == psb_success_) call psb_gefree(r,desc_a,info) - - do j = 1,m - if (info == psb_success_) call psb_gefree(z(j),desc_a,info) - if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) - enddo - - do i =1,nl+1 - if (info == psb_success_) call psb_gefree(c(i),desc_a,info) - end do - - if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - if (err_act.eq.psb_act_abort_) then - call psb_error() - return - end if - - return -end subroutine psb_sgcr_vect - - +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006, 2010, 2015, 2017 +! Salvatore Filippone Cranfield University +! Alfredo Buttari CNRS-IRIT, Toulouse +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_sgcr.f90 +!! +!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) +!! +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! C C +! C References: C +! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C +! C Level 3 basic linear algebra subprograms for sparse C +! C matrices: a user level interface C +! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C +! C C +! C C +! C [2] S. Filippone, M. Colajanni C +! C PSBLAS: A library for parallel linear algebra C +! C computation on sparse matrices C +! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C +! C C +! C [3] M. Arioli, I. Duff, M. Ruiz C +! C Stopping criteria for iterative solvers C +! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C +! C C +! C C +! C [4] R. Barrett et al C +! C Templates for the solution of linear systems C +! C SIAM, 1993 +! C C +! C [4] Notay, Yvan C +! C Aggregation-based algebraic multigrid method C +! C SIAM Journal on Scientific Computing 34, C +! C pp. A2288-A2316, 2012 C +! C C +! C C +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! File: psb_sgcr.f90 +! +! Subroutine: psb_sgcr +! This subroutine implements the GCR method. +! +! +! Arguments: +! +! a - type(psb_sspmat_type) Input: sparse matrix containing A. +! prec - class(psb_sprec_type) Input: preconditioner +! b(:) - real Input: vector containing the +! right hand side B +! x(:) - real Input/Output: vector containing the +! initial guess and final solution X. +! eps - real Input: Stopping tolerance; the iteration is +! stopped when the error estimate |err| <= eps +! desc_a - type(psb_desc_type). Input: The communication descriptor. +! info - integer. Output: Return code +! +! itmax - integer(optional) Input: maximum number of iterations to be +! performed. +! iter - integer(optional) Output: how many iterations have been +! performed. +! performed. +! err - real (optional) Output: error estimate on exit. If the +! denominator of the estimate is exactly +! 0, it is changed into 1. +! itrace - integer(optional) Input: print an informational message +! with the error estimate every itrace +! iterations +! istop - integer(optional) Input: stopping criterion, or how +! to estimate the error. +! 1: err = |r|/(|a||x|+|b|); here the iteration is +! stopped when |r| <= eps * (|a||x|+|b|) +! 2: err = |r|/|b|; here the iteration is +! stopped when |r| <= eps * |b| +! where r is the (preconditioned, recursive +! estimate of) residual. +! +! irst - integer(optional) Input: restart parameter +! + +subroutine psb_sgcr_vect(a,prec,b,x,eps,desc_a,info,& + & itmax,iter,err,itrace, irst, istop) + use psb_base_mod + use psb_prec_mod + use psb_s_krylov_conv_mod + use psb_krylov_mod + implicit none + + + type(psb_sspmat_type), intent(in) :: a + Type(psb_desc_type), Intent(in) :: desc_a + class(psb_sprec_type), intent(inout) :: prec + type(psb_s_vect_type), Intent(inout) :: b + type(psb_s_vect_type), Intent(inout) :: x + real(psb_spk_), Intent(in) :: eps + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop + integer(psb_ipk_), Optional, Intent(out) :: iter + real(psb_spk_), Optional, Intent(out) :: err + ! = local data + real(psb_spk_), allocatable :: alpha(:), h(:,:) + type(psb_s_vect_type), allocatable :: z(:), c(:), c_scale(:) + type(psb_s_vect_type) :: r + + real(psb_dpk_) :: r_norm, b_norm, a_norm, derr + integer(psb_ipk_) :: n_col, mglob, naux, err_act + integer(psb_ipk_) :: debug_level, debug_unit + integer(psb_ipk_) :: np, me, ictxt + integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst + real(psb_spk_) :: hjj + real(psb_spk_), allocatable, target :: aux(:) + character(len=20) :: name + type(psb_itconv_type) :: stopdat + character(len=*), parameter :: methdname='GCR' + integer(psb_ipk_) ::int_err(5) + info = psb_success_ + name = 'psb_sgcr' + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ictxt = desc_a%get_context() + + call psb_info(ictxt, me, np) + if (.not.allocated(b%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + if (.not.allocated(x%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + + mglob = desc_a%get_global_rows() + n_col = desc_a%get_local_cols() + + if (present(istop)) then + istop_ = istop + else + istop_ = 2 + endif + + ! + ! ISTOP_ = 1: Normwise backward error, infinity norm + ! ISTOP_ = 2: ||r||/||b||, 2-norm + ! + + if ((istop_ < 1 ).or.(istop_ > 2 ) ) then + info=psb_err_invalid_istop_ + int_err(1)=istop_ + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + + call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) + if (info == psb_success_)& + & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) + if(info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='psb_chkvect on X/B') + goto 9999 + end if + + if (present(itmax)) then + itmax_ = itmax + else + itmax_ = 1000 + endif + + if (present(itrace)) then + itrace_ = itrace + else + itrace_ = 0 + end if + + if (present(irst)) then + nl = irst + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' present: irst: ',irst,nl + else + nl = 10 + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' not present: irst: ',irst,nl + endif + + if (nl <=0 ) then + info=psb_err_invalid_istop_ + int_err(1)=nl + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + naux=4*n_col + allocate(aux(naux),h(nl+1,nl+1),& + &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) + + h = szero + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) + + do i =1,nl+1 + call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) + end do + + itx = 0 + + nrst = -1 + call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) + restart: do + if (itx>= itmax_) exit restart + h = szero + + it = 0 + ! compute r0 = b-ax0 + + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + + call psb_geaxpby(sone, b, szero, r, desc_a, info) + call psb_spmm(-sone,a,x,sone,r,desc_a,info,work=aux) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + nrst = nrst + 1 + + iteration: do + + itx = itx + 1 + it = it + 1 + j = it + !Apply preconditioner + call prec%apply(r,z(j),desc_a,info,work=aux) + + call psb_spmm(sone,a,z(j),szero,c(1),desc_a,info,work=aux) + do i =1, j - 1 + + h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) + + call psb_geaxpby(sone, c(i), szero, c(i+1), desc_a, info) + call psb_geaxpby(-h(i,j), c_scale(i), sone, c(i+1), desc_a, info) + end do + + h(j,j) = psb_norm2(c(j), desc_a, info) + hjj = sone/h(j,j) + call psb_geaxpby(hjj, c(j), szero, c_scale(j), desc_a, info) + + alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) + + !Update residual + call psb_geaxpby(sone, r, szero, r, desc_a, info) + call psb_geaxpby(-alpha(j), c_scale(j), sone, r, desc_a, info) + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + if (j >= irst) exit iteration + + + end do iteration + + m = j + + !Compute solution + + call strsm('l','u','n','n',m,1,sone,h,size(h,1),alpha,size(alpha,1)) + + if (nrst == 0 ) then + call x%set(szero) + endif + do i=1,m + call psb_geaxpby(alpha(i), z(i), sone, x, desc_a, info) + enddo + + + + + end do restart + m = j + !Compute solution + call strsm('l','u','n','n',m,1,sone,h,size(h,1),alpha,size(alpha,1)) + call x%set(szero) + do i=1,m + call psb_geaxpby(alpha(i), z(i), sone, x, desc_a, info) + enddo + + iter = j + + call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) + if (present(err)) err = derr + + if (info == psb_success_) call psb_gefree(r,desc_a,info) + + do j = 1,m + if (info == psb_success_) call psb_gefree(z(j),desc_a,info) + if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) + enddo + + do i =1,nl+1 + if (info == psb_success_) call psb_gefree(c(i),desc_a,info) + end do + + if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_erractionrestore(err_act) + return + +9999 continue + call psb_erractionrestore(err_act) + if (err_act.eq.psb_act_abort_) then + call psb_error() + return + end if + + return +end subroutine psb_sgcr_vect diff --git a/krylov/psb_zgcr.f90 b/krylov/psb_zgcr.f90 index 6d17db930..42cf68dc8 100644 --- a/krylov/psb_zgcr.f90 +++ b/krylov/psb_zgcr.f90 @@ -1,371 +1,369 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006, 2010, 2015, 2017 -! Salvatore Filippone Cranfield University -! Alfredo Buttari CNRS-IRIT, Toulouse -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! File: psb_zgcr.f90 -!! -!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) -!! -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! C C -! C References: C -! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C -! C Level 3 basic linear algebra subprograms for sparse C -! C matrices: a user level interface C -! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C -! C C -! C C -! C [2] S. Filippone, M. Colajanni C -! C PSBLAS: A library for parallel linear algebra C -! C computation on sparse matrices C -! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C -! C C -! C [3] M. Arioli, I. Duff, M. Ruiz C -! C Stopping criteria for iterative solvers C -! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C -! C C -! C C -! C [4] R. Barrett et al C -! C Templates for the solution of linear systems C -! C SIAM, 1993 -! C C -! C [4] Notay, Yvan C -! C Aggregation-based algebraic multigrid method C -! C SIAM Journal on Scientific Computing 34, C -! C pp. A2288-A2316, 2012 C -! C C -! C C -! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -! File: psb_zgcr.f90 -! -! Subroutine: psb_zgcr -! This subroutine implements the GCR method. -! -! -! Arguments: -! -! a - type(psb_zspmat_type) Input: sparse matrix containing A. -! prec - class(psb_zprec_type) Input: preconditioner -! b(:) - real Input: vector containing the -! right hand side B -! x(:) - real Input/Output: vector containing the -! initial guess and final solution X. -! eps - real Input: Stopping tolerance; the iteration is -! stopped when the error estimate |err| <= eps -! desc_a - type(psb_desc_type). Input: The communication descriptor. -! info - integer. Output: Return code -! -! itmax - integer(optional) Input: maximum number of iterations to be -! performed. -! iter - integer(optional) Output: how many iterations have been -! performed. -! performed. -! err - real (optional) Output: error estimate on exit. If the -! denominator of the estimate is exactly -! 0, it is changed into 1. -! itrace - integer(optional) Input: print an informational message -! with the error estimate every itrace -! iterations -! istop - integer(optional) Input: stopping criterion, or how -! to estimate the error. -! 1: err = |r|/(|a||x|+|b|); here the iteration is -! stopped when |r| <= eps * (|a||x|+|b|) -! 2: err = |r|/|b|; here the iteration is -! stopped when |r| <= eps * |b| -! where r is the (preconditioned, recursive -! estimate of) residual. -! -! irst - integer(optional) Input: restart parameter -! - -subroutine psb_zgcr_vect(a,prec,b,x,eps,desc_a,info,& - & itmax,iter,err,itrace, irst, istop) - use psb_base_mod - use psb_prec_mod - use psb_z_krylov_conv_mod - use psb_krylov_mod - implicit none - - - type(psb_zspmat_type), intent(in) :: a - Type(psb_desc_type), Intent(in) :: desc_a - class(psb_zprec_type), intent(inout) :: prec - type(psb_z_vect_type), Intent(inout) :: b - type(psb_z_vect_type), Intent(inout) :: x - real(psb_dpk_), Intent(in) :: eps - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop - integer(psb_ipk_), Optional, Intent(out) :: iter - real(psb_dpk_), Optional, Intent(out) :: err - ! = local data - complex(psb_dpk_), allocatable :: alpha(:), h(:,:) - type(psb_z_vect_type), allocatable :: z(:), c(:), c_scale(:) - type(psb_z_vect_type) :: r - - real(psb_dpk_) :: r_norm, b_norm, a_norm, derr - integer(psb_ipk_) :: n_col, mglob, naux, err_act - integer(psb_ipk_) :: debug_level, debug_unit - integer(psb_ipk_) :: np, me, ictxt - integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst - complex(psb_dpk_) :: hjj - complex(psb_dpk_), allocatable, target :: aux(:) - character(len=20) :: name - type(psb_itconv_type) :: stopdat - character(len=*), parameter :: methdname='GCR' - integer(psb_ipk_) ::int_err(5) - info = psb_success_ - name = 'psb_zgcr' - call psb_erractionsave(err_act) - debug_unit = psb_get_debug_unit() - debug_level = psb_get_debug_level() - - ictxt = desc_a%get_context() - - call psb_info(ictxt, me, np) - if (.not.allocated(b%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - if (.not.allocated(x%v)) then - info = psb_err_invalid_vect_state_ - call psb_errpush(info,name) - goto 9999 - endif - - mglob = desc_a%get_global_rows() - n_col = desc_a%get_local_cols() - - if (present(istop)) then - istop_ = istop - else - istop_ = 2 - endif - - ! - ! ISTOP_ = 1: Normwise backward error, infinity norm - ! ISTOP_ = 2: ||r||/||b||, 2-norm - ! - - if ((istop_ < 1 ).or.(istop_ > 2 ) ) then - info=psb_err_invalid_istop_ - int_err(1)=istop_ - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - - call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) - if (info == psb_success_)& - & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) - if(info /= psb_success_) then - info=psb_err_from_subroutine_ - call psb_errpush(info,name,a_err='psb_chkvect on X/B') - goto 9999 - end if - - if (present(itmax)) then - itmax_ = itmax - else - itmax_ = 1000 - endif - - if (present(itrace)) then - itrace_ = itrace - else - itrace_ = 0 - end if - - if (present(irst)) then - nl = irst - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' present: irst: ',irst,nl - else - nl = 10 - if (debug_level >= psb_debug_ext_) & - & write(debug_unit,*) me,' ',trim(name),& - & ' not present: irst: ',irst,nl - endif - - if (nl <=0 ) then - info=psb_err_invalid_istop_ - int_err(1)=nl - err=info - call psb_errpush(info,name,i_err=int_err) - goto 9999 - endif - - naux=4*n_col - allocate(aux(naux),h(nl+1,nl+1),& - &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) - - h = zzero - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) - - do i =1,nl+1 - call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) - call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) - end do - - itx = 0 - - nrst = -1 - call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) - restart: do - if (itx>= itmax_) exit restart - h = zzero - - it = 0 - ! compute r0 = b-ax0 - - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - - call psb_geaxpby(zone, b, zzero, r, desc_a, info) - call psb_spmm(-zone,a,x,zone,r,desc_a,info,work=aux) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - nrst = nrst + 1 - - iteration: do - - itx = itx + 1 - it = it + 1 - j = it - !Apply preconditioner - call prec%apply(r,z(j),desc_a,info,work=aux) - - call psb_spmm(zone,a,z(j),zzero,c(1),desc_a,info,work=aux) - do i =1, j - 1 - - h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) - - call psb_geaxpby(zone, c(i), zzero, c(i+1), desc_a, info) - call psb_geaxpby(-h(i,j), c_scale(i), zone, c(i+1), desc_a, info) - end do - - h(j,j) = psb_norm2(c(j), desc_a, info) - hjj = zone/h(j,j) - call psb_geaxpby(hjj, c(j), zzero, c_scale(j), desc_a, info) - - alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) - - !Update residual - call psb_geaxpby(zone, r, zzero, r, desc_a, info) - call psb_geaxpby(-alpha(j), c_scale(j), zone, r, desc_a, info) - - if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart - - if (j >= irst) exit iteration - - - end do iteration - - m = j - - !Compute solution - - call ztrsm('l','u','n','n',m,1,zone,h,size(h,1),alpha,size(alpha,1)) - - if (nrst == 0 ) then - call x%set(zzero) - endif - do i=1,m - call psb_geaxpby(alpha(i), z(i), zone, x, desc_a, info) - enddo - - - - - end do restart - m = j - !Compute solution - call ztrsm('l','u','n','n',m,1,zone,h,size(h,1),alpha,size(alpha,1)) - call x%set(zzero) - do i=1,m - call psb_geaxpby(alpha(i), z(i), zone, x, desc_a, info) - enddo - - iter = j - - call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) - if (present(err)) err = derr - - if (info == psb_success_) call psb_gefree(r,desc_a,info) - - do j = 1,m - if (info == psb_success_) call psb_gefree(z(j),desc_a,info) - if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) - enddo - - do i =1,nl+1 - if (info == psb_success_) call psb_gefree(c(i),desc_a,info) - end do - - if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) - if (info /= psb_success_) then - info=psb_err_from_subroutine_non_ - call psb_errpush(info,name) - goto 9999 - end if - - call psb_erractionrestore(err_act) - return - -9999 continue - call psb_erractionrestore(err_act) - if (err_act.eq.psb_act_abort_) then - call psb_error() - return - end if - - return -end subroutine psb_zgcr_vect - - +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006, 2010, 2015, 2017 +! Salvatore Filippone Cranfield University +! Alfredo Buttari CNRS-IRIT, Toulouse +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_zgcr.f90 +!! +!! Contributors: Ambra Abdullahi (UNITOV) and Pasqua D’Ambra (IAC-CNR) +!! +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! C C +! C References: C +! C [1] Duff, I., Marrone, M., Radicati, G., and Vittoli, C. C +! C Level 3 basic linear algebra subprograms for sparse C +! C matrices: a user level interface C +! C ACM Trans. Math. Softw., 23(3), 379-401, 1997. C +! C C +! C C +! C [2] S. Filippone, M. Colajanni C +! C PSBLAS: A library for parallel linear algebra C +! C computation on sparse matrices C +! C ACM Trans. on Math. Softw., 26(4), 527-550, Dec. 2000. C +! C C +! C [3] M. Arioli, I. Duff, M. Ruiz C +! C Stopping criteria for iterative solvers C +! C SIAM J. Matrix Anal. Appl., Vol. 13, pp. 138-144, 1992 C +! C C +! C C +! C [4] R. Barrett et al C +! C Templates for the solution of linear systems C +! C SIAM, 1993 +! C C +! C [4] Notay, Yvan C +! C Aggregation-based algebraic multigrid method C +! C SIAM Journal on Scientific Computing 34, C +! C pp. A2288-A2316, 2012 C +! C C +! C C +! CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +! File: psb_zgcr.f90 +! +! Subroutine: psb_zgcr +! This subroutine implements the GCR method. +! +! +! Arguments: +! +! a - type(psb_zspmat_type) Input: sparse matrix containing A. +! prec - class(psb_zprec_type) Input: preconditioner +! b(:) - real Input: vector containing the +! right hand side B +! x(:) - real Input/Output: vector containing the +! initial guess and final solution X. +! eps - real Input: Stopping tolerance; the iteration is +! stopped when the error estimate |err| <= eps +! desc_a - type(psb_desc_type). Input: The communication descriptor. +! info - integer. Output: Return code +! +! itmax - integer(optional) Input: maximum number of iterations to be +! performed. +! iter - integer(optional) Output: how many iterations have been +! performed. +! performed. +! err - real (optional) Output: error estimate on exit. If the +! denominator of the estimate is exactly +! 0, it is changed into 1. +! itrace - integer(optional) Input: print an informational message +! with the error estimate every itrace +! iterations +! istop - integer(optional) Input: stopping criterion, or how +! to estimate the error. +! 1: err = |r|/(|a||x|+|b|); here the iteration is +! stopped when |r| <= eps * (|a||x|+|b|) +! 2: err = |r|/|b|; here the iteration is +! stopped when |r| <= eps * |b| +! where r is the (preconditioned, recursive +! estimate of) residual. +! +! irst - integer(optional) Input: restart parameter +! + +subroutine psb_zgcr_vect(a,prec,b,x,eps,desc_a,info,& + & itmax,iter,err,itrace, irst, istop) + use psb_base_mod + use psb_prec_mod + use psb_z_krylov_conv_mod + use psb_krylov_mod + implicit none + + + type(psb_zspmat_type), intent(in) :: a + Type(psb_desc_type), Intent(in) :: desc_a + class(psb_zprec_type), intent(inout) :: prec + type(psb_z_vect_type), Intent(inout) :: b + type(psb_z_vect_type), Intent(inout) :: x + real(psb_dpk_), Intent(in) :: eps + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, irst, istop + integer(psb_ipk_), Optional, Intent(out) :: iter + real(psb_dpk_), Optional, Intent(out) :: err + ! = local data + complex(psb_dpk_), allocatable :: alpha(:), h(:,:) + type(psb_z_vect_type), allocatable :: z(:), c(:), c_scale(:) + type(psb_z_vect_type) :: r + + real(psb_dpk_) :: r_norm, b_norm, a_norm, derr + integer(psb_ipk_) :: n_col, mglob, naux, err_act + integer(psb_ipk_) :: debug_level, debug_unit + integer(psb_ipk_) :: np, me, ictxt + integer(psb_ipk_) :: i, j, it, itx, istop_, itmax_, itrace_, nl, m, nrst + complex(psb_dpk_) :: hjj + complex(psb_dpk_), allocatable, target :: aux(:) + character(len=20) :: name + type(psb_itconv_type) :: stopdat + character(len=*), parameter :: methdname='GCR' + integer(psb_ipk_) ::int_err(5) + info = psb_success_ + name = 'psb_zgcr' + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ictxt = desc_a%get_context() + + call psb_info(ictxt, me, np) + if (.not.allocated(b%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + if (.not.allocated(x%v)) then + info = psb_err_invalid_vect_state_ + call psb_errpush(info,name) + goto 9999 + endif + + mglob = desc_a%get_global_rows() + n_col = desc_a%get_local_cols() + + if (present(istop)) then + istop_ = istop + else + istop_ = 2 + endif + + ! + ! ISTOP_ = 1: Normwise backward error, infinity norm + ! ISTOP_ = 2: ||r||/||b||, 2-norm + ! + + if ((istop_ < 1 ).or.(istop_ > 2 ) ) then + info=psb_err_invalid_istop_ + int_err(1)=istop_ + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + + call psb_chkvect(mglob,ione,x%get_nrows(),ione,ione,desc_a,info) + if (info == psb_success_)& + & call psb_chkvect(mglob,ione,b%get_nrows(),ione,ione,desc_a,info) + if(info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='psb_chkvect on X/B') + goto 9999 + end if + + if (present(itmax)) then + itmax_ = itmax + else + itmax_ = 1000 + endif + + if (present(itrace)) then + itrace_ = itrace + else + itrace_ = 0 + end if + + if (present(irst)) then + nl = irst + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' present: irst: ',irst,nl + else + nl = 10 + if (debug_level >= psb_debug_ext_) & + & write(debug_unit,*) me,' ',trim(name),& + & ' not present: irst: ',irst,nl + endif + + if (nl <=0 ) then + info=psb_err_invalid_istop_ + int_err(1)=nl + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif + + naux=4*n_col + allocate(aux(naux),h(nl+1,nl+1),& + &c_scale(nl+1),c(nl+1),z(nl+1), alpha(nl+1), stat=info) + + h = zzero + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_geasb(r, desc_a,info, scratch=.true.,mold=x%v) + + do i =1,nl+1 + call psb_geasb(c(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(z(i), desc_a,info, scratch=.true.,mold=x%v) + call psb_geasb(c_scale(i), desc_a,info, scratch=.true.,mold=x%v) + end do + + itx = 0 + + nrst = -1 + call psb_init_conv(methdname,istop_,itrace_,itmax_,a,x,b,eps,desc_a,stopdat,info) + restart: do + if (itx>= itmax_) exit restart + h = zzero + + it = 0 + ! compute r0 = b-ax0 + + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + + call psb_geaxpby(zone, b, zzero, r, desc_a, info) + call psb_spmm(-zone,a,x,zone,r,desc_a,info,work=aux) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + nrst = nrst + 1 + + iteration: do + + itx = itx + 1 + it = it + 1 + j = it + !Apply preconditioner + call prec%apply(r,z(j),desc_a,info,work=aux) + + call psb_spmm(zone,a,z(j),zzero,c(1),desc_a,info,work=aux) + do i =1, j - 1 + + h(i,j) = psb_gedot(c_scale(i), c(i), desc_a, info) + + call psb_geaxpby(zone, c(i), zzero, c(i+1), desc_a, info) + call psb_geaxpby(-h(i,j), c_scale(i), zone, c(i+1), desc_a, info) + end do + + h(j,j) = psb_norm2(c(j), desc_a, info) + hjj = zone/h(j,j) + call psb_geaxpby(hjj, c(j), zzero, c_scale(j), desc_a, info) + + alpha(j) = psb_gedot(c_scale(j), r, desc_a, info) + + !Update residual + call psb_geaxpby(zone, r, zzero, r, desc_a, info) + call psb_geaxpby(-alpha(j), c_scale(j), zone, r, desc_a, info) + + if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) exit restart + + if (j >= irst) exit iteration + + + end do iteration + + m = j + + !Compute solution + + call ztrsm('l','u','n','n',m,1,zone,h,size(h,1),alpha,size(alpha,1)) + + if (nrst == 0 ) then + call x%set(zzero) + endif + do i=1,m + call psb_geaxpby(alpha(i), z(i), zone, x, desc_a, info) + enddo + + + + + end do restart + m = j + !Compute solution + call ztrsm('l','u','n','n',m,1,zone,h,size(h,1),alpha,size(alpha,1)) + call x%set(zzero) + do i=1,m + call psb_geaxpby(alpha(i), z(i), zone, x, desc_a, info) + enddo + + iter = j + + call psb_end_conv(methdname,itx,desc_a,stopdat,info,derr,iter) + if (present(err)) err = derr + + if (info == psb_success_) call psb_gefree(r,desc_a,info) + + do j = 1,m + if (info == psb_success_) call psb_gefree(z(j),desc_a,info) + if (info == psb_success_) call psb_gefree(c_scale(j),desc_a,info) + enddo + + do i =1,nl+1 + if (info == psb_success_) call psb_gefree(c(i),desc_a,info) + end do + + if (info == psb_success_) deallocate(aux,h,c_scale,z,c,alpha,stat=info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_non_ + call psb_errpush(info,name) + goto 9999 + end if + + call psb_erractionrestore(err_act) + return + +9999 continue + call psb_erractionrestore(err_act) + if (err_act.eq.psb_act_abort_) then + call psb_error() + return + end if + + return +end subroutine psb_zgcr_vect From dcf61f9d71335eb7fa558dc683aefaf44757d7c6 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Tue, 5 Jun 2018 13:19:11 -0400 Subject: [PATCH 21/48] Commit old changes, this may be a partially functional WIP --- CMakeLists.txt | 89 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 50300ebad..7a732af97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,9 @@ set ( CMAKE_BUILD_TYPE "Release" CACHE STRING "Select which configuration to build." ) set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) -#---------------------------------------------------- -# Determine version from .VERSION file or git desribe -#---------------------------------------------------- +#----------------------------------------------------- +# Determine version from .VERSION file or git describe +#----------------------------------------------------- include("${CMAKE_SOURCE_DIR}/cmake/setVersion.cmake") set_version( VERSION_VARIABLE PSBLAS_Version @@ -76,6 +76,85 @@ else() ) endif() +#------------------------------------- +# Fortran name mangling intro-spection +#------------------------------------- +include("${CMAKE_SOURCE_DIR}/cmake/CapitalizeString.cmake") +include(FortranCInterface) +CapitalizeString(${FortranCInterface_GLOBAL__CASE} fc_case) +message(STATUS "Name mangling capitalization: ${fc_case}") +message(STATUS "Name mangling fortran global suffix underscore: ${FortranCInterface_GLOBAL__SUFFIX}") +if(FortranCInterface_GLOBAL__SUFFIX STREQUAL "") + add_definitions("-D${fc_case}Case") +elseif(FortranCInterface_GLOBAL__SUFFIX STREQUAL "_") + add_definitions("-D${fc_case}Underscore") +elseif(FortranCInterface_GLOBAL__SUFFIX STREQUAL "__") + add_definitions("-D${fc_case}DoubleUnderscore") +else() + message( FATAL_ERROR "Fortran name mangling suffix, \'${FortranCInterface_GLOBAL__SUFFIX}\', unknown to morfeus/NEMO") +endif() + +#---------------------------------------------- +# Determine system endian-ness and pointer size +#---------------------------------------------- +include(TestBigEndian) +TEST_BIG_ENDIAN(IS_BIG_ENDIAN) +if(IS_BIG_ENDIAN) + message( STATUS "System appears to be big endian.") +else() + message( STATUS "System appears to be little endian.") + add_definitions(-DLittleEndian) +endif() +include(CheckTypeSize) +CHECK_TYPE_SIZE("void *" VOID_P_SIZE LANGUAGE C) +if(${VOID_P_SIZE} EQUAL 8) + add_definitions(-DPtr64Bits) +endif() +message(STATUS "Have 64bit pointers") + +#----------------------------------------- +# Check for some Fortran compiler features +#----------------------------------------- +include(CheckFortranSourceCompiles) +CHECK_Fortran_SOURCE_COMPILES( + " +integer, allocatable :: a(:), b(:) +allocate(a(5)) +a = [1,2,3,4,5] +call move_alloc(from=a, to=b) +end +" + HAVE_MOVE_ALLOC + SRC_EXT f90 + ) +if(HAVE_MOVE_ALLOC) + add_definitions(-DHAVE_MOVE_ALLOC) +endif() +CHECK_Fortran_SOURCE_COMPILES( + "integer, volatile :: i ; end" + HAVE_VOLATILE + SRC_EXT f90 + ) +if(HAVE_VOLATILE) + add_definitions(-DHAVE_VOLATILE) +endif() +CHECK_Fortran_SOURCE_COMPILES( + "use ISO_FORTRAN_ENV ; end" + HAVE_ISO_FORTRAN_ENV + SRC_EXT f90 + ) +if(HAVE_ISO_FORTRAN_ENV) + add_definitions(-DHAVE_ISO_FORTRAN_ENV) +endif() +CHECK_Fortran_SOURCE_COMPILES( + "flush(5); end" + HAVE_FLUSH_STMT + SRC_EXT f90 + ) +if(HAVE_FLUSH_STMT) + add_definitions(-DHAVE_FLUSH_STMT) +endif() + #---------------------------------------------------------------------------- # Find MPI and set some flags so that FC and CC can point to gfortran and gcc #---------------------------------------------------------------------------- @@ -415,11 +494,11 @@ endfunction(add_mpi_test) # add_mpi_test(initialize_mpi 2 initialize_mpi) 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 + -DHAVE_METIS -DHAVE_LAPACK -DHAVE_MOLD -DHAVE_EXTENDS_TYPE_OF -DHAVE_SAME_TYPE_AS -DHAVE_FINAL -DMPI_MOD ) # From ./configure CDEFINES section add_definitions( - -DHAVE_METIS_ -DLowerUnderscore -DPtr64Bits + -DHAVE_METIS_ ) set(directory_list base prec krylov util test) # TODO: add cbind From ee1b2f6d6ed872c10b0b7e9cea280446868dcbd2 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Mon, 17 Dec 2018 15:22:36 -0500 Subject: [PATCH 22/48] Clean/refactor CMake build to add upstream changes --- CMakeLists.txt | 510 +++++++++++++--------------- base/CMakeLists.txt | 547 ++++++++++++------------------ cmake/CheckOutOfSourceBuild.cmake | 21 ++ krylov/CMakeLists.txt | 198 +++-------- prec/CMakeLists.txt | 231 ++++--------- util/CMakeLists.txt | 174 ++-------- 6 files changed, 616 insertions(+), 1065 deletions(-) create mode 100644 cmake/CheckOutOfSourceBuild.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a732af97..fa290c28e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,13 @@ +# FDEFINES : -DHAVE_LAPACK -DHAVE_FINAL -DHAVE_ISO_FORTRAN_ENV -DHAVE_FLUSH_STMT -DHAVE_VOLATILE -DSERIAL_MPI -DMPI_MOD +# CDEFINES : -DLowerUnderscore -DPtr64Bits + #----------------------------------- # Set oldest allowable CMake version #----------------------------------- -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.10) +cmake_policy(VERSION 3.10.0...3.12.4) + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") #---------------------------------------------- # Define canonical CMake build types and extras @@ -14,7 +20,7 @@ set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYP #----------------------------------------------------- # Determine version from .VERSION file or git describe #----------------------------------------------------- -include("${CMAKE_SOURCE_DIR}/cmake/setVersion.cmake") +include(setVersion) set_version( VERSION_VARIABLE PSBLAS_Version GIT_DESCRIBE_VAR full_git_describe @@ -24,7 +30,9 @@ message( STATUS "Building PSBLAS version: ${full_git_describe}" ) #------------------------------------------ # Name project and specify source languages #------------------------------------------ -project(psblas VERSION "${PSBLAS_Version}" LANGUAGES C Fortran) +project(psblas + VERSION "${PSBLAS_Version}" + LANGUAGES C Fortran) #----------------------------------------------------------------- # Define a target to create a checksummed & signed release archive @@ -40,24 +48,7 @@ endif() #-------------------------- # 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}" - " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}" - "\nThis archive does not support in-source builds:\n" - "You must now delete the CMakeCache.txt file and the CMakeFiles/ directory under " - "the 'src' source directory or you will not be able to configure correctly!" - "\nYou must now run something like:\n" - " $ rm -r CMakeCache.txt CMakeFiles/" - "\n" - "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" - " $ CC=gcc FC=gfortran cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/path/to/install/dir /path/to/psblas3/src/dir \n" - "\nsubstituting the appropriate syntax for your shell (the above line assumes the bash shell)." - ) -endif() +include(CheckOutOfSourceBuild) #---------------------------------------------------- # Define coverage flags and report untested compilers @@ -76,12 +67,11 @@ else() ) endif() -#------------------------------------- -# Fortran name mangling intro-spection -#------------------------------------- -include("${CMAKE_SOURCE_DIR}/cmake/CapitalizeString.cmake") +#------------------------------------ +# Fortran name mangling introspection +#------------------------------------ include(FortranCInterface) -CapitalizeString(${FortranCInterface_GLOBAL__CASE} fc_case) +string(TOUPPER ${FortranCInterface_GLOBAL__CASE} fc_case) message(STATUS "Name mangling capitalization: ${fc_case}") message(STATUS "Name mangling fortran global suffix underscore: ${FortranCInterface_GLOBAL__SUFFIX}") if(FortranCInterface_GLOBAL__SUFFIX STREQUAL "") @@ -91,7 +81,7 @@ elseif(FortranCInterface_GLOBAL__SUFFIX STREQUAL "_") elseif(FortranCInterface_GLOBAL__SUFFIX STREQUAL "__") add_definitions("-D${fc_case}DoubleUnderscore") else() - message( FATAL_ERROR "Fortran name mangling suffix, \'${FortranCInterface_GLOBAL__SUFFIX}\', unknown to morfeus/NEMO") + message( FATAL_ERROR "Fortran name mangling suffix, \'${FortranCInterface_GLOBAL__SUFFIX}\', unknown to PSBLAS") endif() #---------------------------------------------- @@ -154,228 +144,142 @@ CHECK_Fortran_SOURCE_COMPILES( if(HAVE_FLUSH_STMT) add_definitions(-DHAVE_FLUSH_STMT) 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 ) -get_filename_component( C_COMPILER_NAME "${CMAKE_C_COMPILER}" - NAME ) -get_filename_component( FTN_COMPILER_DIR "${CMAKE_Fortran_COMPILER}" - REALPATH ) -get_filename_component( C_COMPILER_DIR "${CMAKE_C_COMPILER}" - REALPATH ) - -if (FTN_COMPILER_NAME MATCHES "^[mM][pP][iI]") - set (MPI_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}") +CHECK_Fortran_SOURCE_COMPILES( + " +module conftest_mod + type foo + integer :: i + contains + final :: destroy_foo + end type foo + private destroy_foo +contains + subroutine destroy_foo(a) + type(foo) :: a + ! Just a test + end subroutine destroy_foo +end module conftest_mod +program conftest + use conftest_mod + type(foo) :: foovar +end program" + HAVE_FINAL + SRC_EXT f90 + ) +if(HAVE_FINAL) + add_definitions(-DHAVE_FINAL) endif() -if (C_COMPILER_NAME MATCHES "^[mM][pP][iI]") - set (MPI_C_COMPILER "${CMAKE_C_COMPILER}") +CHECK_Fortran_SOURCE_COMPILES( + " +program xtt + type foo + integer :: i + end type foo + type, extends(foo) :: new_foo + integer :: j + end type new_foo + class(foo), allocatable :: fooab + type(new_foo) :: nfv + integer :: info + allocate(fooab, mold=nfv, stat=info) +end program" + HAVE_MOLD + SRC_EXT f90) +if(HAVE_MOLD) + add_definitions(-DHAVE_MOLD) endif() - -find_package( MPI ) - -if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC)) - find_program (MY_MPI_EXEC NAMES mpirun mpiexec lamexec srun - HINTS "${FTN_COMPILER_DIR}" "${C_COMPILER_DIR}" - PATH_SUFFIXES bin) - set ( MPI_HOME "${MPI_HOME}" "${MY_MPI_EXEC}" "${MY_MPI_EXEC}/.." ) - find_package( MPI REQUIRED ) +CHECK_Fortran_SOURCE_COMPILES( + " +program conftest + type foo + integer :: i + end type foo + type, extends(foo) :: bar + integer j + end type bar + type(bar) :: barvar +end program " + HAVE_EXTENDS_TYPE_OF + SRC_EXT f90) +if(HAVE_EXTENDS_TYPE_OF) + add_definitions(-DHAVE_EXTENDS_TYPE_OF) endif() -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 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.") +CHECK_Fortran_SOURCE_COMPILES( + " +program stt + type foo + integer :: i + end type foo + type, extends(foo) :: new_foo + integer :: j + end type new_foo + type(foo) :: foov + type(new_foo) :: nfv1, nfv2 + + + write(*,*) 'foov == nfv1? ', same_type_as(foov,nfv1) + write(*,*) 'nfv2 == nfv1? ', same_type_as(nfv2,nfv1) +end program" + HAVE_SAME_TYPE_AS + SRC_EXT f90) +if(HAVE_SAME_TYPE_AS) + add_definitions(-DHAVE_SAME_TYPE_AS) endif() -get_filename_component(MPIEXEC_RELATIVE_LOC "${MPIEXEC}" - PROGRAM) -get_filename_component(MPIEXEC_ABS_LOC "${MPIEXEC_RELATIVE_LOC}" - REALPATH) -get_filename_component(MPIEXEC_DIR "${MPIEXEC_ABS_LOC}" - DIRECTORY) - -get_filename_component(MPICC_RELATIVE_LOC "${MPI_C_COMPILER}" - PROGRAM) -get_filename_component(MPICC_ABS_LOC "${MPICC_RELATIVE_LOC}" - REALPATH) -get_filename_component(MPICC_DIR "${MPICC_ABS_LOC}" - DIRECTORY) - -get_filename_component(MPIFC_RELATIVE_LOC "${MPI_Fortran_COMPILER}" - PROGRAM) -get_filename_component(MPIFC_ABS_LOC "${MPIFC_RELATIVE_LOC}" - REALPATH) -get_filename_component(MPIFC_DIR "${MPIFC_ABS_LOC}" - DIRECTORY) - -if ((MPIEXEC_DIR STREQUAL MPICC_DIR) AND (MPIEXEC_DIR STREQUAL MPIFC_DIR)) - message ( STATUS "MPI runtime and compile time environments appear to be consistent") -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 an inconsistent MPI environment") -endif() +#---------------------------------------------------------------------------- +# Find MPI and set some flags so that FC and CC can point to gfortran and gcc +#---------------------------------------------------------------------------- +find_package( MPI ) -#----------------------------------------------- -# 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__LINK_FLAGS variable. This is +if(MPI_FOUND) + #----------------------------------------------- + # 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__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/OpenCoarrays/issues/317. `noexecstack` is being replaced with `execstack`" - ) - string(REPLACE "noexecstack" - "execstack" MPI_C_LINK_FLAGS_FIXED ${MPI_C_LINK_FLAGS}) - string(REPLACE "noexecstack" - "execstack" MPI_Fortran_LINK_FLAGS_FIXED ${MPI_Fortran_LINK_FLAGS}) - set(MPI_C_LINK_FLAGS "${MPI_C_LINK_FLAGS_FIXED}" CACHE STRING - "MPI C linking flags" FORCE) - set(MPI_Fortran_LINK_FLAGS "${MPI_Fortran_LINK_FLAGS_FIXED}" CACHE STRING - "MPI Fortran linking flags" FORCE) -endif() - -#-------------------------------------------------------- -# Make sure a simple "hello world" C mpi program compiles -#-------------------------------------------------------- -set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) -set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS} ${MPI_C_LINK_FLAGS}) -set(OLD_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) -set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -set(OLD_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) -set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) -include (CheckCSourceCompiles) -CHECK_C_SOURCE_COMPILES(" -#include -#include -int main(int argc, char** argv) { - MPI_Init(NULL, NULL); - int world_size; - MPI_Comm_size(MPI_COMM_WORLD, &world_size); - int world_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); - char processor_name[MPI_MAX_PROCESSOR_NAME]; - int name_len; - MPI_Get_processor_name(processor_name, &name_len); - printf('Hello world from processor %s, rank %d out of %d processors', - processor_name, world_rank, world_size); - MPI_Finalize(); -}" -MPI_C_COMPILES) -set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) -set(CMAKE_REQUIRED_INCLUDES ${OLD_INCLUDES}) -set(CMAKE_REQUIRED_LIBRARIES ${OLD_LIBRARIES}) -unset(OLD_REQUIRED_FLAGS) -unset(OLD_INCLUDES) -unset(OLD_LIBRARIES) - -if (NOT MPI_C_COMPILES) - message(FATAL_ERROR "MPI_C is missing! " - "Try setting MPI_C_COMPILER to the appropriate C compiler wrapper script and reconfigure. " - "i.e., `cmake -DMPI_C_COMPILER=/path/to/mpicc ..` or set it by editing the cache using " - "cmake-gui or ccmake." - ) -endif() - -#-------------------------------------------------------------- -# Make sure a simple "hello world" Fortran mpi program compiles -# Try using mpi.mod first then fall back on includ 'mpif.h' -#-------------------------------------------------------------- -set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) -set(CMAKE_REQUIRED_FLAGS "-ffree-form" ${MPI_Fortran_COMPILE_FLAGS} ${MPI_Fortran_LINK_FLAGS}) -set(OLD_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) -set(CMAKE_REQUIRED_INCLUDES ${MPI_Fortran_INCLUDE_PATH}) -set(OLD_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) -set(CMAKE_REQUIRED_LIBRARIES ${MPI_Fortran_LIBRARIES}) -include (CheckFortranSourceCompiles) -CHECK_Fortran_SOURCE_COMPILES(" -program mpi_hello -use mpi -implicit none -integer :: ierr, mpi_world_size, mpi_world_rank, res_len -character*(MPI_MAX_PROCESSOR_NAME) :: proc -call mpi_init(ierr) -call mpi_comm_size(MPI_COMM_WORLD,mpi_world_size,ierr) -call mpi_comm_rank(MPI_COMM_WORLD,mpi_world_rank,ierr) -call mpi_get_processor_name(proc,res_len,ierr) -write(*,*) 'Hello from processor ', trim(proc), ' rank ', mpi_world_rank, ' out of ', mpi_world_size, '.' -call mpi_finalize(ierr) -end program -" -MPI_Fortran_MODULE_COMPILES) -set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) -set(CMAKE_REQUIRED_INCLUDES ${OLD_INCLUDES}) -set(CMAKE_REQUIRED_LIBRARIES ${OLD_LIBRARIES}) -unset(OLD_REQUIRED_FLAGS) -unset(OLD_INCLUDES) -unset(OLD_LIBRARIES) - -#-------------------------------- -# If that failed try using mpif.h -#-------------------------------- -set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) -set(CMAKE_REQUIRED_FLAGS "-ffree-form" ${MPI_Fortran_COMPILE_FLAGS} ${MPI_Fortran_LINK_FLAGS}) -set(OLD_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) -set(CMAKE_REQUIRED_INCLUDES ${MPI_Fortran_INCLUDE_PATH}) -set(OLD_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) -set(CMAKE_REQUIRED_LIBRARIES ${MPI_Fortran_LIBRARIES}) -include (CheckFortranSourceCompiles) -CHECK_Fortran_SOURCE_COMPILES(" -program mpi_hello -implicit none -include 'mpif.h' -integer :: ierr, mpi_world_size, mpi_world_rank, res_len -character*(MPI_MAX_PROCESSOR_NAME) :: proc -call mpi_init(ierr) -call mpi_comm_size(MPI_COMM_WORLD,mpi_world_size,ierr) -call mpi_comm_rank(MPI_COMM_WORLD,mpi_world_rank,ierr) -call mpi_get_processor_name(proc,res_len,ierr) -write(*,*) 'Hello from processor ', trim(proc), ' rank ', mpi_world_rank, ' out of ', mpi_world_size, '.' -call mpi_finalize(ierr) -end program -" - MPI_Fortran_INCLUDE_COMPILES) -set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) -set(CMAKE_REQUIRED_INCLUDES ${OLD_INCLUDES}) -set(CMAKE_REQUIRED_LIBRARIES ${OLD_LIBRARIES}) -unset(OLD_REQUIRED_FLAGS) -unset(OLD_INCLUDES) -unset(OLD_LIBRARIES) - -if ( (NOT MPI_Fortran_MODULE_COMPILES) AND (NOT MPI_Fortran_INCLUDE_COMPILES) ) - message ( WARNING "It appears that the Fortran MPI compiler is not working. ") -endif() + ) + string(REPLACE "noexecstack" + "execstack" MPI_C_LINK_FLAGS_FIXED ${MPI_C_LINK_FLAGS}) + string(REPLACE "noexecstack" + "execstack" MPI_Fortran_LINK_FLAGS_FIXED ${MPI_Fortran_LINK_FLAGS}) + set(MPI_C_LINK_FLAGS "${MPI_C_LINK_FLAGS_FIXED}" CACHE STRING + "MPI C linking flags" FORCE) + set(MPI_Fortran_LINK_FLAGS "${MPI_Fortran_LINK_FLAGS_FIXED}" CACHE STRING + "MPI Fortran linking flags" FORCE) + endif() -if ( MPI_Fortran_MODULE_COMPILES ) - add_definitions(-DMPI_WORKING_MODULE) + #---------------- + # Setup MPI flags + #---------------- + list(REMOVE_DUPLICATES MPI_Fortran_INCLUDE_PATH) + set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) + set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) + set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) + set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) + include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) + + if(MPI_Fortran_HAVE_F90_MODULE OR MPI_Fortran_HAVE_F08_MODULE) + add_definitions(-DMPI_MOD) + endif() + set(SERIAL_MPI OFF) 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 ${CMAKE_PROJECT_NAME} " - "developers." - ) + add_definitions(-DSERIAL_MPI) + add_definitions(-DMPI_MOD) + set(SERIAL_MPI ON) endif() -#---------------- -# Setup MPI flags -#---------------- -set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) -set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) -set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) -set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) -include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) +#------------------------------ +# Find Linear Algebra Libraries +#------------------------------ +find_package(BLAS REQUIRED) +find_package(LAPACK REQUIRED) +add_definitions(-DHAVE_LAPACK) #--------------------------------------------------- # Use standardized GNU install directory conventions @@ -386,9 +290,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") +#----------------------------------- +# Turn on testing/ctest capabilities +#----------------------------------- enable_testing() - #------------------------------------------------------------------------------ # Add custom properties on targets for controling number of ranks during tests #------------------------------------------------------------------------------ @@ -429,6 +335,7 @@ install( ) +if(MPI_FOUND) #------------------------------------------ # Add portable unistall command to makefile #------------------------------------------ @@ -443,48 +350,99 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) # See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend # on the test executables -#--------------------------------------------------------------------------------------- -# Define macro for adding CAF tests, and ensuring proper flags are passed to MPI runtime -#--------------------------------------------------------------------------------------- - +#---------------------------------- # Determine if we're using Open MPI +#--------------------------------- execute_process(COMMAND ${MPIEXEC} --version OUTPUT_VARIABLE mpi_version_out) if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]") message( STATUS "OpenMPI detected") set ( openmpi true ) endif () +endif() -include( ProcessorCount ) -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_RANKS) - elseif(TARGET build_${test_target}) - 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_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 ranks requested with ${N_CPU} system processor available.") - if ( openmpi ) - if (min_test_ranks) - set( num_mpi_rank ${min_test_ranks} ) - elseif ( N_CPU LESS 2 ) - 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." ) - endif() - endif() - set(test_parameters -np ${num_mpi_rank} ${test_parameters}) - add_test(NAME ${name} COMMAND "bash" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/mpirun" ${test_parameters} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test_target}") - set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.") -endfunction(add_mpi_test) +#--------------------------------------- +# Add the PSBLAS libraries and utilities +#--------------------------------------- + +# Link order, left to right: +# cbind.a, util.a krylov.a prec.a base.a + +include(${CMAKE_CURRENT_LIST_DIR}/base/CMakeLists.txt) +add_library(base ${base_source_files}) +set_target_properties(base + PROPERTIES + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME psb_base + LINKER_LANGUAGE Fortran + ) +target_include_directories(base PUBLIC + $ + $) +if(MPI_FOUND) + target_link_libraries(base PUBLIC ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) +endif() + + +include(${CMAKE_CURRENT_LIST_DIR}/prec/CMakeLists.txt) +add_library(prec ${prec_source_files}) +set_target_properties(prec + PROPERTIES + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME psb_prec + LINKER_LANGUAGE Fortran + ) +target_include_directories(prec PUBLIC + $ + $) +target_link_libraries(prec PUBLIC base) + +include(${CMAKE_CURRENT_LIST_DIR}/krylov/CMakeLists.txt) +add_library(krylov ${krylov_source_files}) +set_target_properties(krylov + PROPERTIES + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME psb_krylov + LINKER_LANGUAGE Fortran + ) +target_include_directories(krylov PUBLIC + $ + $) +target_link_libraries(krylov PUBLIC base prec) + +include(${CMAKE_CURRENT_LIST_DIR}/util/CMakeLists.txt) +add_library(util ${util_source_files}) +set_target_properties(util + PROPERTIES + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME psb_util + LINKER_LANGUAGE Fortran + ) +target_include_directories(util PUBLIC + $ + $) +target_link_libraries(util PUBLIC base prec) + + +install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILES_MATCHING PATTERN "*.mod") +install(TARGETS base prec krylov util + EXPORT ${CMAKE_PROJECT_NAME}-targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) + + + +# set(directory_list base prec krylov util test) # TODO: add cbind +# foreach(directory ${directory_list}) +# add_subdirectory("${directory}") +# endforeach() +#add_subdirectory(cbind) #----------------- # Add PSBLAS tests @@ -492,17 +450,3 @@ endfunction(add_mpi_test) # Unit tests targeting each function, argument, and branch of code # add_mpi_test(initialize_mpi 2 initialize_mpi) - -add_definitions( - -DHAVE_METIS -DHAVE_LAPACK -DHAVE_MOLD -DHAVE_EXTENDS_TYPE_OF -DHAVE_SAME_TYPE_AS -DHAVE_FINAL -DMPI_MOD -) -# From ./configure CDEFINES section -add_definitions( - -DHAVE_METIS_ -) - -set(directory_list base prec krylov util test) # TODO: add cbind -foreach(directory ${directory_list}) - add_subdirectory("${directory}") -endforeach() -#add_subdirectory(cbind) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index cf8b8cad1..b4a38921a 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -1,91 +1,4 @@ -if (NOT MPI_C_FOUND) - find_package(MPI REQUIRED) - - set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) - set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) - set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) - set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) - include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) -endif() - -if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") - set(gfortran_compiler true) -endif() - -include(CheckIncludeFile) -CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) -if(NOT HAVE_ALLOCA) - add_definitions(-DALLOCA_MISSING) - message(WARNING "Could not find . Assuming functionality is provided elsewhere.") -endif() - -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") -if(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -else() - set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -endif() -set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") -if(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) -else() - set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) -endif() - -set(MPI_HEADERS mpi.h) -include(CheckIncludeFiles) -CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) -if(HAVE_MPI_EXT) - add_definitions(-DHAVE_MPI_EXT_H) - set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) -endif() - -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) -set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) -set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) - -#--------------------------------------------------- -# Windows Intel MPI compatibility, see GH issue #435 -#--------------------------------------------------- -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) - -include(CheckSymbolExists) -CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) -if(HAVE_Intel_MPI AND WIN32) - add_definitions(-DUSE_GCC) -endif() -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) - -set(PSBLAS_SO_VERSION 0) -if(gfortran_compiler) - if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) - set(PSBLAS_SO_VERSION 2) - elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) - set(PSBLAS_SO_VERSION 1) - endif() -endif() - -set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") -set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") -set(MPI_LIBS "") -foreach( lib IN LISTS MPI_Fortran_LIBRARIES) - set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") -endforeach() -string(STRIP "${MPI_LIBS}" MPI_LIBS) - -set(base_source_files +set(PSB_base_source_files internals/psi_desc_impl.f90 internals/psi_crea_bnd_elem.f90 internals/psi_bld_tmphalo.f90 @@ -131,223 +44,223 @@ tools/psb_zfree.f90 tools/psb_zins.f90 tools/psb_cd_switch_ovl_indxmap.f90 tools/psb_sasb.f90 -./internals/psi_desc_impl.f90 -./internals/psi_crea_bnd_elem.f90 -./internals/psi_bld_tmphalo.f90 -./internals/psi_list_search.f90 -./internals/psi_crea_ovr_elem.f90 -./internals/psi_compute_size.f90 -./internals/psi_dl_check.f90 -./internals/psi_exist_ovr_elem.f90 -./internals/psi_srtlist.f90 -./internals/psi_bld_tmpovrl.f90 -./internals/psi_crea_index.f90 -./internals/psi_sort_dl.f90 -./tools/psb_iallc.f90 -./tools/psb_c_map.f90 -./tools/psb_dspalloc.f90 -./tools/psb_cspasb.f90 -./tools/psb_dins.f90 -./tools/psb_iasb.f90 -./tools/psb_sspfree.f90 -./tools/psb_cd_lstext.f90 -./tools/psb_dsprn.f90 -./tools/psb_cins.f90 -./tools/psb_csprn.f90 -./tools/psb_ifree.f90 -./tools/psb_sspasb.f90 -./tools/psb_z_map.f90 -./tools/psb_zspins.f90 -./tools/psb_sins.f90 -./tools/psb_cdins.f90 -./tools/psb_cspfree.f90 -./tools/psb_cdalv.f90 -./tools/psb_zallc.f90 -./tools/psb_cspins.f90 -./tools/psb_dallc.f90 -./tools/psb_cdrep.f90 -./tools/psb_dspfree.f90 -./tools/psb_zspfree.f90 -./tools/psb_get_overlap.f90 -./tools/psb_cdals.f90 -./tools/psb_dfree.f90 -./tools/psb_dasb.f90 -./tools/psb_zfree.f90 -./tools/psb_zins.f90 -./tools/psb_cd_switch_ovl_indxmap.f90 -./tools/psb_sasb.f90 -./tools/psb_callc.f90 -./tools/psb_cd_reinit.f90 -./tools/psb_cd_set_bld.f90 -./tools/psb_s_map.f90 -./tools/psb_cdprt.f90 -./tools/psb_glob_to_loc.f90 -./tools/psb_zasb.f90 -./tools/psb_zspalloc.f90 -./tools/psb_cspalloc.f90 -./tools/psb_iins.f90 -./tools/psb_d_map.f90 -./tools/psb_cdren.f90 -./tools/psb_casb.f90 -./tools/psb_zsprn.f90 -./tools/psb_sspins.f90 -./tools/psb_zspasb.f90 -./tools/psb_loc_to_glob.f90 -./tools/psb_dspasb.f90 -./tools/psb_cdall.f90 -./tools/psb_sallc.f90 -./tools/psb_ssprn.f90 -./tools/psb_dspins.f90 -./tools/psb_sspalloc.f90 -./tools/psb_cd_inloc.f90 -./tools/psb_sfree.f90 -./tools/psb_cfree.f90 -./modules/psi_c_mod.f90 -./modules/psi_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 -./modules/desc/psb_repl_map_mod.f90 -./modules/desc/psb_desc_const_mod.f90 -./modules/desc/psb_gen_block_map_mod.f90 -./modules/desc/psb_hash_map_mod.f90 -./modules/desc/psb_glist_map_mod.f90 -./modules/desc/psb_list_map_mod.f90 -./modules/psi_d_mod.f90 -./modules/tools/psb_i_tools_mod.f90 -./modules/tools/psb_d_tools_mod.f90 -./modules/tools/psb_s_tools_mod.f90 -./modules/tools/psb_tools_mod.f90 -./modules/tools/psb_cd_tools_mod.f90 -./modules/tools/psb_z_tools_mod.f90 -./modules/tools/psb_c_tools_mod.f90 -./modules/psi_s_mod.f90 -./modules/comm/psb_d_linmap_mod.f90 -./modules/comm/psb_s_linmap_mod.f90 -./modules/comm/psb_base_linmap_mod.f90 -./modules/comm/psb_i_comm_mod.f90 -./modules/comm/psb_c_linmap_mod.f90 -./modules/comm/psb_c_comm_mod.f90 -./modules/comm/psb_z_comm_mod.f90 -./modules/comm/psb_z_linmap_mod.f90 -./modules/comm/psb_s_comm_mod.f90 -./modules/comm/psb_d_comm_mod.f90 -./modules/comm/psb_comm_mod.f90 -./modules/comm/psb_linmap_mod.f90 -./modules/psblas/psb_psblas_mod.f90 -./modules/psi_i_mod.f90 -./modules/serial/psb_s_csr_mat_mod.f90 -./modules/serial/psb_z_mat_mod.f90 -./modules/serial/psb_s_base_mat_mod.f90 -./modules/serial/psb_s_base_vect_mod.f90 -./modules/serial/psb_z_csc_mat_mod.f90 -./modules/serial/psb_d_csr_mat_mod.f90 -./modules/serial/psb_s_csc_mat_mod.f90 -./modules/serial/psb_i_base_vect_mod.f90 -./modules/serial/psb_z_base_vect_mod.f90 -./modules/serial/psb_c_csr_mat_mod.f90 -./modules/serial/psb_c_serial_mod.f90 -./modules/serial/psb_c_base_vect_mod.f90 -./modules/serial/psb_s_serial_mod.f90 -./modules/serial/psb_d_csc_mat_mod.f90 -./modules/serial/psb_vect_mod.f90 -./modules/serial/psb_base_mat_mod.f90 -./modules/serial/psb_c_csc_mat_mod.f90 -./modules/serial/psb_z_base_mat_mod.f90 -./modules/serial/psb_z_csr_mat_mod.f90 -./modules/serial/psb_c_mat_mod.f90 -./modules/serial/psb_d_base_mat_mod.f90 -./modules/serial/psb_d_serial_mod.f90 -./modules/serial/psb_c_base_mat_mod.f90 -./modules/serial/psb_d_base_vect_mod.f90 -./modules/serial/psb_serial_mod.f90 -./modules/serial/psb_s_mat_mod.f90 -./modules/serial/psb_z_serial_mod.f90 -./modules/serial/psb_d_mat_mod.f90 -./modules/serial/psb_mat_mod.f90 -./modules/error.f90 -./modules/psb_check_mod.f90 -./comm/psb_shalo.f90 -./comm/psb_dhalo.f90 -./comm/psb_igather.f90 -./comm/internals/psi_iovrl_restr.f90 -./comm/internals/psi_covrl_upd.f90 -./comm/internals/psi_covrl_save.f90 -./comm/internals/psi_sovrl_upd.f90 -./comm/internals/psi_dovrl_restr.f90 -./comm/internals/psi_zovrl_restr.f90 -./comm/internals/psi_dovrl_save.f90 -./comm/internals/psi_zovrl_save.f90 -./comm/internals/psi_sovrl_restr.f90 -./comm/internals/psi_zovrl_upd.f90 -./comm/internals/psi_sovrl_save.f90 -./comm/internals/psi_iovrl_upd.f90 -./comm/internals/psi_covrl_restr.f90 -./comm/internals/psi_iovrl_save.f90 -./comm/internals/psi_dovrl_upd.f90 -./comm/psb_iovrl.f90 -./comm/psb_cgather.f90 -./comm/psb_covrl.f90 -./comm/psb_zovrl.f90 -./comm/psb_ihalo.f90 -./comm/psb_dgather.f90 -./comm/psb_sovrl.f90 -./comm/psb_dovrl.f90 -./comm/psb_zgather.f90 -./comm/psb_zhalo.f90 -./comm/psb_sgather.f90 -./comm/psb_chalo.f90 -./psblas/psb_snrmi.f90 -./psblas/psb_dspmm.f90 -./psblas/psb_samax.f90 -./psblas/psb_dspnrm1.f90 -./psblas/psb_sspnrm1.f90 -./psblas/psb_sspmm.f90 -./psblas/psb_dnrmi.f90 -./psblas/psb_zamax.f90 -./psblas/psb_cspmm.f90 -./psblas/psb_dspsm.f90 -./psblas/psb_casum.f90 -./psblas/psb_cnrmi.f90 -./psblas/psb_znrm2.f90 -./psblas/psb_zspsm.f90 -./psblas/psb_camax.f90 -./psblas/psb_dnrm2.f90 -./psblas/psb_znrmi.f90 -./psblas/psb_cspsm.f90 -./psblas/psb_sdot.f90 -./psblas/psb_dasum.f90 -./psblas/psb_zasum.f90 -./psblas/psb_damax.f90 -./psblas/psb_zspmm.f90 -./psblas/psb_cnrm2.f90 -./psblas/psb_ddot.f90 -./psblas/psb_caxpby.f90 -./psblas/psb_cdot.f90 -./psblas/psb_snrm2.f90 -./psblas/psb_sspsm.f90 -./psblas/psb_daxpby.f90 -./psblas/psb_zdot.f90 -./psblas/psb_zaxpby.f90 -./psblas/psb_zspnrm1.f90 -./psblas/psb_sasum.f90 -./psblas/psb_saxpby.f90 -./psblas/psb_cspnrm1.f90 +internals/psi_desc_impl.f90 +internals/psi_crea_bnd_elem.f90 +internals/psi_bld_tmphalo.f90 +internals/psi_list_search.f90 +internals/psi_crea_ovr_elem.f90 +internals/psi_compute_size.f90 +internals/psi_dl_check.f90 +internals/psi_exist_ovr_elem.f90 +internals/psi_srtlist.f90 +internals/psi_bld_tmpovrl.f90 +internals/psi_crea_index.f90 +internals/psi_sort_dl.f90 +tools/psb_iallc.f90 +tools/psb_c_map.f90 +tools/psb_dspalloc.f90 +tools/psb_cspasb.f90 +tools/psb_dins.f90 +tools/psb_iasb.f90 +tools/psb_sspfree.f90 +tools/psb_cd_lstext.f90 +tools/psb_dsprn.f90 +tools/psb_cins.f90 +tools/psb_csprn.f90 +tools/psb_ifree.f90 +tools/psb_sspasb.f90 +tools/psb_z_map.f90 +tools/psb_zspins.f90 +tools/psb_sins.f90 +tools/psb_cdins.f90 +tools/psb_cspfree.f90 +tools/psb_cdalv.f90 +tools/psb_zallc.f90 +tools/psb_cspins.f90 +tools/psb_dallc.f90 +tools/psb_cdrep.f90 +tools/psb_dspfree.f90 +tools/psb_zspfree.f90 +tools/psb_get_overlap.f90 +tools/psb_cdals.f90 +tools/psb_dfree.f90 +tools/psb_dasb.f90 +tools/psb_zfree.f90 +tools/psb_zins.f90 +tools/psb_cd_switch_ovl_indxmap.f90 +tools/psb_sasb.f90 +tools/psb_callc.f90 +tools/psb_cd_reinit.f90 +tools/psb_cd_set_bld.f90 +tools/psb_s_map.f90 +tools/psb_cdprt.f90 +tools/psb_glob_to_loc.f90 +tools/psb_zasb.f90 +tools/psb_zspalloc.f90 +tools/psb_cspalloc.f90 +tools/psb_iins.f90 +tools/psb_d_map.f90 +tools/psb_cdren.f90 +tools/psb_casb.f90 +tools/psb_zsprn.f90 +tools/psb_sspins.f90 +tools/psb_zspasb.f90 +tools/psb_loc_to_glob.f90 +tools/psb_dspasb.f90 +tools/psb_cdall.f90 +tools/psb_sallc.f90 +tools/psb_ssprn.f90 +tools/psb_dspins.f90 +tools/psb_sspalloc.f90 +tools/psb_cd_inloc.f90 +tools/psb_sfree.f90 +tools/psb_cfree.f90 +modules/psi_c_mod.f90 +modules/psi_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 +modules/desc/psb_repl_map_mod.f90 +modules/desc/psb_desc_const_mod.f90 +modules/desc/psb_gen_block_map_mod.f90 +modules/desc/psb_hash_map_mod.f90 +modules/desc/psb_glist_map_mod.f90 +modules/desc/psb_list_map_mod.f90 +modules/psi_d_mod.f90 +modules/tools/psb_i_tools_mod.f90 +modules/tools/psb_d_tools_mod.f90 +modules/tools/psb_s_tools_mod.f90 +modules/tools/psb_tools_mod.f90 +modules/tools/psb_cd_tools_mod.f90 +modules/tools/psb_z_tools_mod.f90 +modules/tools/psb_c_tools_mod.f90 +modules/psi_s_mod.f90 +modules/comm/psb_d_linmap_mod.f90 +modules/comm/psb_s_linmap_mod.f90 +modules/comm/psb_base_linmap_mod.f90 +modules/comm/psb_i_comm_mod.f90 +modules/comm/psb_c_linmap_mod.f90 +modules/comm/psb_c_comm_mod.f90 +modules/comm/psb_z_comm_mod.f90 +modules/comm/psb_z_linmap_mod.f90 +modules/comm/psb_s_comm_mod.f90 +modules/comm/psb_d_comm_mod.f90 +modules/comm/psb_comm_mod.f90 +modules/comm/psb_linmap_mod.f90 +modules/psblas/psb_psblas_mod.f90 +modules/psi_i_mod.f90 +modules/serial/psb_s_csr_mat_mod.f90 +modules/serial/psb_z_mat_mod.f90 +modules/serial/psb_s_base_mat_mod.f90 +modules/serial/psb_s_base_vect_mod.f90 +modules/serial/psb_z_csc_mat_mod.f90 +modules/serial/psb_d_csr_mat_mod.f90 +modules/serial/psb_s_csc_mat_mod.f90 +modules/serial/psb_i_base_vect_mod.f90 +modules/serial/psb_z_base_vect_mod.f90 +modules/serial/psb_c_csr_mat_mod.f90 +modules/serial/psb_c_serial_mod.f90 +modules/serial/psb_c_base_vect_mod.f90 +modules/serial/psb_s_serial_mod.f90 +modules/serial/psb_d_csc_mat_mod.f90 +modules/serial/psb_vect_mod.f90 +modules/serial/psb_base_mat_mod.f90 +modules/serial/psb_c_csc_mat_mod.f90 +modules/serial/psb_z_base_mat_mod.f90 +modules/serial/psb_z_csr_mat_mod.f90 +modules/serial/psb_c_mat_mod.f90 +modules/serial/psb_d_base_mat_mod.f90 +modules/serial/psb_d_serial_mod.f90 +modules/serial/psb_c_base_mat_mod.f90 +modules/serial/psb_d_base_vect_mod.f90 +modules/serial/psb_serial_mod.f90 +modules/serial/psb_s_mat_mod.f90 +modules/serial/psb_z_serial_mod.f90 +modules/serial/psb_d_mat_mod.f90 +modules/serial/psb_mat_mod.f90 +modules/error.f90 +modules/psb_check_mod.f90 +comm/psb_shalo.f90 +comm/psb_dhalo.f90 +comm/psb_igather.f90 +comm/internals/psi_iovrl_restr.f90 +comm/internals/psi_covrl_upd.f90 +comm/internals/psi_covrl_save.f90 +comm/internals/psi_sovrl_upd.f90 +comm/internals/psi_dovrl_restr.f90 +comm/internals/psi_zovrl_restr.f90 +comm/internals/psi_dovrl_save.f90 +comm/internals/psi_zovrl_save.f90 +comm/internals/psi_sovrl_restr.f90 +comm/internals/psi_zovrl_upd.f90 +comm/internals/psi_sovrl_save.f90 +comm/internals/psi_iovrl_upd.f90 +comm/internals/psi_covrl_restr.f90 +comm/internals/psi_iovrl_save.f90 +comm/internals/psi_dovrl_upd.f90 +comm/psb_iovrl.f90 +comm/psb_cgather.f90 +comm/psb_covrl.f90 +comm/psb_zovrl.f90 +comm/psb_ihalo.f90 +comm/psb_dgather.f90 +comm/psb_sovrl.f90 +comm/psb_dovrl.f90 +comm/psb_zgather.f90 +comm/psb_zhalo.f90 +comm/psb_sgather.f90 +comm/psb_chalo.f90 +psblas/psb_snrmi.f90 +psblas/psb_dspmm.f90 +psblas/psb_samax.f90 +psblas/psb_dspnrm1.f90 +psblas/psb_sspnrm1.f90 +psblas/psb_sspmm.f90 +psblas/psb_dnrmi.f90 +psblas/psb_zamax.f90 +psblas/psb_cspmm.f90 +psblas/psb_dspsm.f90 +psblas/psb_casum.f90 +psblas/psb_cnrmi.f90 +psblas/psb_znrm2.f90 +psblas/psb_zspsm.f90 +psblas/psb_camax.f90 +psblas/psb_dnrm2.f90 +psblas/psb_znrmi.f90 +psblas/psb_cspsm.f90 +psblas/psb_sdot.f90 +psblas/psb_dasum.f90 +psblas/psb_zasum.f90 +psblas/psb_damax.f90 +psblas/psb_zspmm.f90 +psblas/psb_cnrm2.f90 +psblas/psb_ddot.f90 +psblas/psb_caxpby.f90 +psblas/psb_cdot.f90 +psblas/psb_snrm2.f90 +psblas/psb_sspsm.f90 +psblas/psb_daxpby.f90 +psblas/psb_zdot.f90 +psblas/psb_zaxpby.f90 +psblas/psb_zspnrm1.f90 +psblas/psb_sasum.f90 +psblas/psb_saxpby.f90 +psblas/psb_cspnrm1.f90 serial/impl/psb_c_coo_impl.f90 serial/smmp.f90 serial/psb_srwextd.f90 @@ -445,25 +358,9 @@ serial/impl/psb_z_base_mat_impl.F90 modules/cutil.c ) if (SERIAL_MPI) - set(base_source_files ${base_source_files} modules/fakempi.c) + set(PSB_base_source_files ${PSB_base_source_files} modules/fakempi.c) endif() -add_library(base ${base_source_files}) - -set_target_properties(base - PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - SOVERSION ${PSBLAS_SO_VERSION} - OUTPUT_NAME psb_base -) -target_link_libraries(base PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) - -install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - FILES_MATCHING PATTERN "*.mod") - -install(TARGETS base - EXPORT ${CMAKE_PROJECT_NAME}-targets - DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) +foreach(file IN LISTS PSB_base_source_files) + list(APPEND base_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) +endforeach() diff --git a/cmake/CheckOutOfSourceBuild.cmake b/cmake/CheckOutOfSourceBuild.cmake new file mode 100644 index 000000000..ad1769522 --- /dev/null +++ b/cmake/CheckOutOfSourceBuild.cmake @@ -0,0 +1,21 @@ +#-------------------------- +# 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}" + " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}" + "\nThis archive does not support in-source builds:\n" + "You must now delete the CMakeCache.txt file and the CMakeFiles/ directory under " + "the 'src' source directory or you will not be able to configure correctly!" + "\nYou must now run something like:\n" + " $ rm -r CMakeCache.txt CMakeFiles/" + "\n" + "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" + " $ CC=gcc FC=gfortran cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/path/to/install/dir /path/to/psblas3/src/dir \n" + "\nsubstituting the appropriate syntax for your shell (the above line assumes the bash shell)." + ) +endif() diff --git a/krylov/CMakeLists.txt b/krylov/CMakeLists.txt index eed33a90f..9f2fe2d5d 100644 --- a/krylov/CMakeLists.txt +++ b/krylov/CMakeLists.txt @@ -1,152 +1,48 @@ -if (NOT MPI_C_FOUND) - find_package(MPI REQUIRED) - - set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) - set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) - set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) - set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) - include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) -endif() - -if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") - set(gfortran_compiler true) -endif() - -include(CheckIncludeFile) -CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) -if(NOT HAVE_ALLOCA) - add_definitions(-DALLOCA_MISSING) - message(WARNING "Could not find . Assuming functionality is provided elsewhere.") -endif() - -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") -if(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -else() - set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -endif() -set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") -if(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) -else() - set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) -endif() - -set(MPI_HEADERS mpi.h) -include(CheckIncludeFiles) -CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) -if(HAVE_MPI_EXT) - add_definitions(-DHAVE_MPI_EXT_H) - set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) -endif() - -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) -set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) -set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) - -#--------------------------------------------------- -# Windows Intel MPI compatibility, see GH issue #435 -#--------------------------------------------------- -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) - -include(CheckSymbolExists) -CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) -if(HAVE_Intel_MPI AND WIN32) - add_definitions(-DUSE_GCC) -endif() -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) - -set(PSBLAS_SO_VERSION 0) -if(gfortran_compiler) - if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) - set(PSBLAS_SO_VERSION 2) - elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) - set(PSBLAS_SO_VERSION 1) - endif() -endif() - -set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") -set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") -set(MPI_LIBS "") -foreach( lib IN LISTS MPI_Fortran_LIBRARIES) - set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +set(PSB_krylov_source_files + psb_base_krylov_conv_mod.f90 + psb_cbicg.f90 + psb_ccg.F90 + psb_ccgs.f90 + psb_ccgstab.f90 + psb_ccgstabl.f90 + psb_cfcg.F90 + psb_cgcr.f90 + psb_c_krylov_conv_mod.f90 + psb_ckrylov.f90 + psb_crgmres.f90 + psb_dbicg.f90 + psb_dcg.F90 + psb_dcgs.f90 + psb_dcgstab.f90 + psb_dcgstabl.f90 + psb_dfcg.F90 + psb_dgcr.f90 + psb_d_krylov_conv_mod.f90 + psb_dkrylov.f90 + psb_drgmres.f90 + psb_krylov_conv_mod.f90 + psb_krylov_mod.f90 + psb_sbicg.f90 + psb_scg.F90 + psb_scgs.f90 + psb_scgstab.f90 + psb_scgstabl.f90 + psb_sfcg.F90 + psb_sgcr.f90 + psb_s_krylov_conv_mod.f90 + psb_skrylov.f90 + psb_srgmres.f90 + psb_zbicg.f90 + psb_zcg.F90 + psb_zcgs.f90 + psb_zcgstab.f90 + psb_zcgstabl.f90 + psb_zfcg.F90 + psb_zgcr.f90 + psb_z_krylov_conv_mod.f90 + psb_zkrylov.f90 + psb_zrgmres.f90 + ) +foreach(file IN LISTS PSB_krylov_source_files) + list(APPEND krylov_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) endforeach() -string(STRIP "${MPI_LIBS}" MPI_LIBS) - -set(krylov_source_files -psb_base_krylov_conv_mod.f90 -psb_cbicg.f90 -psb_ccg.F90 -psb_ccgs.f90 -psb_ccgstab.f90 -psb_ccgstabl.f90 -psb_cfcg.F90 -psb_cgcr.f90 -psb_c_krylov_conv_mod.f90 -psb_ckrylov.f90 -psb_crgmres.f90 -psb_dbicg.f90 -psb_dcg.F90 -psb_dcgs.f90 -psb_dcgstab.f90 -psb_dcgstabl.f90 -psb_dfcg.F90 -psb_dgcr.f90 -psb_d_krylov_conv_mod.f90 -psb_dkrylov.f90 -psb_drgmres.f90 -psb_krylov_conv_mod.f90 -psb_krylov_mod.f90 -psb_sbicg.f90 -psb_scg.F90 -psb_scgs.f90 -psb_scgstab.f90 -psb_scgstabl.f90 -psb_sfcg.F90 -psb_sgcr.f90 -psb_s_krylov_conv_mod.f90 -psb_skrylov.f90 -psb_srgmres.f90 -psb_zbicg.f90 -psb_zcg.F90 -psb_zcgs.f90 -psb_zcgstab.f90 -psb_zcgstabl.f90 -psb_zfcg.F90 -psb_zgcr.f90 -psb_z_krylov_conv_mod.f90 -psb_zkrylov.f90 -psb_zrgmres.f90 -) - -add_library(krylov ${krylov_source_files}) - -target_link_libraries(krylov PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} prec) - -install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - FILES_MATCHING PATTERN "*.mod") - -set_target_properties ( krylov - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME psb_krylov -) - -install(TARGETS krylov EXPORT ${CMAKE_PROJECT_NAME}-targets - DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) diff --git a/prec/CMakeLists.txt b/prec/CMakeLists.txt index b007acf52..1fe2f5aa9 100644 --- a/prec/CMakeLists.txt +++ b/prec/CMakeLists.txt @@ -1,169 +1,66 @@ -if (NOT MPI_C_FOUND) - find_package(MPI REQUIRED) - set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) - set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) - set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) - set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) - include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) -endif() - -if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") - set(gfortran_compiler true) -endif() - -include(CheckIncludeFile) -CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) -if(NOT HAVE_ALLOCA) - add_definitions(-DALLOCA_MISSING) - message(WARNING "Could not find . Assuming functionality is provided elsewhere.") -endif() - -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") -if(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -else() - set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -endif() -set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") -if(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) -else() - set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) -endif() - -set(MPI_HEADERS mpi.h) -include(CheckIncludeFiles) -CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) -if(HAVE_MPI_EXT) - add_definitions(-DHAVE_MPI_EXT_H) - set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) -endif() - -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) -set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) -set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) - -#--------------------------------------------------- -# Windows Intel MPI compatibility, see GH issue #435 -#--------------------------------------------------- -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) - -include(CheckSymbolExists) -CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) -if(HAVE_Intel_MPI AND WIN32) - add_definitions(-DUSE_GCC) -endif() -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) - -set(PSBLAS_SO_VERSION 0) -if(gfortran_compiler) - if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) - set(PSBLAS_SO_VERSION 2) - elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) - set(PSBLAS_SO_VERSION 1) - endif() -endif() - -set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") -set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") -set(MPI_LIBS "") -foreach( lib IN LISTS MPI_Fortran_LIBRARIES) - set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +set(PSB_prec_source_files + psb_prec_const_mod.f90 + psb_c_prec_mod.f90 + psb_c_base_prec_mod.f90 + psb_d_bjacprec.f90 + psb_z_base_prec_mod.f90 + psb_d_diagprec.f90 + impl/psb_dprecbld.f90 + impl/psb_cprecinit.f90 + impl/psb_dprecinit.f90 + impl/psb_zilu_fct.f90 + impl/psb_silu_fct.f90 + impl/psb_cprecset.f90 + impl/psb_s_prec_type_impl.f90 + impl/psb_dilu_fct.f90 + impl/psb_cprecbld.f90 + impl/psb_c_diagprec_impl.f90 + impl/psb_s_bjacprec_impl.f90 + impl/psb_z_prec_type_impl.f90 + impl/psb_d_nullprec_impl.f90 + impl/psb_c_nullprec_impl.f90 + impl/psb_d_diagprec_impl.f90 + impl/psb_zprecinit.f90 + impl/psb_d_prec_type_impl.f90 + impl/psb_c_prec_type_impl.f90 + impl/psb_s_nullprec_impl.f90 + impl/psb_sprecinit.f90 + impl/psb_z_bjacprec_impl.f90 + impl/psb_d_bjacprec_impl.f90 + impl/psb_z_nullprec_impl.f90 + impl/psb_dprecset.f90 + impl/psb_c_bjacprec_impl.f90 + impl/psb_zprecset.f90 + impl/psb_sprecbld.f90 + impl/psb_cilu_fct.f90 + impl/psb_z_diagprec_impl.f90 + impl/psb_sprecset.f90 + impl/psb_zprecbld.f90 + impl/psb_s_diagprec_impl.f90 + psb_s_base_prec_mod.f90 + psb_s_bjacprec.f90 + psb_c_prec_type.f90 + psb_s_nullprec.f90 + psb_d_nullprec.f90 + psb_prec_mod.f90 + psb_d_prec_type.f90 + psb_z_prec_type.f90 + psb_z_prec_mod.f90 + psb_z_nullprec.f90 + psb_c_diagprec.f90 + psb_z_bjacprec.f90 + psb_s_prec_type.f90 + psb_c_nullprec.f90 + psb_prec_type.f90 + psb_d_prec_mod.f90 + psb_s_diagprec.f90 + psb_c_bjacprec.f90 + psb_s_prec_mod.f90 + psb_z_diagprec.f90 + psb_d_base_prec_mod.f90 + ) + +foreach(file IN LISTS PSB_prec_source_files) + list(APPEND prec_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) endforeach() -string(STRIP "${MPI_LIBS}" MPI_LIBS) - -set(prec_source_files -./psb_prec_const_mod.f90 -./psb_c_prec_mod.f90 -./psb_c_base_prec_mod.f90 -./psb_d_bjacprec.f90 -./psb_z_base_prec_mod.f90 -./psb_d_diagprec.f90 -./impl/psb_dprecbld.f90 -./impl/psb_cprecinit.f90 -./impl/psb_dprecinit.f90 -./impl/psb_zilu_fct.f90 -./impl/psb_silu_fct.f90 -./impl/psb_cprecset.f90 -./impl/psb_s_prec_type_impl.f90 -./impl/psb_dilu_fct.f90 -./impl/psb_cprecbld.f90 -./impl/psb_c_diagprec_impl.f90 -./impl/psb_s_bjacprec_impl.f90 -./impl/psb_z_prec_type_impl.f90 -./impl/psb_d_nullprec_impl.f90 -./impl/psb_c_nullprec_impl.f90 -./impl/psb_d_diagprec_impl.f90 -./impl/psb_zprecinit.f90 -./impl/psb_d_prec_type_impl.f90 -./impl/psb_c_prec_type_impl.f90 -./impl/psb_s_nullprec_impl.f90 -./impl/psb_sprecinit.f90 -./impl/psb_z_bjacprec_impl.f90 -./impl/psb_d_bjacprec_impl.f90 -./impl/psb_z_nullprec_impl.f90 -./impl/psb_dprecset.f90 -./impl/psb_c_bjacprec_impl.f90 -./impl/psb_zprecset.f90 -./impl/psb_sprecbld.f90 -./impl/psb_cilu_fct.f90 -./impl/psb_z_diagprec_impl.f90 -./impl/psb_sprecset.f90 -./impl/psb_zprecbld.f90 -./impl/psb_s_diagprec_impl.f90 -./psb_s_base_prec_mod.f90 -./psb_s_bjacprec.f90 -./psb_c_prec_type.f90 -./psb_s_nullprec.f90 -./psb_d_nullprec.f90 -./psb_prec_mod.f90 -./psb_d_prec_type.f90 -./psb_z_prec_type.f90 -./psb_z_prec_mod.f90 -./psb_z_nullprec.f90 -./psb_c_diagprec.f90 -./psb_z_bjacprec.f90 -./psb_s_prec_type.f90 -./psb_c_nullprec.f90 -./psb_prec_type.f90 -./psb_d_prec_mod.f90 -./psb_s_diagprec.f90 -./psb_c_bjacprec.f90 -./psb_s_prec_mod.f90 -./psb_z_diagprec.f90 -./psb_d_base_prec_mod.f90 -) - -add_library(prec ${prec_source_files}) - - -target_link_libraries(prec PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) - -install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - FILES_MATCHING PATTERN "*.mod") - -set_target_properties ( prec - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME psb_prec -) - -install(TARGETS prec EXPORT ${CMAKE_PROJECT_NAME}-targets - DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 747f8dcd2..811f9bba5 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -1,140 +1,36 @@ -if (NOT MPI_C_FOUND) - find_package(MPI REQUIRED) - - set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}) - set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS}) - set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}) - set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}) - include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH}) -endif() - -if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") - set(gfortran_compiler true) -endif() - -include(CheckIncludeFile) -CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA) -if(NOT HAVE_ALLOCA) - add_definitions(-DALLOCA_MISSING) - message(WARNING "Could not find . Assuming functionality is provided elsewhere.") -endif() - -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") -if(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -else() - set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS}) -endif() -set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}") -if(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES}) -else() - set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES}) -endif() - -set(MPI_HEADERS mpi.h) -include(CheckIncludeFiles) -CHECK_INCLUDE_FILES("mpi.h;mpi-ext.h" HAVE_MPI_EXT) -if(HAVE_MPI_EXT) - add_definitions(-DHAVE_MPI_EXT_H) - set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h) -endif() - -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) -set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags}) -set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries}) - -#--------------------------------------------------- -# Windows Intel MPI compatibility, see GH issue #435 -#--------------------------------------------------- -set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}") -if(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH}) -else() - set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH}) -endif() -CHECK_INCLUDE_FILES("mpi.h" HAVE_MPI_H) - -include(CheckSymbolExists) -CHECK_SYMBOL_EXISTS(I_MPI_VERSION "mpi.h" HAVE_Intel_MPI) -if(HAVE_Intel_MPI AND WIN32) - add_definitions(-DUSE_GCC) -endif() -set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes}) - -set(PSBLAS_SO_VERSION 0) -if(gfortran_compiler) - if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0) - set(PSBLAS_SO_VERSION 2) - elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0.0) - set(PSBLAS_SO_VERSION 1) - endif() -endif() - -set(PSBLAS_MODDIR "${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}") -set(MOD_DIR_FLAG "${CMAKE_Fortran_MODDIR_FLAG}") -set(MPI_LIBS "") -foreach( lib IN LISTS MPI_Fortran_LIBRARIES) - set(MPI_LIBS "${MPI_LIBS} \"${lib}\"") +set(PSB_util_source_files + metis_int.c + psb_amd_order.c + psb_blockpart_mod.f90 + psb_c_hbio_impl.f90 + psb_c_mat_dist_impl.f90 + psb_c_mat_dist_mod.f90 + psb_c_mmio_impl.f90 + psb_c_renum_impl.F90 + psb_d_hbio_impl.f90 + psb_d_mat_dist_impl.f90 + psb_d_mat_dist_mod.f90 + psb_d_mmio_impl.f90 + psb_d_renum_impl.F90 + psb_gps_mod.f90 + psb_hbio_mod.f90 + psb_i_mmio_impl.f90 + psb_mat_dist_mod.f90 + psb_metispart_mod.F90 + psb_mmio_mod.F90 + psb_renum_mod.f90 + psb_s_hbio_impl.f90 + psb_s_mat_dist_impl.f90 + psb_s_mat_dist_mod.f90 + psb_s_mmio_impl.f90 + psb_s_renum_impl.F90 + psb_util_mod.f90 + psb_z_hbio_impl.f90 + psb_z_mat_dist_impl.f90 + psb_z_mat_dist_mod.f90 + psb_z_mmio_impl.f90 + psb_z_renum_impl.F90 + ) +foreach(file IN LISTS PSB_util_source_files) + list(APPEND util_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) endforeach() -string(STRIP "${MPI_LIBS}" MPI_LIBS) - -set(util_source_files -metis_int.c -psb_amd_order.c -psb_blockpart_mod.f90 -psb_c_hbio_impl.f90 -psb_c_mat_dist_impl.f90 -psb_c_mat_dist_mod.f90 -psb_c_mmio_impl.f90 -psb_c_renum_impl.F90 -psb_d_hbio_impl.f90 -psb_d_mat_dist_impl.f90 -psb_d_mat_dist_mod.f90 -psb_d_mmio_impl.f90 -psb_d_renum_impl.F90 -psb_gps_mod.f90 -psb_hbio_mod.f90 -psb_i_mmio_impl.f90 -psb_mat_dist_mod.f90 -psb_metispart_mod.F90 -psb_mmio_mod.F90 -psb_renum_mod.f90 -psb_s_hbio_impl.f90 -psb_s_mat_dist_impl.f90 -psb_s_mat_dist_mod.f90 -psb_s_mmio_impl.f90 -psb_s_renum_impl.F90 -psb_util_mod.f90 -psb_z_hbio_impl.f90 -psb_z_mat_dist_impl.f90 -psb_z_mat_dist_mod.f90 -psb_z_mmio_impl.f90 -psb_z_renum_impl.F90 -) - -add_library(util ${util_source_files}) - -target_link_libraries(util PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} base) - -install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - FILES_MATCHING PATTERN "*.mod") - -set_target_properties ( util - PROPERTIES - SOVERSION ${PSBLAS_SO_VERSION} - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" - POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME psb_util -) - -install(TARGETS util EXPORT ${CMAKE_PROJECT_NAME}-targets - DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) From f9397636e1a40f9497de230d55329c96a100a8a9 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Mon, 17 Dec 2018 17:28:57 -0500 Subject: [PATCH 23/48] Install and stage module files to includedir (cherry picked from commit e695cab90e75820c4db12e47da2763713f4a5317) --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa290c28e..a2e320d8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -285,7 +285,7 @@ add_definitions(-DHAVE_LAPACK) # Use standardized GNU install directory conventions #--------------------------------------------------- include(GNUInstallDirs) -set(mod_dir_tail "${${CMAKE_PROJECT_NAME}_dist_string}_${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}") +#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}") @@ -372,13 +372,13 @@ include(${CMAKE_CURRENT_LIST_DIR}/base/CMakeLists.txt) add_library(base ${base_source_files}) set_target_properties(base PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" POSITION_INDEPENDENT_CODE TRUE OUTPUT_NAME psb_base LINKER_LANGUAGE Fortran ) target_include_directories(base PUBLIC - $ + $ $) if(MPI_FOUND) target_link_libraries(base PUBLIC ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) @@ -389,13 +389,13 @@ include(${CMAKE_CURRENT_LIST_DIR}/prec/CMakeLists.txt) add_library(prec ${prec_source_files}) set_target_properties(prec PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" POSITION_INDEPENDENT_CODE TRUE OUTPUT_NAME psb_prec LINKER_LANGUAGE Fortran ) target_include_directories(prec PUBLIC - $ + $ $) target_link_libraries(prec PUBLIC base) @@ -403,13 +403,13 @@ include(${CMAKE_CURRENT_LIST_DIR}/krylov/CMakeLists.txt) add_library(krylov ${krylov_source_files}) set_target_properties(krylov PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" POSITION_INDEPENDENT_CODE TRUE OUTPUT_NAME psb_krylov LINKER_LANGUAGE Fortran ) target_include_directories(krylov PUBLIC - $ + $ $) target_link_libraries(krylov PUBLIC base prec) @@ -417,13 +417,13 @@ include(${CMAKE_CURRENT_LIST_DIR}/util/CMakeLists.txt) add_library(util ${util_source_files}) set_target_properties(util PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}" + Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" POSITION_INDEPENDENT_CODE TRUE OUTPUT_NAME psb_util LINKER_LANGUAGE Fortran ) target_include_directories(util PUBLIC - $ + $ $) target_link_libraries(util PUBLIC base prec) From 08b653eb2e278db16a15580e6d51d530c5ba4e14 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Thu, 3 Jan 2019 10:37:36 -0500 Subject: [PATCH 24/48] Handle cross-platform eol correctly in git --- .gitattributes | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitattributes b/.gitattributes index 8ee3e4fea..e7ea7fd4f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,6 @@ +# Handle eol correctly: Commit unix-style, checkout as native +* text=auto + # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. *.c text @@ -18,6 +21,17 @@ *.gz binary *.tgz binary *.enc binary +*.pdf binary +*.png binary +*.jpg binary +*.bmp binary +*.gig binary + +# Handle windows specific files correctly +*.sln eol=crlf +*.suo eol=crlf +*.vcxproj eol=crlf +*.vcxitems eol=crlf # Prevent dev-ops files from making it into the release archives .travis.yml export-ignore From 3290dcf14b25b6b9110affd813c15d5b2845546e Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Tue, 8 Jan 2019 16:51:59 -0500 Subject: [PATCH 25/48] Add missing srcs & alphabetize in base CMakeLists --- base/CMakeLists.txt | 665 +++++++++++++++++++++++--------------------- 1 file changed, 355 insertions(+), 310 deletions(-) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index b4a38921a..d18e52907 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -1,361 +1,406 @@ set(PSB_base_source_files -internals/psi_desc_impl.f90 -internals/psi_crea_bnd_elem.f90 +comm/internals/psi_covrl_restr.f90 +comm/internals/psi_covrl_save.f90 +comm/internals/psi_covrl_upd.f90 +comm/internals/psi_cswapdata.F90 +comm/internals/psi_cswaptran.F90 +comm/internals/psi_dovrl_restr.f90 +comm/internals/psi_dovrl_save.f90 +comm/internals/psi_dovrl_upd.f90 +comm/internals/psi_dswapdata.F90 +comm/internals/psi_dswaptran.F90 +comm/internals/psi_iovrl_restr.f90 +comm/internals/psi_iovrl_save.f90 +comm/internals/psi_iovrl_upd.f90 +comm/internals/psi_iswapdata.F90 +comm/internals/psi_iswaptran.F90 +comm/internals/psi_sovrl_restr.f90 +comm/internals/psi_sovrl_save.f90 +comm/internals/psi_sovrl_upd.f90 +comm/internals/psi_sswapdata.F90 +comm/internals/psi_sswaptran.F90 +comm/internals/psi_zovrl_restr.f90 +comm/internals/psi_zovrl_save.f90 +comm/internals/psi_zovrl_upd.f90 +comm/internals/psi_zswapdata.F90 +comm/internals/psi_zswaptran.F90 +comm/psb_cgather.f90 +comm/psb_chalo.f90 +comm/psb_covrl.f90 +comm/psb_cscatter.F90 +comm/psb_cspgather.F90 +comm/psb_dgather.f90 +comm/psb_dhalo.f90 +comm/psb_dovrl.f90 +comm/psb_dscatter.F90 +comm/psb_dspgather.F90 +comm/psb_igather.f90 +comm/psb_ihalo.f90 +comm/psb_iovrl.f90 +comm/psb_iscatter.F90 +comm/psb_sgather.f90 +comm/psb_shalo.f90 +comm/psb_sovrl.f90 +comm/psb_sscatter.F90 +comm/psb_sspgather.F90 +comm/psb_zgather.f90 +comm/psb_zhalo.f90 +comm/psb_zovrl.f90 +comm/psb_zscatter.F90 +comm/psb_zspgather.F90 +internals/psb_indx_map_fnd_owner.F90 +internals/psi_bld_tmphalo.f90 internals/psi_bld_tmphalo.f90 -internals/psi_list_search.f90 -internals/psi_crea_ovr_elem.f90 -internals/psi_compute_size.f90 -internals/psi_dl_check.f90 -internals/psi_exist_ovr_elem.f90 -internals/psi_srtlist.f90 internals/psi_bld_tmpovrl.f90 -internals/psi_crea_index.f90 -internals/psi_sort_dl.f90 -tools/psb_iallc.f90 -tools/psb_c_map.f90 -tools/psb_dspalloc.f90 -tools/psb_cspasb.f90 -tools/psb_dins.f90 -tools/psb_iasb.f90 -tools/psb_sspfree.f90 -tools/psb_cd_lstext.f90 -tools/psb_dsprn.f90 -tools/psb_cins.f90 -tools/psb_csprn.f90 -tools/psb_ifree.f90 -tools/psb_sspasb.f90 -tools/psb_z_map.f90 -tools/psb_zspins.f90 -tools/psb_sins.f90 -tools/psb_cdins.f90 -tools/psb_cspfree.f90 -tools/psb_cdalv.f90 -tools/psb_zallc.f90 -tools/psb_cspins.f90 -tools/psb_dallc.f90 -tools/psb_cdrep.f90 -tools/psb_dspfree.f90 -tools/psb_zspfree.f90 -tools/psb_get_overlap.f90 -tools/psb_cdals.f90 -tools/psb_dfree.f90 -tools/psb_dasb.f90 -tools/psb_zfree.f90 -tools/psb_zins.f90 -tools/psb_cd_switch_ovl_indxmap.f90 -tools/psb_sasb.f90 -internals/psi_desc_impl.f90 +internals/psi_bld_tmpovrl.f90 +internals/psi_compute_size.f90 +internals/psi_compute_size.f90 internals/psi_crea_bnd_elem.f90 -internals/psi_bld_tmphalo.f90 -internals/psi_list_search.f90 +internals/psi_crea_bnd_elem.f90 +internals/psi_crea_index.f90 +internals/psi_crea_index.f90 internals/psi_crea_ovr_elem.f90 -internals/psi_compute_size.f90 +internals/psi_crea_ovr_elem.f90 +internals/psi_desc_impl.f90 +internals/psi_desc_impl.f90 +internals/psi_desc_index.F90 +internals/psi_dl_check.f90 internals/psi_dl_check.f90 internals/psi_exist_ovr_elem.f90 -internals/psi_srtlist.f90 -internals/psi_bld_tmpovrl.f90 -internals/psi_crea_index.f90 +internals/psi_exist_ovr_elem.f90 +internals/psi_extrct_dl.F90 +internals/psi_fnd_owner.F90 +internals/psi_list_search.f90 +internals/psi_list_search.f90 internals/psi_sort_dl.f90 -tools/psb_iallc.f90 -tools/psb_c_map.f90 -tools/psb_dspalloc.f90 -tools/psb_cspasb.f90 -tools/psb_dins.f90 -tools/psb_iasb.f90 -tools/psb_sspfree.f90 -tools/psb_cd_lstext.f90 -tools/psb_dsprn.f90 -tools/psb_cins.f90 -tools/psb_csprn.f90 -tools/psb_ifree.f90 -tools/psb_sspasb.f90 -tools/psb_z_map.f90 -tools/psb_zspins.f90 -tools/psb_sins.f90 -tools/psb_cdins.f90 -tools/psb_cspfree.f90 -tools/psb_cdalv.f90 -tools/psb_zallc.f90 -tools/psb_cspins.f90 -tools/psb_dallc.f90 -tools/psb_cdrep.f90 -tools/psb_dspfree.f90 -tools/psb_zspfree.f90 -tools/psb_get_overlap.f90 -tools/psb_cdals.f90 -tools/psb_dfree.f90 -tools/psb_dasb.f90 -tools/psb_zfree.f90 -tools/psb_zins.f90 -tools/psb_cd_switch_ovl_indxmap.f90 -tools/psb_sasb.f90 -tools/psb_callc.f90 -tools/psb_cd_reinit.f90 -tools/psb_cd_set_bld.f90 -tools/psb_s_map.f90 -tools/psb_cdprt.f90 -tools/psb_glob_to_loc.f90 -tools/psb_zasb.f90 -tools/psb_zspalloc.f90 -tools/psb_cspalloc.f90 -tools/psb_iins.f90 -tools/psb_d_map.f90 -tools/psb_cdren.f90 -tools/psb_casb.f90 -tools/psb_zsprn.f90 -tools/psb_sspins.f90 -tools/psb_zspasb.f90 -tools/psb_loc_to_glob.f90 -tools/psb_dspasb.f90 -tools/psb_cdall.f90 -tools/psb_sallc.f90 -tools/psb_ssprn.f90 -tools/psb_dspins.f90 -tools/psb_sspalloc.f90 -tools/psb_cd_inloc.f90 -tools/psb_sfree.f90 -tools/psb_cfree.f90 -modules/psi_c_mod.f90 -modules/psi_mod.f90 -modules/auxil/psb_string_mod.f90 -modules/auxil/psb_sort_mod.f90 +internals/psi_sort_dl.f90 +internals/psi_srtlist.f90 +internals/psi_srtlist.f90 +modules/auxil/psb_c_sort_mod.f90 +modules/auxil/psb_d_sort_mod.f90 +modules/auxil/psb_hash_mod.f90 +modules/auxil/psb_i_sort_mod.f90 +modules/auxil/psb_ip_reord_mod.f90 modules/auxil/psb_s_sort_mod.f90 +modules/auxil/psb_sort_mod.f90 +modules/auxil/psb_string_mod.f90 +modules/auxil/psb_z_sort_mod.f90 +modules/auxil/psi_c_serial_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 -modules/desc/psb_repl_map_mod.f90 -modules/desc/psb_desc_const_mod.f90 -modules/desc/psb_gen_block_map_mod.f90 -modules/desc/psb_hash_map_mod.f90 -modules/desc/psb_glist_map_mod.f90 -modules/desc/psb_list_map_mod.f90 -modules/psi_d_mod.f90 -modules/tools/psb_i_tools_mod.f90 -modules/tools/psb_d_tools_mod.f90 -modules/tools/psb_s_tools_mod.f90 -modules/tools/psb_tools_mod.f90 -modules/tools/psb_cd_tools_mod.f90 -modules/tools/psb_z_tools_mod.f90 -modules/tools/psb_c_tools_mod.f90 -modules/psi_s_mod.f90 -modules/comm/psb_d_linmap_mod.f90 -modules/comm/psb_s_linmap_mod.f90 +modules/auxil/psi_serial_mod.f90 +modules/auxil/psi_z_serial_mod.f90 modules/comm/psb_base_linmap_mod.f90 -modules/comm/psb_i_comm_mod.f90 -modules/comm/psb_c_linmap_mod.f90 modules/comm/psb_c_comm_mod.f90 -modules/comm/psb_z_comm_mod.f90 -modules/comm/psb_z_linmap_mod.f90 -modules/comm/psb_s_comm_mod.f90 -modules/comm/psb_d_comm_mod.f90 +modules/comm/psb_c_linmap_mod.f90 modules/comm/psb_comm_mod.f90 +modules/comm/psb_d_comm_mod.f90 +modules/comm/psb_d_linmap_mod.f90 +modules/comm/psb_i_comm_mod.f90 modules/comm/psb_linmap_mod.f90 +modules/comm/psb_s_comm_mod.f90 +modules/comm/psb_s_linmap_mod.f90 +modules/comm/psb_z_comm_mod.f90 +modules/comm/psb_z_linmap_mod.f90 +modules/cutil.c +modules/desc/psb_desc_const_mod.f90 +modules/desc/psb_desc_mod.F90 +modules/desc/psb_gen_block_map_mod.f90 +modules/desc/psb_glist_map_mod.f90 +modules/desc/psb_hash_map_mod.f90 +modules/desc/psb_indx_map_mod.f90 +modules/desc/psb_list_map_mod.f90 +modules/desc/psb_repl_map_mod.f90 +modules/error.f90 +modules/psb_base_mod.f90 +modules/psb_check_mod.f90 +modules/psb_const_mod.F90 +modules/psb_error_impl.F90 +modules/psb_error_mod.F90 +modules/psb_penv_mod.F90 +modules/psb_realloc_mod.F90 +modules/psblas/psb_c_psblas_mod.F90 +modules/psblas/psb_d_psblas_mod.F90 modules/psblas/psb_psblas_mod.f90 +modules/psblas/psb_s_psblas_mod.F90 +modules/psblas/psb_z_psblas_mod.F90 +modules/psi_bcast_mod.F90 +modules/psi_c_mod.f90 +modules/psi_comm_buffers_mod.F90 +modules/psi_d_mod.f90 modules/psi_i_mod.f90 -modules/serial/psb_s_csr_mat_mod.f90 -modules/serial/psb_z_mat_mod.f90 +modules/psi_mod.f90 +modules/psi_p2p_mod.F90 +modules/psi_penv_mod.F90 +modules/psi_reduce_mod.F90 +modules/psi_s_mod.f90 +modules/psi_z_mod.f90 +modules/serial/psb_base_mat_mod.f90 +modules/serial/psb_c_base_mat_mod.f90 +modules/serial/psb_c_base_vect_mod.f90 +modules/serial/psb_c_csc_mat_mod.f90 +modules/serial/psb_c_csr_mat_mod.f90 +modules/serial/psb_c_mat_mod.f90 +modules/serial/psb_c_serial_mod.f90 +modules/serial/psb_c_vect_mod.F90 +modules/serial/psb_d_base_mat_mod.f90 +modules/serial/psb_d_base_vect_mod.f90 +modules/serial/psb_d_csc_mat_mod.f90 +modules/serial/psb_d_csr_mat_mod.f90 +modules/serial/psb_d_mat_mod.f90 +modules/serial/psb_d_serial_mod.f90 +modules/serial/psb_d_vect_mod.F90 +modules/serial/psb_i_base_vect_mod.f90 +modules/serial/psb_i_vect_mod.F90 +modules/serial/psb_mat_mod.f90 modules/serial/psb_s_base_mat_mod.f90 modules/serial/psb_s_base_vect_mod.f90 -modules/serial/psb_z_csc_mat_mod.f90 -modules/serial/psb_d_csr_mat_mod.f90 modules/serial/psb_s_csc_mat_mod.f90 -modules/serial/psb_i_base_vect_mod.f90 -modules/serial/psb_z_base_vect_mod.f90 -modules/serial/psb_c_csr_mat_mod.f90 -modules/serial/psb_c_serial_mod.f90 -modules/serial/psb_c_base_vect_mod.f90 +modules/serial/psb_s_csr_mat_mod.f90 +modules/serial/psb_s_mat_mod.f90 modules/serial/psb_s_serial_mod.f90 -modules/serial/psb_d_csc_mat_mod.f90 +modules/serial/psb_s_vect_mod.F90 +modules/serial/psb_serial_mod.f90 modules/serial/psb_vect_mod.f90 -modules/serial/psb_base_mat_mod.f90 -modules/serial/psb_c_csc_mat_mod.f90 modules/serial/psb_z_base_mat_mod.f90 +modules/serial/psb_z_base_vect_mod.f90 +modules/serial/psb_z_csc_mat_mod.f90 modules/serial/psb_z_csr_mat_mod.f90 -modules/serial/psb_c_mat_mod.f90 -modules/serial/psb_d_base_mat_mod.f90 -modules/serial/psb_d_serial_mod.f90 -modules/serial/psb_c_base_mat_mod.f90 -modules/serial/psb_d_base_vect_mod.f90 -modules/serial/psb_serial_mod.f90 -modules/serial/psb_s_mat_mod.f90 +modules/serial/psb_z_mat_mod.f90 modules/serial/psb_z_serial_mod.f90 -modules/serial/psb_d_mat_mod.f90 -modules/serial/psb_mat_mod.f90 -modules/error.f90 -modules/psb_check_mod.f90 -comm/psb_shalo.f90 -comm/psb_dhalo.f90 -comm/psb_igather.f90 -comm/internals/psi_iovrl_restr.f90 -comm/internals/psi_covrl_upd.f90 -comm/internals/psi_covrl_save.f90 -comm/internals/psi_sovrl_upd.f90 -comm/internals/psi_dovrl_restr.f90 -comm/internals/psi_zovrl_restr.f90 -comm/internals/psi_dovrl_save.f90 -comm/internals/psi_zovrl_save.f90 -comm/internals/psi_sovrl_restr.f90 -comm/internals/psi_zovrl_upd.f90 -comm/internals/psi_sovrl_save.f90 -comm/internals/psi_iovrl_upd.f90 -comm/internals/psi_covrl_restr.f90 -comm/internals/psi_iovrl_save.f90 -comm/internals/psi_dovrl_upd.f90 -comm/psb_iovrl.f90 -comm/psb_cgather.f90 -comm/psb_covrl.f90 -comm/psb_zovrl.f90 -comm/psb_ihalo.f90 -comm/psb_dgather.f90 -comm/psb_sovrl.f90 -comm/psb_dovrl.f90 -comm/psb_zgather.f90 -comm/psb_zhalo.f90 -comm/psb_sgather.f90 -comm/psb_chalo.f90 -psblas/psb_snrmi.f90 -psblas/psb_dspmm.f90 -psblas/psb_samax.f90 -psblas/psb_dspnrm1.f90 -psblas/psb_sspnrm1.f90 -psblas/psb_sspmm.f90 -psblas/psb_dnrmi.f90 -psblas/psb_zamax.f90 -psblas/psb_cspmm.f90 -psblas/psb_dspsm.f90 +modules/serial/psb_z_vect_mod.F90 +modules/tools/psb_c_tools_mod.f90 +modules/tools/psb_cd_tools_mod.f90 +modules/tools/psb_d_tools_mod.f90 +modules/tools/psb_i_tools_mod.f90 +modules/tools/psb_s_tools_mod.f90 +modules/tools/psb_tools_mod.f90 +modules/tools/psb_z_tools_mod.f90 +psblas/psb_camax.f90 psblas/psb_casum.f90 +psblas/psb_caxpby.f90 +psblas/psb_cdot.f90 +psblas/psb_cnrm2.f90 psblas/psb_cnrmi.f90 -psblas/psb_znrm2.f90 -psblas/psb_zspsm.f90 -psblas/psb_camax.f90 -psblas/psb_dnrm2.f90 -psblas/psb_znrmi.f90 +psblas/psb_cspmm.f90 +psblas/psb_cspnrm1.f90 psblas/psb_cspsm.f90 -psblas/psb_sdot.f90 -psblas/psb_dasum.f90 -psblas/psb_zasum.f90 psblas/psb_damax.f90 -psblas/psb_zspmm.f90 -psblas/psb_cnrm2.f90 +psblas/psb_dasum.f90 +psblas/psb_daxpby.f90 psblas/psb_ddot.f90 -psblas/psb_caxpby.f90 -psblas/psb_cdot.f90 +psblas/psb_dnrm2.f90 +psblas/psb_dnrmi.f90 +psblas/psb_dspmm.f90 +psblas/psb_dspnrm1.f90 +psblas/psb_dspsm.f90 +psblas/psb_samax.f90 +psblas/psb_sasum.f90 +psblas/psb_saxpby.f90 +psblas/psb_sdot.f90 psblas/psb_snrm2.f90 +psblas/psb_snrmi.f90 +psblas/psb_sspmm.f90 +psblas/psb_sspnrm1.f90 psblas/psb_sspsm.f90 -psblas/psb_daxpby.f90 -psblas/psb_zdot.f90 +psblas/psb_zamax.f90 +psblas/psb_zasum.f90 psblas/psb_zaxpby.f90 +psblas/psb_zdot.f90 +psblas/psb_znrm2.f90 +psblas/psb_znrmi.f90 +psblas/psb_zspmm.f90 psblas/psb_zspnrm1.f90 -psblas/psb_sasum.f90 -psblas/psb_saxpby.f90 -psblas/psb_cspnrm1.f90 +psblas/psb_zspsm.f90 +serial/impl/psb_s_coo_impl.f90 +serial/impl/psb_s_csr_impl.f90 +serial/impl/psb_c_base_mat_impl.F90 +serial/impl/psb_base_mat_impl.f90 +serial/impl/psb_d_mat_impl.F90 +serial/impl/psb_d_csc_impl.f90 +serial/impl/psb_c_mat_impl.F90 +serial/impl/psb_c_csc_impl.f90 +serial/impl/psb_z_csc_impl.f90 +serial/impl/psb_z_mat_impl.F90 +serial/impl/psb_d_base_mat_impl.F90 +serial/impl/psb_z_base_mat_impl.F90 +serial/impl/psb_d_coo_impl.f90 serial/impl/psb_c_coo_impl.f90 -serial/smmp.f90 -serial/psb_srwextd.f90 -serial/psb_camax_s.f90 -serial/psb_ssymbmm.f90 -serial/psb_cgeprt.f90 -serial/psb_zasum_s.f90 -serial/psi_d_serial_impl.f90 -serial/psb_znumbmm.f90 -serial/psb_cspspmm.f90 -serial/psb_sgeprt.f90 -serial/psb_samax_s.f90 +serial/impl/psb_s_base_mat_impl.F90 +serial/impl/psb_z_csr_impl.f90 +serial/impl/psb_d_csr_impl.f90 +serial/impl/psb_c_csr_impl.f90 +serial/impl/psb_z_coo_impl.f90 +serial/impl/psb_s_mat_impl.F90 +serial/impl/psb_s_csc_impl.f90 +serial/psi_z_serial_impl.f90 serial/psb_sasum_s.f90 -serial/psi_i_serial_impl.f90 -serial/psb_aspxpby.f90 +serial/psb_damax_s.f90 +serial/psb_dnumbmm.f90 +serial/psb_drwextd.f90 +serial/psb_zgeprt.f90 +serial/psb_dgelp.f90 +serial/psb_csymbmm.f90 serial/psb_zamax_s.f90 -serial/psi_c_serial_impl.f90 serial/psb_sspspmm.f90 -serial/psb_cnumbmm.f90 -serial/psi_s_serial_impl.f90 -serial/psb_dspspmm.f90 +serial/psb_dgeprt.f90 +serial/psb_spdot_srtd.f90 +serial/psb_znumbmm.f90 +serial/psb_zrwextd.f90 +serial/psb_lsame.f90 +serial/sort/psb_s_qsort_impl.f90 +serial/sort/psi_lcx_mod.f90 +serial/sort/psb_z_hsort_impl.f90 +serial/sort/psb_i_msort_impl.f90 +serial/sort/psb_s_isort_impl.f90 +serial/sort/psi_acx_mod.f90 +serial/sort/psb_z_isort_impl.f90 +serial/sort/psb_z_qsort_impl.f90 +serial/sort/psb_s_hsort_impl.f90 +serial/sort/psb_d_msort_impl.f90 +serial/sort/psb_c_msort_impl.f90 +serial/sort/psb_d_hsort_impl.f90 +serial/sort/psb_c_hsort_impl.f90 +serial/sort/psb_d_isort_impl.f90 +serial/sort/psb_c_qsort_impl.f90 +serial/sort/psb_c_isort_impl.f90 +serial/sort/psb_d_qsort_impl.f90 +serial/sort/psb_i_isort_impl.f90 +serial/sort/psi_alcx_mod.f90 +serial/sort/psb_i_qsort_impl.f90 +serial/sort/psb_s_msort_impl.f90 +serial/sort/psb_i_hsort_impl.f90 +serial/sort/psb_z_msort_impl.f90 +serial/psb_cgeprt.f90 +serial/smmp.f90 serial/psb_zsymbmm.f90 -serial/psb_cgelp.f90 -serial/psb_dnumbmm.f90 -serial/psb_csymbmm.f90 +serial/psi_s_serial_impl.f90 +serial/psi_i_serial_impl.f90 serial/psb_zgelp.f90 serial/psb_dsymbmm.f90 -serial/psb_damax_s.f90 +serial/psb_aspxpby.f90 +serial/psb_crwextd.f90 +serial/psb_cnumbmm.f90 +serial/psb_sgelp.f90 +serial/psb_camax_s.f90 +serial/psb_cgelp.f90 +serial/psi_d_serial_impl.f90 +serial/psb_dasum_s.f90 +serial/psb_zspspmm.f90 +serial/psb_samax_s.f90 serial/psb_snumbmm.f90 -serial/psb_drwextd.f90 +serial/psb_srwextd.f90 +serial/psb_dspspmm.f90 +serial/psi_c_serial_impl.f90 +serial/psb_sgeprt.f90 +serial/psb_zasum_s.f90 +serial/psb_cspspmm.f90 serial/psb_spge_dot.f90 -serial/psb_spdot_srtd.f90 -serial/psb_crwextd.f90 -internals/psb_indx_map_fnd_owner.F90 -internals/psi_desc_index.F90 -internals/psi_fnd_owner.F90 -internals/psi_extrct_dl.F90 -tools/psb_icdasb.F90 -tools/psb_dsphalo.F90 -tools/psb_zcdbldext.F90 -tools/psb_scdbldext.F90 -tools/psb_zsphalo.F90 +serial/psb_casum_s.f90 +serial/psb_ssymbmm.f90 +tools/psb_c_map.f90 +tools/psb_c_map.f90 +tools/psb_callc.f90 +tools/psb_casb.f90 tools/psb_ccdbldext.F90 +tools/psb_cd_inloc.f90 +tools/psb_cd_lstext.f90 +tools/psb_cd_lstext.f90 +tools/psb_cd_reinit.f90 +tools/psb_cd_set_bld.f90 +tools/psb_cd_switch_ovl_indxmap.f90 +tools/psb_cd_switch_ovl_indxmap.f90 +tools/psb_cdall.f90 +tools/psb_cdals.f90 +tools/psb_cdals.f90 +tools/psb_cdalv.f90 +tools/psb_cdalv.f90 tools/psb_cdcpy.F90 -tools/psb_ssphalo.F90 +tools/psb_cdins.f90 +tools/psb_cdins.f90 +tools/psb_cdprt.f90 +tools/psb_cdren.f90 +tools/psb_cdrep.f90 +tools/psb_cdrep.f90 +tools/psb_cfree.f90 +tools/psb_cins.f90 +tools/psb_cins.f90 +tools/psb_cspalloc.f90 +tools/psb_cspasb.f90 +tools/psb_cspasb.f90 +tools/psb_cspfree.f90 +tools/psb_cspfree.f90 tools/psb_csphalo.F90 +tools/psb_cspins.f90 +tools/psb_cspins.f90 +tools/psb_csprn.f90 +tools/psb_csprn.f90 +tools/psb_d_map.f90 +tools/psb_dallc.f90 +tools/psb_dallc.f90 +tools/psb_dasb.f90 +tools/psb_dasb.f90 tools/psb_dcdbldext.F90 -modules/psb_penv_mod.F90 -modules/psi_comm_buffers_mod.F90 -modules/psi_p2p_mod.F90 -modules/desc/psb_desc_mod.F90 -modules/psi_penv_mod.F90 -modules/psb_error_impl.F90 -modules/psb_realloc_mod.F90 -modules/psb_error_mod.F90 -modules/psblas/psb_s_psblas_mod.F90 -modules/psblas/psb_d_psblas_mod.F90 -modules/psblas/psb_c_psblas_mod.F90 -modules/psblas/psb_z_psblas_mod.F90 -modules/psi_reduce_mod.F90 -modules/psb_const_mod.F90 -modules/serial/psb_i_vect_mod.F90 -modules/serial/psb_c_vect_mod.F90 -modules/serial/psb_d_vect_mod.F90 -modules/serial/psb_z_vect_mod.F90 -modules/serial/psb_s_vect_mod.F90 -modules/psi_bcast_mod.F90 -comm/psb_zspgather.F90 -comm/psb_dscatter.F90 -comm/psb_zscatter.F90 -comm/internals/psi_dswapdata.F90 -comm/internals/psi_sswaptran.F90 -comm/internals/psi_sswapdata.F90 -comm/internals/psi_cswaptran.F90 -comm/internals/psi_iswapdata.F90 -comm/internals/psi_zswaptran.F90 -comm/internals/psi_iswaptran.F90 -comm/internals/psi_dswaptran.F90 -comm/internals/psi_zswapdata.F90 -comm/internals/psi_cswapdata.F90 -comm/psb_cspgather.F90 -comm/psb_iscatter.F90 -comm/psb_sscatter.F90 -comm/psb_sspgather.F90 -comm/psb_cscatter.F90 -comm/psb_dspgather.F90 -serial/impl/psb_c_base_mat_impl.F90 -serial/impl/psb_s_mat_impl.F90 -serial/impl/psb_z_mat_impl.F90 -serial/impl/psb_d_base_mat_impl.F90 -serial/impl/psb_c_mat_impl.F90 -serial/impl/psb_s_base_mat_impl.F90 -serial/impl/psb_d_mat_impl.F90 -serial/impl/psb_z_base_mat_impl.F90 -modules/cutil.c +tools/psb_dfree.f90 +tools/psb_dfree.f90 +tools/psb_dins.f90 +tools/psb_dins.f90 +tools/psb_dspalloc.f90 +tools/psb_dspalloc.f90 +tools/psb_dspasb.f90 +tools/psb_dspfree.f90 +tools/psb_dspfree.f90 +tools/psb_dsphalo.F90 +tools/psb_dspins.f90 +tools/psb_dsprn.f90 +tools/psb_dsprn.f90 +tools/psb_get_overlap.f90 +tools/psb_get_overlap.f90 +tools/psb_glob_to_loc.f90 +tools/psb_iallc.f90 +tools/psb_iallc.f90 +tools/psb_iasb.f90 +tools/psb_iasb.f90 +tools/psb_icdasb.F90 +tools/psb_ifree.f90 +tools/psb_ifree.f90 +tools/psb_iins.f90 +tools/psb_loc_to_glob.f90 +tools/psb_s_map.f90 +tools/psb_sallc.f90 +tools/psb_sasb.f90 +tools/psb_sasb.f90 +tools/psb_scdbldext.F90 +tools/psb_sfree.f90 +tools/psb_sins.f90 +tools/psb_sins.f90 +tools/psb_sspalloc.f90 +tools/psb_sspasb.f90 +tools/psb_sspasb.f90 +tools/psb_sspfree.f90 +tools/psb_sspfree.f90 +tools/psb_ssphalo.F90 +tools/psb_sspins.f90 +tools/psb_ssprn.f90 +tools/psb_z_map.f90 +tools/psb_z_map.f90 +tools/psb_zallc.f90 +tools/psb_zallc.f90 +tools/psb_zasb.f90 +tools/psb_zcdbldext.F90 +tools/psb_zfree.f90 +tools/psb_zfree.f90 +tools/psb_zins.f90 +tools/psb_zins.f90 +tools/psb_zspalloc.f90 +tools/psb_zspasb.f90 +tools/psb_zspfree.f90 +tools/psb_zspfree.f90 +tools/psb_zsphalo.F90 +tools/psb_zspins.f90 +tools/psb_zspins.f90 +tools/psb_zsprn.f90 ) if (SERIAL_MPI) set(PSB_base_source_files ${PSB_base_source_files} modules/fakempi.c) From 7ee5a6af7c1f32e592200b123f01aba75234f2a8 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 06:58:46 -0500 Subject: [PATCH 26/48] This should fix psblas errors on windows --- CMakeLists.txt | 67 ++++++++++++++++---------- base/CMakeLists.txt | 16 +++++-- base/modules/gettimeofday.c | 59 +++++++++++++++++++++++ cmake/FindMETIS.cmake | 95 +++++++++++++++++++++++++++++++++++++ util/CMakeLists.txt | 10 +++- 5 files changed, 215 insertions(+), 32 deletions(-) create mode 100644 base/modules/gettimeofday.c create mode 100644 cmake/FindMETIS.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a2e320d8b..87419b827 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,10 +277,18 @@ endif() #------------------------------ # Find Linear Algebra Libraries #------------------------------ +#set(BLA_STATIC 1) find_package(BLAS REQUIRED) find_package(LAPACK REQUIRED) add_definitions(-DHAVE_LAPACK) + +#-------------------------------- +# Find METIS partitioning library +#-------------------------------- +include(${CMAKE_CURRENT_LIST_DIR}/cmake/FindMETIS.cmake) +find_package(METIS) + #--------------------------------------------------- # Use standardized GNU install directory conventions #--------------------------------------------------- @@ -336,29 +344,29 @@ install( if(MPI_FOUND) -#------------------------------------------ -# Add portable unistall command to makefile -#------------------------------------------ -# Adapted from the CMake Wiki FAQ -configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_DIR}/uninstall.cmake" + #------------------------------------------ + # Add portable unistall command to makefile + #------------------------------------------ + # Adapted from the CMake Wiki FAQ + configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_DIR}/uninstall.cmake" @ONLY) -add_custom_target ( uninstall - COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/uninstall.cmake" ) - -add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) -# See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend -# on the test executables - -#---------------------------------- -# Determine if we're using Open MPI -#--------------------------------- -execute_process(COMMAND ${MPIEXEC} --version - OUTPUT_VARIABLE mpi_version_out) -if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]") - message( STATUS "OpenMPI detected") - set ( openmpi true ) -endif () + add_custom_target ( uninstall + COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/uninstall.cmake" ) + + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) + # See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend + # on the test executables + + #---------------------------------- + # Determine if we're using Open MPI + #--------------------------------- + execute_process(COMMAND ${MPIEXEC} --version + OUTPUT_VARIABLE mpi_version_out) + if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]") + message( STATUS "OpenMPI detected") + set ( openmpi true ) + endif() endif() #--------------------------------------- @@ -369,7 +377,8 @@ endif() # cbind.a, util.a krylov.a prec.a base.a include(${CMAKE_CURRENT_LIST_DIR}/base/CMakeLists.txt) -add_library(base ${base_source_files}) +add_library(base_C OBJECT ${base_source_C_files}) +add_library(base ${base_source_files} $) set_target_properties(base PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" @@ -383,7 +392,9 @@ target_include_directories(base PUBLIC if(MPI_FOUND) target_link_libraries(base PUBLIC ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) endif() - +target_link_libraries(base + PUBLIC ${LAPACK_LINKER_FLAGS} ${LAPACK_LIBRARIES} ${LAPACK95_LIBRARIES} + PUBLIC ${BLAS_LINKER_FLAGS} ${BLAS_LIBRARIES} ${BLAS95_LIBRARIES}) include(${CMAKE_CURRENT_LIST_DIR}/prec/CMakeLists.txt) add_library(prec ${prec_source_files}) @@ -414,7 +425,8 @@ target_include_directories(krylov PUBLIC target_link_libraries(krylov PUBLIC base prec) include(${CMAKE_CURRENT_LIST_DIR}/util/CMakeLists.txt) -add_library(util ${util_source_files}) +add_library(util_C OBJECT ${util_source_C_files}) +add_library(util ${util_source_files} $) set_target_properties(util PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" @@ -426,7 +438,12 @@ target_include_directories(util PUBLIC $ $) target_link_libraries(util PUBLIC base prec) - +if(METIS_FOUND) + target_include_directories(util + PUBLIC ${METIS_INCLUDES}) + target_link_libraries(util + PUBLIC ${METIS_LIBRARIES}) +endif() install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index d18e52907..abe85e552 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -103,7 +103,6 @@ modules/comm/psb_s_comm_mod.f90 modules/comm/psb_s_linmap_mod.f90 modules/comm/psb_z_comm_mod.f90 modules/comm/psb_z_linmap_mod.f90 -modules/cutil.c modules/desc/psb_desc_const_mod.f90 modules/desc/psb_desc_mod.F90 modules/desc/psb_gen_block_map_mod.f90 @@ -402,10 +401,17 @@ tools/psb_zspins.f90 tools/psb_zspins.f90 tools/psb_zsprn.f90 ) -if (SERIAL_MPI) - set(PSB_base_source_files ${PSB_base_source_files} modules/fakempi.c) -endif() - foreach(file IN LISTS PSB_base_source_files) list(APPEND base_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) endforeach() + +list(APPEND PSB_base_source_C_files modules/cutil.c) +if (SERIAL_MPI) + list(APPEND PSB_base_source_C_files modules/fakempi.c) +endif() +if(WIN32) + list(APPEND PSB_base_source_C_files modules/gettimeofday.c) +endif() +foreach(file IN LISTS PSB_base_source_C_files) + list(APPEND base_source_C_files ${CMAKE_CURRENT_LIST_DIR}/${file}) +endforeach() diff --git a/base/modules/gettimeofday.c b/base/modules/gettimeofday.c new file mode 100644 index 000000000..46d16519d --- /dev/null +++ b/base/modules/gettimeofday.c @@ -0,0 +1,59 @@ +/* + * gettimeofday.c + * Win32 gettimeofday() replacement + * + * src/port/gettimeofday.c + * + * Copyright (c) 2003 SRA, Inc. + * Copyright (c) 2003 SKC, Inc. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose, without fee, and without a + * written agreement is hereby granted, provided that the above + * copyright notice and this paragraph and the following two + * paragraphs appear in all copies. + * + * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, + * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING + * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS + * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS + * IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, + * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "c.h" + +#include + + +/* FILETIME of Jan 1 1970 00:00:00. */ +static const unsigned __int64 epoch = ((unsigned __int64) 116444736000000000ULL); + +/* + * timezone information is stored outside the kernel so tzp isn't used anymore. + * + * Note: this function is not for Win32 high precision timing purpose. See + * elapsed_time(). + */ +int +gettimeofday(struct timeval * tp, struct timezone * tzp) +{ + FILETIME file_time; + SYSTEMTIME system_time; + ULARGE_INTEGER ularge; + + GetSystemTime(&system_time); + SystemTimeToFileTime(&system_time, &file_time); + ularge.LowPart = file_time.dwLowDateTime; + ularge.HighPart = file_time.dwHighDateTime; + + tp->tv_sec = (long) ((ularge.QuadPart - epoch) / 10000000L); + tp->tv_usec = (long) (system_time.wMilliseconds * 1000); + + return 0; +} diff --git a/cmake/FindMETIS.cmake b/cmake/FindMETIS.cmake new file mode 100644 index 000000000..21f95f572 --- /dev/null +++ b/cmake/FindMETIS.cmake @@ -0,0 +1,95 @@ +if (METIS_INCLUDES AND METIS_LIBRARIES) + set(METIS_FIND_QUIETLY TRUE) +endif (METIS_INCLUDES AND METIS_LIBRARIES) + +if( DEFINED ENV{METISDIR} ) + if( NOT DEFINED METIS_ROOT ) + set(METIS_ROOT "$ENV{METISDIR}") + endif() +endif() + +if( (DEFINED ENV{METIS_ROOT}) OR (DEFINED METIS_ROOT) ) + if( NOT DEFINED METIS_ROOT) + set(METIS_ROOT "$ENV{METIS_ROOT}") + endif() + set(METIS_HINTS "${METIS_ROOT}") +endif() + +find_path(METIS_INCLUDES + NAMES + metis.h + HINTS + ${METIS_HINTS} + PATHS + "${INCLUDE_INSTALL_DIR}" + /usr/local/opt + /usr/local + PATH_SUFFIXES + include + ) + +if(METIS_INCLUDES) + foreach(include IN_LISTS METIS_INCLUDES) + get_filename_component(mts_include_dir "${include}" DIRECTORY) + get_filename_component(mts_abs_include_dir "${mts_include_dir}" ABSOLUTE) + get_filename_component(new_mts_hint "${include_dir}/.." ABSOLUTE ) + list(APPEND METIS_HINTS "${new_mts_hint}") + break() + endforeach() +endif() + +if(METIS_HINTS) + list(REMOVE_DUPLICATES METIS_HINTS) +endif() + +macro(_metis_check_version) + file(READ "${METIS_INCLUDES}/metis.h" _metis_version_header) + + string(REGEX MATCH "define[ \t]+METIS_VER_MAJOR[ \t]+([0-9]+)" _metis_major_version_match "${_metis_version_header}") + set(METIS_MAJOR_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+METIS_VER_MINOR[ \t]+([0-9]+)" _metis_minor_version_match "${_metis_version_header}") + set(METIS_MINOR_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+METIS_VER_SUBMINOR[ \t]+([0-9]+)" _metis_subminor_version_match "${_metis_version_header}") + set(METIS_SUBMINOR_VERSION "${CMAKE_MATCH_1}") + if(NOT METIS_MAJOR_VERSION) + message(STATUS "Could not determine Metis version. Assuming version 4.0.0") + set(METIS_VERSION 4.0.0) + else() + set(METIS_VERSION ${METIS_MAJOR_VERSION}.${METIS_MINOR_VERSION}.${METIS_SUBMINOR_VERSION}) + endif() + if(${METIS_VERSION} VERSION_LESS ${Metis_FIND_VERSION}) + set(METIS_VERSION_OK FALSE) + else() + set(METIS_VERSION_OK TRUE) + endif() + + if(NOT METIS_VERSION_OK) + message(STATUS "Metis version ${METIS_VERSION} found in ${METIS_INCLUDES}, " + "but at least version ${Metis_FIND_VERSION} is required") + endif(NOT METIS_VERSION_OK) +endmacro(_metis_check_version) + +if(METIS_INCLUDES AND Metis_FIND_VERSION) + _metis_check_version() +else() + set(METIS_VERSION_OK TRUE) +endif() + + +find_library(METIS_LIBRARIES metis + HINTS + ${METIS_HINTS} + PATHS + "${LIB_INSTALL_DIR}" + /usr/local/ + /usr/local/opt + PATH_SUFFIXES + lib + lib64 + metis/lib) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(METIS DEFAULT_MSG + METIS_INCLUDES METIS_LIBRARIES METIS_VERSION_OK) + +mark_as_advanced(METIS_INCLUDES METIS_LIBRARIES) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 811f9bba5..5c77191e7 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -1,6 +1,4 @@ set(PSB_util_source_files - metis_int.c - psb_amd_order.c psb_blockpart_mod.f90 psb_c_hbio_impl.f90 psb_c_mat_dist_impl.f90 @@ -34,3 +32,11 @@ set(PSB_util_source_files foreach(file IN LISTS PSB_util_source_files) list(APPEND util_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) endforeach() + +set(PSB_util_source_C_files + metis_int.c + psb_amd_order.c + ) +foreach(file IN LISTS PSB_util_source_C_files) + list(APPEND util_source_C_files ${CMAKE_CURRENT_LIST_DIR}/${file}) +endforeach() From d8f7e0e11185ae7e3f0b328495ec2d3efabe40b0 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 07:01:17 -0500 Subject: [PATCH 27/48] Tell git to ignore psblas build directory --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9939c5daa..8f206ff1d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ *.mod *~ +build + # header files generated cbind/*.h From 104a827e03216b9f0bc41de8310385e88f9b1cc5 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 07:22:48 -0500 Subject: [PATCH 28/48] Correctly set defines when METIS found --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87419b827..d39ddbee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -439,10 +439,15 @@ target_include_directories(util PUBLIC $) target_link_libraries(util PUBLIC base prec) if(METIS_FOUND) + message(STATUS ${METIS_INCLUDES}) target_include_directories(util PUBLIC ${METIS_INCLUDES}) target_link_libraries(util PUBLIC ${METIS_LIBRARIES}) + target_compile_definitions(util_C + PUBLIC HAVE_METIS_) + target_compile_definitions(util + PUBLIC HAVE_METIS) endif() install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" From db917d5bb5abe2e85ce65b3881a3295b7c6f4508 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 07:37:48 -0500 Subject: [PATCH 29/48] Fix finding metis header --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d39ddbee3..bdd5f33e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -442,6 +442,8 @@ if(METIS_FOUND) message(STATUS ${METIS_INCLUDES}) target_include_directories(util PUBLIC ${METIS_INCLUDES}) + target_include_directories(util_C + PUBLIC ${METIS_INCLUDES}) target_link_libraries(util PUBLIC ${METIS_LIBRARIES}) target_compile_definitions(util_C From 0fe562b5b0feec4ff59449a166c8364f9c8cb16e Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 11:39:34 -0500 Subject: [PATCH 30/48] Attempt fix for missing windows includes --- base/modules/cutil.c | 7 ++- base/modules/fakempi.c | 5 ++ base/modules/gettimeofday.c | 101 ++++++++++++++++-------------------- 3 files changed, 56 insertions(+), 57 deletions(-) diff --git a/base/modules/cutil.c b/base/modules/cutil.c index 13b7e1e94..094911931 100644 --- a/base/modules/cutil.c +++ b/base/modules/cutil.c @@ -1,4 +1,9 @@ +#ifdef WIN32 +#include +#include +#else #include +#endif #include #include #include "psb_internals.h" @@ -15,7 +20,7 @@ #ifdef UpperUnderscore #define psi_c_diffadd PSI_C_DIFFADD_ #endif -#ifdef UpperDoubleUnderscore +#ifdef UpperDoubleUnderscore #define psi_c_diffadd PSI_C_DIFFADD__ #endif #ifdef UpperCase diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index 9bf817334..e9b54f634 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,4 +1,9 @@ +#ifdef WIN32 +#include +#include +#else #include +#endif #include #include #include "psb_internals.h" diff --git a/base/modules/gettimeofday.c b/base/modules/gettimeofday.c index 46d16519d..be0422717 100644 --- a/base/modules/gettimeofday.c +++ b/base/modules/gettimeofday.c @@ -1,59 +1,48 @@ -/* - * gettimeofday.c - * Win32 gettimeofday() replacement - * - * src/port/gettimeofday.c - * - * Copyright (c) 2003 SRA, Inc. - * Copyright (c) 2003 SKC, Inc. - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose, without fee, and without a - * written agreement is hereby granted, provided that the above - * copyright notice and this paragraph and the following two - * paragraphs appear in all copies. - * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, - * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING - * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS - * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS - * IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, - * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -#include "c.h" - -#include - - -/* FILETIME of Jan 1 1970 00:00:00. */ -static const unsigned __int64 epoch = ((unsigned __int64) 116444736000000000ULL); - -/* - * timezone information is stored outside the kernel so tzp isn't used anymore. - * - * Note: this function is not for Win32 high precision timing purpose. See - * elapsed_time(). - */ -int -gettimeofday(struct timeval * tp, struct timezone * tzp) +#include +#include +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +struct timezone { - FILETIME file_time; - SYSTEMTIME system_time; - ULARGE_INTEGER ularge; - - GetSystemTime(&system_time); - SystemTimeToFileTime(&system_time, &file_time); - ularge.LowPart = file_time.dwLowDateTime; - ularge.HighPart = file_time.dwHighDateTime; + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; - tp->tv_sec = (long) ((ularge.QuadPart - epoch) / 10000000L); - tp->tv_usec = (long) (system_time.wMilliseconds * 1000); - - return 0; +int gettimeofday(struct timeval *tv, struct timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tmpres /= 10; /*convert into microseconds*/ + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; } From cdf006c75ea5c6723ed95ffe0e67b22aa6885a48 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 13:47:16 -0500 Subject: [PATCH 31/48] Try to define a header for mpi_wtime --- base/modules/fakempi.c | 5 +++-- base/modules/gettimeofday.h | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 base/modules/gettimeofday.h diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index e9b54f634..22666c9bd 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,11 +1,12 @@ +#include +#include #ifdef WIN32 #include #include +#include "gettimeofday.h" #else #include #endif -#include -#include #include "psb_internals.h" diff --git a/base/modules/gettimeofday.h b/base/modules/gettimeofday.h new file mode 100644 index 000000000..67673b2c4 --- /dev/null +++ b/base/modules/gettimeofday.h @@ -0,0 +1,15 @@ +#include +#include +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +int gettimeofday(struct timeval *tv, struct timezone *tz); From ac5721677dd5dea02e19e73c466c213affd65f45 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 14:00:50 -0500 Subject: [PATCH 32/48] Fix _WIN32 macro --- base/modules/cutil.c | 2 +- base/modules/fakempi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/modules/cutil.c b/base/modules/cutil.c index 094911931..2eac4e1c9 100644 --- a/base/modules/cutil.c +++ b/base/modules/cutil.c @@ -1,4 +1,4 @@ -#ifdef WIN32 +#ifdef _WIN32 #include #include #else diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index 22666c9bd..f0e8a5d1b 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,6 +1,6 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #include #include "gettimeofday.h" From bb45b4092dddaee92c21812bfbfb79172874ce54 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 14:10:47 -0500 Subject: [PATCH 33/48] Re-order include and try typedef --- base/CMakeLists.txt | 2 +- base/modules/cutil.c | 2 +- base/modules/fakempi.c | 8 ++++---- base/modules/gettimeofday.c | 4 ++-- base/modules/gettimeofday.h | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index abe85e552..759c8a014 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -410,7 +410,7 @@ if (SERIAL_MPI) list(APPEND PSB_base_source_C_files modules/fakempi.c) endif() if(WIN32) - list(APPEND PSB_base_source_C_files modules/gettimeofday.c) + list(APPEND PSB_base_source_C_files modules/gettimeofday.c modules/gettimeofday.h) endif() foreach(file IN LISTS PSB_base_source_C_files) list(APPEND base_source_C_files ${CMAKE_CURRENT_LIST_DIR}/${file}) diff --git a/base/modules/cutil.c b/base/modules/cutil.c index 2eac4e1c9..a0f51d49e 100644 --- a/base/modules/cutil.c +++ b/base/modules/cutil.c @@ -1,6 +1,6 @@ #ifdef _WIN32 -#include #include +#include #else #include #endif diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index f0e8a5d1b..33c028609 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,12 +1,12 @@ -#include -#include #ifdef _WIN32 -#include #include +#include #include "gettimeofday.h" #else #include #endif +#include +#include #include "psb_internals.h" @@ -108,7 +108,7 @@ #define mpi_complex 5 #define mpi_double_complex 6 -double mpi_wtime() +double mpi_wtime() { struct timeval tt; struct timezone tz; diff --git a/base/modules/gettimeofday.c b/base/modules/gettimeofday.c index be0422717..f7a838616 100644 --- a/base/modules/gettimeofday.c +++ b/base/modules/gettimeofday.c @@ -6,11 +6,11 @@ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif -struct timezone +typedef struct { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ -}; +} timezone; int gettimeofday(struct timeval *tv, struct timezone *tz) { diff --git a/base/modules/gettimeofday.h b/base/modules/gettimeofday.h index 67673b2c4..7da9ed216 100644 --- a/base/modules/gettimeofday.h +++ b/base/modules/gettimeofday.h @@ -1,15 +1,15 @@ -#include #include +#include #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif -struct timezone +typedef struct { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ -}; +} timezone; int gettimeofday(struct timeval *tv, struct timezone *tz); From 7b3422ab4ef3b469c827a12379e60aa31e3b7d3f Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 15:42:46 -0500 Subject: [PATCH 34/48] Try Salvatore's timer function on windows --- base/CMakeLists.txt | 3 --- base/modules/cutil.c | 5 +--- base/modules/fakempi.c | 16 +++++++++---- base/modules/gettimeofday.c | 48 ------------------------------------- base/modules/gettimeofday.h | 15 ------------ 5 files changed, 12 insertions(+), 75 deletions(-) delete mode 100644 base/modules/gettimeofday.c delete mode 100644 base/modules/gettimeofday.h diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 759c8a014..26e70a788 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -409,9 +409,6 @@ list(APPEND PSB_base_source_C_files modules/cutil.c) if (SERIAL_MPI) list(APPEND PSB_base_source_C_files modules/fakempi.c) endif() -if(WIN32) - list(APPEND PSB_base_source_C_files modules/gettimeofday.c modules/gettimeofday.h) -endif() foreach(file IN LISTS PSB_base_source_C_files) list(APPEND base_source_C_files ${CMAKE_CURRENT_LIST_DIR}/${file}) endforeach() diff --git a/base/modules/cutil.c b/base/modules/cutil.c index a0f51d49e..11b815051 100644 --- a/base/modules/cutil.c +++ b/base/modules/cutil.c @@ -1,7 +1,4 @@ -#ifdef _WIN32 -#include -#include -#else +#if ! (defined(_WIN32) || defined(WIN32)) #include #endif #include diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index 33c028609..0510f333c 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,8 +1,4 @@ -#ifdef _WIN32 -#include -#include -#include "gettimeofday.h" -#else +#if ! (defined(_WIN32) || defined(WIN32)) #include #endif #include @@ -110,6 +106,15 @@ double mpi_wtime() { +#if defined(WIN32) || defined(_WIN32) + LARGE_INTEGER tim, freq; + double seconds; + + QueryPerformanceCounter(&tim); + QeryPerformanceFrequency(&freq); + seconds = (double)tim / (double) freq; + return(seconds); +#else struct timeval tt; struct timezone tz; double temp; @@ -120,6 +125,7 @@ double mpi_wtime() temp = ((double)tt.tv_sec) + ((double)tt.tv_usec)*1.0e-6; } return(temp); +#endif } diff --git a/base/modules/gettimeofday.c b/base/modules/gettimeofday.c deleted file mode 100644 index f7a838616..000000000 --- a/base/modules/gettimeofday.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) - #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 -#else - #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL -#endif - -typedef struct -{ - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ -} timezone; - -int gettimeofday(struct timeval *tv, struct timezone *tz) -{ - FILETIME ft; - unsigned __int64 tmpres = 0; - static int tzflag; - - if (NULL != tv) - { - GetSystemTimeAsFileTime(&ft); - - tmpres |= ft.dwHighDateTime; - tmpres <<= 32; - tmpres |= ft.dwLowDateTime; - - /*converting file time to unix epoch*/ - tmpres -= DELTA_EPOCH_IN_MICROSECS; - tmpres /= 10; /*convert into microseconds*/ - tv->tv_sec = (long)(tmpres / 1000000UL); - tv->tv_usec = (long)(tmpres % 1000000UL); - } - - if (NULL != tz) - { - if (!tzflag) - { - _tzset(); - tzflag++; - } - tz->tz_minuteswest = _timezone / 60; - tz->tz_dsttime = _daylight; - } - - return 0; -} diff --git a/base/modules/gettimeofday.h b/base/modules/gettimeofday.h deleted file mode 100644 index 7da9ed216..000000000 --- a/base/modules/gettimeofday.h +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) - #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 -#else - #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL -#endif - -typedef struct -{ - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ -} timezone; - -int gettimeofday(struct timeval *tv, struct timezone *tz); From 48662755b72ad7073ae5d60dbfaf0f25233b5b54 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 16:01:12 -0500 Subject: [PATCH 35/48] Add back Windows.h header --- base/modules/fakempi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index 0510f333c..e5cbd18f8 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,4 +1,6 @@ -#if ! (defined(_WIN32) || defined(WIN32)) +#if (defined(_WIN32) || defined(WIN32)) +#include +#else #include #endif #include @@ -112,7 +114,7 @@ double mpi_wtime() QueryPerformanceCounter(&tim); QeryPerformanceFrequency(&freq); - seconds = (double)tim / (double) freq; + seconds = (double)tim / (double)freq; return(seconds); #else struct timeval tt; From e5708f325020572716ea878feb9b9b7c4d7c8f09 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 16:11:31 -0500 Subject: [PATCH 36/48] Try pre-compiled headers? maybe? --- base/modules/fakempi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index e5cbd18f8..0837e04f1 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,4 +1,5 @@ #if (defined(_WIN32) || defined(WIN32)) +#include "stdafx.h" #include #else #include From 73faf6379ec93e2e3e6496807811e5086cfe0e8b Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 16:24:11 -0500 Subject: [PATCH 37/48] Try using Int64 instead of LARGE_INTEGER --- base/modules/fakempi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index 0837e04f1..dd6803407 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,7 +1,4 @@ -#if (defined(_WIN32) || defined(WIN32)) -#include "stdafx.h" -#include -#else +#if !(defined(_WIN32) || defined(WIN32)) #include #endif #include @@ -110,7 +107,7 @@ double mpi_wtime() { #if defined(WIN32) || defined(_WIN32) - LARGE_INTEGER tim, freq; + Int64 tim, freq; double seconds; QueryPerformanceCounter(&tim); From 90fefd63e68d1469dc85e87dabbf84a79862eb38 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Fri, 18 Jan 2019 16:29:01 -0500 Subject: [PATCH 38/48] Try different type definition --- base/modules/fakempi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index dd6803407..b50fb1d4b 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -107,7 +107,7 @@ double mpi_wtime() { #if defined(WIN32) || defined(_WIN32) - Int64 tim, freq; + __int64 tim, freq; double seconds; QueryPerformanceCounter(&tim); From 08450e517a910a4bfdd4aa1b9bfe940357a95166 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Sun, 20 Jan 2019 20:31:02 -0500 Subject: [PATCH 39/48] Use static libs for C code instead of object libs - Try adding headers back to fakempi.c --- CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++++---- base/modules/fakempi.c | 4 +++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bdd5f33e5..4c458eaf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -377,8 +377,23 @@ endif() # cbind.a, util.a krylov.a prec.a base.a include(${CMAKE_CURRENT_LIST_DIR}/base/CMakeLists.txt) -add_library(base_C OBJECT ${base_source_C_files}) -add_library(base ${base_source_files} $) +if(WIN32) + add_library(psb_base_C STATIC ${base_source_C_files}) + target_compile_definitions(psb_base_C + PRIVATE -DWIN32 -D_LIB -DWIN64) + set_target_properties(psb_base_C + PROPERTIES + LINKER_LANGUAGE C + POSITION_INDEPENDENT_CODE TRUE) + target_link_libraries(psb_base_C + PUBLIC kernel32 user32 shell32) + add_library(base ${base_source_files}) + target_link_libraries(base + PUBLIC psb_base_C) +else() + add_library(base_C OBJECT ${base_source_C_files}) + add_library(base ${base_source_files} $) +endif() set_target_properties(base PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" @@ -425,8 +440,23 @@ target_include_directories(krylov PUBLIC target_link_libraries(krylov PUBLIC base prec) include(${CMAKE_CURRENT_LIST_DIR}/util/CMakeLists.txt) -add_library(util_C OBJECT ${util_source_C_files}) -add_library(util ${util_source_files} $) +if(WIN32) + add_library(psb_util_C STATIC ${util_source_C_files}) + target_compile_definitions(psb_util_C + PRIVATE -DWIN32 -D_LIB -DWIN64) + set_target_properties(psb_util_C + PROPERTIES + LINKER_LANGUAGE C + POSITION_INDEPENDENT_CODE TRUE) + target_link_libraries(psb_util_C + PUBLIC kernel32 user32 shell32) + add_library(util ${util_source_files}) + target_link_libraries(util + PUBLIC psb_util_C) +else() + add_library(util_C OBJECT ${util_source_C_files}) + add_library(util ${util_source_files} $) +endif() set_target_properties(util PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}" diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index b50fb1d4b..02aef6d3e 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,4 +1,6 @@ #if !(defined(_WIN32) || defined(WIN32)) +#include +#include #include #endif #include @@ -107,7 +109,7 @@ double mpi_wtime() { #if defined(WIN32) || defined(_WIN32) - __int64 tim, freq; + LARGE_INTEGER tim, freq; double seconds; QueryPerformanceCounter(&tim); From 3fba2964bb04058e1b89bd633d0f642a5eeb4055 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Sun, 20 Jan 2019 21:17:36 -0500 Subject: [PATCH 40/48] Fix bad include/libname in CMake --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c458eaf2..e1865e914 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -454,8 +454,8 @@ if(WIN32) target_link_libraries(util PUBLIC psb_util_C) else() - add_library(util_C OBJECT ${util_source_C_files}) - add_library(util ${util_source_files} $) + add_library(psb_util_C OBJECT ${util_source_C_files}) + add_library(util ${util_source_files} $) endif() set_target_properties(util PROPERTIES @@ -472,11 +472,11 @@ if(METIS_FOUND) message(STATUS ${METIS_INCLUDES}) target_include_directories(util PUBLIC ${METIS_INCLUDES}) - target_include_directories(util_C + target_include_directories(psb_util_C PUBLIC ${METIS_INCLUDES}) target_link_libraries(util PUBLIC ${METIS_LIBRARIES}) - target_compile_definitions(util_C + target_compile_definitions(psb_util_C PUBLIC HAVE_METIS_) target_compile_definitions(util PUBLIC HAVE_METIS) From 8173b8c1ec8e92508929410d1efe466d892ab2b2 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Sun, 20 Jan 2019 21:31:38 -0500 Subject: [PATCH 41/48] Fix logic for windows & METIS --- CMakeLists.txt | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1865e914..e28c9a156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -441,18 +441,22 @@ target_link_libraries(krylov PUBLIC base prec) include(${CMAKE_CURRENT_LIST_DIR}/util/CMakeLists.txt) if(WIN32) - add_library(psb_util_C STATIC ${util_source_C_files}) - target_compile_definitions(psb_util_C - PRIVATE -DWIN32 -D_LIB -DWIN64) - set_target_properties(psb_util_C - PROPERTIES - LINKER_LANGUAGE C - POSITION_INDEPENDENT_CODE TRUE) - target_link_libraries(psb_util_C - PUBLIC kernel32 user32 shell32) + if(METIS_FOUND) + add_library(psb_util_C STATIC ${util_source_C_files}) + target_compile_definitions(psb_util_C + PRIVATE -DWIN32 -D_LIB -DWIN64) + set_target_properties(psb_util_C + PROPERTIES + LINKER_LANGUAGE C + POSITION_INDEPENDENT_CODE TRUE) + target_link_libraries(psb_util_C + PUBLIC kernel32 user32 shell32) + endif() add_library(util ${util_source_files}) - target_link_libraries(util - PUBLIC psb_util_C) + if(METIS_FOUND) + target_link_libraries(util + PUBLIC psb_util_C) + endif() else() add_library(psb_util_C OBJECT ${util_source_C_files}) add_library(util ${util_source_files} $) @@ -489,14 +493,20 @@ install(TARGETS base prec krylov util DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) - - - -# set(directory_list base prec krylov util test) # TODO: add cbind -# foreach(directory ${directory_list}) -# add_subdirectory("${directory}") -# endforeach() -#add_subdirectory(cbind) +if(WIN32) + install(TARGETS psb_base_C + EXPORT ${CMAKE_PROJECT_NAME}-targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) + if(METIS_FOUND) + install(TARGETS psb_util_C + EXPORT ${CMAKE_PROJECT_NAME}-targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) + endif() +endif() #----------------- # Add PSBLAS tests From b3975878ef07d0d241d5de862e1d718829e87bc4 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Sun, 20 Jan 2019 23:30:13 -0500 Subject: [PATCH 42/48] Remove define breaking windows build - -DLittleEndian was being defined before pulling in windows.h causing compiler errors --- CMakeLists.txt | 34 ++++++++++++++++++---------------- base/modules/fakempi.c | 4 +++- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e28c9a156..61b9ceceb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,23 +84,25 @@ else() message( FATAL_ERROR "Fortran name mangling suffix, \'${FortranCInterface_GLOBAL__SUFFIX}\', unknown to PSBLAS") endif() -#---------------------------------------------- -# Determine system endian-ness and pointer size -#---------------------------------------------- -include(TestBigEndian) -TEST_BIG_ENDIAN(IS_BIG_ENDIAN) -if(IS_BIG_ENDIAN) - message( STATUS "System appears to be big endian.") -else() - message( STATUS "System appears to be little endian.") - add_definitions(-DLittleEndian) -endif() -include(CheckTypeSize) -CHECK_TYPE_SIZE("void *" VOID_P_SIZE LANGUAGE C) -if(${VOID_P_SIZE} EQUAL 8) - add_definitions(-DPtr64Bits) +if(NOT ${WIN32}) + #---------------------------------------------- + # Determine system endian-ness and pointer size + #---------------------------------------------- + include(TestBigEndian) + TEST_BIG_ENDIAN(IS_BIG_ENDIAN) + if(IS_BIG_ENDIAN) + message( STATUS "System appears to be big endian.") + else() + message( STATUS "System appears to be little endian.") + add_definitions(-DLittleEndian) + endif() + include(CheckTypeSize) + CHECK_TYPE_SIZE("void *" VOID_P_SIZE LANGUAGE C) + if(${VOID_P_SIZE} EQUAL 8) + add_definitions(-DPtr64Bits) + endif() + message(STATUS "Have 64bit pointers") endif() -message(STATUS "Have 64bit pointers") #----------------------------------------- # Check for some Fortran compiler features diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index 02aef6d3e..e74b69b4c 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -1,6 +1,8 @@ -#if !(defined(_WIN32) || defined(WIN32)) +#if (defined(_WIN32) || defined(WIN32)) #include #include +#include +#else #include #endif #include From 9cac875a89fbea5411b7cf7ce45d714e6b788ab3 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Sun, 20 Jan 2019 23:39:15 -0500 Subject: [PATCH 43/48] Fix typecast fake MPI_wtime on WIN32 --- base/modules/fakempi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index e74b69b4c..603a2445f 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -116,7 +116,7 @@ double mpi_wtime() QueryPerformanceCounter(&tim); QeryPerformanceFrequency(&freq); - seconds = (double)tim / (double)freq; + seconds = (double)(tim.QuadPart) / (double)(freq.QuadPart); return(seconds); #else struct timeval tt; From 9d0edabb778b3a0e187222ab806780396e7ccb4f Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Mon, 21 Jan 2019 15:38:25 -0500 Subject: [PATCH 44/48] Fix setting/detecting Fortran name-mangling - PSBLAS is setting LowerUnderscore on windows without this --- CMakeLists.txt | 5 +++-- cmake/CapitalizeString.cmake | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 cmake/CapitalizeString.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 61b9ceceb..036c0f19c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # Set oldest allowable CMake version #----------------------------------- cmake_minimum_required(VERSION 3.10) -cmake_policy(VERSION 3.10.0...3.12.4) +cmake_policy(VERSION 3.11.1...3.13.3) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") @@ -70,8 +70,9 @@ endif() #------------------------------------ # Fortran name mangling introspection #------------------------------------ +include("${CMAKE_CURRENT_LIST_DIR}/cmake/CapitalizeString.cmake") include(FortranCInterface) -string(TOUPPER ${FortranCInterface_GLOBAL__CASE} fc_case) +CapitalizeString(${FortranCInterface_GLOBAL__CASE} fc_case) message(STATUS "Name mangling capitalization: ${fc_case}") message(STATUS "Name mangling fortran global suffix underscore: ${FortranCInterface_GLOBAL__SUFFIX}") if(FortranCInterface_GLOBAL__SUFFIX STREQUAL "") diff --git a/cmake/CapitalizeString.cmake b/cmake/CapitalizeString.cmake new file mode 100644 index 000000000..ae50b4745 --- /dev/null +++ b/cmake/CapitalizeString.cmake @@ -0,0 +1,7 @@ +function(CapitalizeString string output_variable) + string(TOUPPER "${string}" _upper_string) + string(TOLOWER "${string}" _lower_string) + string(SUBSTRING "${_upper_string}" 0 1 _start) + string(SUBSTRING "${_lower_string}" 1 -1 _end) + set(${output_variable} "${_start}${_end}" PARENT_SCOPE) +endfunction() From 35787619217a7188fbff43a05eebef5b5b4e66be Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Mon, 21 Jan 2019 17:19:47 -0500 Subject: [PATCH 45/48] Fix missing symbols when using fakempi.c --- base/comm/internals/psi_dswapdata.F90 | 20 ++++++++++++++------ base/comm/internals/psi_dswaptran.F90 | 16 ++++++++++++---- base/modules/fakempi.c | 2 +- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/base/comm/internals/psi_dswapdata.F90 b/base/comm/internals/psi_dswapdata.F90 index f00d21b94..9b56e2824 100644 --- a/base/comm/internals/psi_dswapdata.F90 +++ b/base/comm/internals/psi_dswapdata.F90 @@ -365,8 +365,9 @@ subroutine psi_dswapidxm(iictxt,iicomm,flag,n,beta,y,idx, & ! Then I post all the blocking sends +#ifndef SERIAL_MPI if (usersend) call mpi_barrier(icomm,iret) - +#endif pnti = 1 snd_pt = 1 rcv_pt = 1 @@ -376,17 +377,20 @@ subroutine psi_dswapidxm(iictxt,iicomm,flag,n,beta,y,idx, & nesd = idx(pnti+nerv+psb_n_elem_send_) p2ptag = psb_double_swap_tag - if ((nesd>0).and.(proc_to_comm /= me)) then - if (usersend) then + if ((nesd>0).and.(proc_to_comm /= me)) then +#ifndef SERIAL_MPI + if (usersend) then call mpi_rsend(sndbuf(snd_pt),n*nesd,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag,icomm,iret) else +#endif call mpi_send(sndbuf(snd_pt),n*nesd,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag,icomm,iret) +#ifndef SERIAL_MPI end if - +#endif if(iret /= mpi_success) then ierr(1) = iret info=psb_err_mpi_error_ @@ -855,8 +859,9 @@ subroutine psi_dswapidxv(iictxt,iicomm,flag,beta,y,idx, & ! Then I post all the blocking sends +#ifndef SERIAL_MPI if (usersend) call mpi_barrier(icomm,iret) - +#endif pnti = 1 snd_pt = 1 rcv_pt = 1 @@ -868,16 +873,19 @@ subroutine psi_dswapidxv(iictxt,iicomm,flag,beta,y,idx, & p2ptag = psb_double_swap_tag if ((nesd>0).and.(proc_to_comm /= me)) then +#ifndef SERIAL_MPI if (usersend) then call mpi_rsend(sndbuf(snd_pt),nesd,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag,icomm,iret) else +#endif call mpi_send(sndbuf(snd_pt),nesd,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag,icomm,iret) +#ifndef SERIAL_MPI end if - +#endif if(iret /= mpi_success) then ierr(1) = iret info=psb_err_mpi_error_ diff --git a/base/comm/internals/psi_dswaptran.F90 b/base/comm/internals/psi_dswaptran.F90 index 604b345e6..2b328a2eb 100644 --- a/base/comm/internals/psi_dswaptran.F90 +++ b/base/comm/internals/psi_dswaptran.F90 @@ -376,8 +376,9 @@ subroutine psi_dtranidxm(iictxt,iicomm,flag,n,beta,y,idx,& ! Then I post all the blocking sends +#ifndef SERIAL_MPI if (usersend) call mpi_barrier(icomm,iret) - +#endif pnti = 1 snd_pt = 1 rcv_pt = 1 @@ -388,16 +389,19 @@ subroutine psi_dtranidxm(iictxt,iicomm,flag,n,beta,y,idx,& if ((nerv>0).and.(proc_to_comm /= me)) then p2ptag = psb_double_swap_tag +#ifndef SERIAL_MPI if (usersend) then call mpi_rsend(rcvbuf(rcv_pt),n*nerv,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag,icomm,iret) else +#endif call mpi_send(rcvbuf(rcv_pt),n*nerv,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag,icomm,iret) +#ifndef SERIAL_MPI end if - +#endif if(iret /= mpi_success) then ierr(1) = iret info=psb_err_mpi_error_ @@ -874,8 +878,9 @@ subroutine psi_dtranidxv(iictxt,iicomm,flag,beta,y,idx,& ! Then I post all the blocking sends +#ifndef SERIAL_MPI if (usersend) call mpi_barrier(icomm,iret) - +#endif pnti = 1 snd_pt = 1 rcv_pt = 1 @@ -886,16 +891,19 @@ subroutine psi_dtranidxv(iictxt,iicomm,flag,beta,y,idx,& if ((nerv>0).and.(proc_to_comm /= me)) then p2ptag = psb_double_swap_tag +#ifndef SERIAL_MPI if (usersend) then call mpi_rsend(rcvbuf(rcv_pt),nerv,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag, icomm,iret) else +#endif call mpi_send(rcvbuf(rcv_pt),nerv,& & psb_mpi_r_dpk_,prcid(i),& & p2ptag, icomm,iret) +#ifndef SERIAL_MPI end if - +#endif if(iret /= mpi_success) then ierr(1) = iret info=psb_err_mpi_error_ diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c index 603a2445f..c37afe271 100644 --- a/base/modules/fakempi.c +++ b/base/modules/fakempi.c @@ -115,7 +115,7 @@ double mpi_wtime() double seconds; QueryPerformanceCounter(&tim); - QeryPerformanceFrequency(&freq); + QueryPerformanceFrequency(&freq); seconds = (double)(tim.QuadPart) / (double)(freq.QuadPart); return(seconds); #else From ce8b054cdbd0d84f155bf334591d1c798ed3f970 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Mon, 21 Jan 2019 19:03:47 -0500 Subject: [PATCH 46/48] Attempt static linking of BLAS --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 036c0f19c..3cbdd82c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,7 +280,7 @@ endif() #------------------------------ # Find Linear Algebra Libraries #------------------------------ -#set(BLA_STATIC 1) +set(BLA_STATIC ON) find_package(BLAS REQUIRED) find_package(LAPACK REQUIRED) add_definitions(-DHAVE_LAPACK) From b6fe5e9fd1f3c0ddbadf5b31ed32a18ff6b53642 Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Tue, 22 Jan 2019 11:51:11 -0500 Subject: [PATCH 47/48] On macOS use system LAPACK (no static libs) --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cbdd82c4..34495bb32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,7 +280,9 @@ endif() #------------------------------ # Find Linear Algebra Libraries #------------------------------ -set(BLA_STATIC ON) +if(NOT APPLE) + set(BLA_STATIC ON) +endif() find_package(BLAS REQUIRED) find_package(LAPACK REQUIRED) add_definitions(-DHAVE_LAPACK) From 8166256f3f0e5a849bd5a0098c9878167b06bf7a Mon Sep 17 00:00:00 2001 From: Izaak Beekman Date: Tue, 21 May 2019 13:03:08 -0400 Subject: [PATCH 48/48] Enable PSBLAS to find & build w/ OpenCoarrays --- CMakeLists.txt | 63 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34495bb32..09f732f0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,13 @@ project(psblas VERSION "${PSBLAS_Version}" LANGUAGES C Fortran) +#-------------------------------------------------- +# Set option to allow building against OpenCoarrays +#-------------------------------------------------- +if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + option(PSBLAS_USE_OpenCoarrays "Build enabling linkage to programs using OpenCoarrays" OFF) +endif() + #----------------------------------------------------------------- # Define a target to create a checksummed & signed release archive #----------------------------------------------------------------- @@ -277,6 +284,14 @@ else() set(SERIAL_MPI ON) endif() +#------------------------------------------------------- +# Find and Use OpenCoarrays IFF gfortran AND options set +#------------------------------------------------------- + +if("${PSBLAS_USE_OpenCoarrays}" AND CMAKE_Fortran_COMPILER_ID MATCHES GNU) + find_package(OpenCoarrays) +endif() + #------------------------------ # Find Linear Algebra Libraries #------------------------------ @@ -347,25 +362,24 @@ install( "${CMAKE_INSTALL_LIBDIR}/cmake/psblas" ) +#------------------------------------------ +# Add portable unistall command to makefile +#------------------------------------------ +# Adapted from the CMake Wiki FAQ +configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_DIR}/uninstall.cmake" + @ONLY) + +add_custom_target ( uninstall + COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/uninstall.cmake" ) +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) +# See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend +# on the test executables + +#---------------------------------- +# Determine if we're using Open MPI +#--------------------------------- if(MPI_FOUND) - #------------------------------------------ - # Add portable unistall command to makefile - #------------------------------------------ - # Adapted from the CMake Wiki FAQ - configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_DIR}/uninstall.cmake" - @ONLY) - - add_custom_target ( uninstall - COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/uninstall.cmake" ) - - add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) - # See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend - # on the test executables - - #---------------------------------- - # Determine if we're using Open MPI - #--------------------------------- execute_process(COMMAND ${MPIEXEC} --version OUTPUT_VARIABLE mpi_version_out) if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]") @@ -409,9 +423,6 @@ set_target_properties(base target_include_directories(base PUBLIC $ $) -if(MPI_FOUND) - target_link_libraries(base PUBLIC ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) -endif() target_link_libraries(base PUBLIC ${LAPACK_LINKER_FLAGS} ${LAPACK_LIBRARIES} ${LAPACK95_LIBRARIES} PUBLIC ${BLAS_LINKER_FLAGS} ${BLAS_LIBRARIES} ${BLAS95_LIBRARIES}) @@ -491,6 +502,18 @@ if(METIS_FOUND) PUBLIC HAVE_METIS) endif() +if(MPI_FOUND) + foreach(lib base prec krylov util) + target_link_libraries(${lib} PUBLIC ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) + endforeach() +endif() + +if(OpenCoarrays_FOUND) + foreach(lib base prec krylov util) + target_link_libraries(${lib} PUBLIC OpenCoarrays::caf_mpi_static) + endforeach() +endif() + install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.mod") install(TARGETS base prec krylov util