Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,38 +87,47 @@ else()
endif()
endif()


include(CheckFortranSourceCompiles.cmake)
if(gfortran_compiler)
set(CMAKE_REQUIRED_FLAGS "-fcoarray=single")
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)
unset(CMAKE_REQUIRED_FLAGS)
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

add_subdirectory(src)
add_subdirectory(install_prerequisites)

#-----------------------------------------------------
# Publicize installed location to other CMake projects
#-----------------------------------------------------
install(EXPORT OpenCoarraysTargets
NAMESPACE
OpenCoarrays::
DESTINATION
lib/cmake/opencoarrays
)
include(CMakePackageConfigHelpers)
include(CMakePackageConfigHelpers) # standard CMake module
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/OpenCoarraysConfigVersion.cmake"
VERSION 1.0
VERSION "${opencoarrays_VERSION}"
COMPATIBILITY AnyNewerVersion
)
configure_file(OpenCoarraysConfig.cmake.in CMakeFiles/OpenCoarraysConfig.cmake @ONLY)
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}/CMakeFiles/OpenCoarraysConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/OpenCoarraysConfigVersion.cmake"
DESTINATION
lib/cmake/opencoarrays
Expand All @@ -130,6 +139,17 @@ target_link_libraries(OpenCoarrays INTERFACE caf_mpi)

install(DIRECTORY ${CMAKE_BINARY_DIR}/mod DESTINATION .)

#------------------------------------------
# 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" )


enable_testing()

function(add_mpi_test name num_mpi_proc path)
Expand Down Expand Up @@ -169,15 +189,10 @@ if(opencoarrays_aware_compiler)
add_mpi_test(hello_multiverse 2 ${tests_root}/integration/coarrayHelloWorld/hello_multiverse)
add_mpi_test(coarray_burgers_pde 2 ${tests_root}/integration/pde_solvers/coarrayBurgers/coarray_burgers_pde)
add_mpi_test(co_heat 2 ${tests_root}/integration/pde_solvers/coarrayHeatSimplified/co_heat)

execute_process (COMMAND uname -m
OUTPUT_VARIABLE MACHINE_TYPE)
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )
if ("${MACHINE_TYPE}" MATCHES "x86_64")
if ( NOT (DEFINED ENV{TRAVIS}))
add_mpi_test(coarray_navier_stokes 2 ${tests_root}/integration/pde_solvers/navier-stokes/coarray_navier_stokes)
set_property(TEST coarray_navier_stokes PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
endif()
if ( ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64") AND ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") )
if ( NOT (DEFINED ENV{TRAVIS}))
add_mpi_test(coarray_navier_stokes 2 ${tests_root}/integration/pde_solvers/navier-stokes/coarray_navier_stokes)
set_property(TEST coarray_navier_stokes PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
endif()
endif()
else()
Expand Down
137 changes: 0 additions & 137 deletions CheckFortranSourceCompiles.cmake

This file was deleted.

File renamed without changes.
23 changes: 23 additions & 0 deletions cmake/uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 0 additions & 16 deletions src/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI")
set(portland_group_compiler true)
endif()

if (NOT CMAKE_VERSION VERSION_LESS 3.3.1)
# Detect Fortran compiler version directly
if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5))
set(opencoarrays_aware_compiler true)
else()
set(opencoarrays_aware_compiler false)
endif()
else()
# Use the C compiler version as a proxy for the Fortran compiler version (won't work with NAG)
if(gfortran_compiler AND (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5))
set(opencoarrays_aware_compiler true)
else()
set(opencoarrays_aware_compiler false)
endif()
endif()

if(gfortran_compiler AND (NOT opencoarrays_aware_compiler))
# This applied to gfortran 4.9 and some earlier versions (FIX ME: find out which)
add_definitions(-DCOMPILER_SUPPORTS_CAF_INTRINSICS)
Expand Down
12 changes: 4 additions & 8 deletions src/tests/integration/pde_solvers/navier-stokes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
execute_process (COMMAND uname -m
OUTPUT_VARIABLE MACHINE_TYPE)
# checking whether the machine is of type 64-bit before proceeding further
if ("${MACHINE_TYPE}" MATCHES "x86_64")
# Default to older SSE-instruction-based FFT library
if (NOT (DEFINED ENV{TRAVIS}))
# checking whether the machine is of type 64-bit before proceeding further
if ( ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64") AND ("${CMAKE_SYSTEM_NAME}" MATCHES "LINUX") )
# Default to older SSE-instruction-based FFT library
if (NOT (DEFINED ENV{TRAVIS}))
if (LEGACY_ARCHITECTURE OR (NOT DEFINED(LEGACY_ARCHITECTURE)))
set(fft_library ${CMAKE_CURRENT_SOURCE_DIR}/libfft_sse.a )
else()
Expand All @@ -17,7 +14,6 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
)
target_link_libraries(coarray_navier_stokes OpenCoarrays ${fft_library})
endif()
endif()
else()
# Skip Navier-Stokes build until an appropriate FFT has been found.
endif()
16 changes: 0 additions & 16 deletions src/tests/unit/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@ if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU")
set(gfortran_compiler true)
endif()

if (NOT CMAKE_VERSION VERSION_LESS 3.3.1)
# Detect Fortran compiler version directly
if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.1))
set(opencoarrays_aware_compiler true)
else()
set(opencoarrays_aware_compiler false)
endif()
else()
# Use the C compiler version as a proxy for the Fortran compiler version (won't work with NAG)
if(gfortran_compiler AND (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1))
set(opencoarrays_aware_compiler true)
else()
set(opencoarrays_aware_compiler false)
endif()
endif()

if("${gfortran_compiler}" AND (NOT "${opencoarrays_aware_compiler}"))
# This applied to gfortran 4.9 and some earlier versions (TODO: find out which)
add_definitions(-DCOMPILER_SUPPORTS_CAF_INTRINSICS)
Expand Down