Skip to content

Commit 44e0e89

Browse files
committed
Merge branch 'add-fortran-assertions' of github.com:sourceryinstitute/OpenCoarrays
2 parents f37f0a2 + fce0a35 commit 44e0e89

File tree

14 files changed

+339
-58
lines changed

14 files changed

+339
-58
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
- MPICH_GCC7_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/1956441/"
1414
- MPICH_BOT_URL_TAIL="mpich-3.2.1_1.high_sierra.bottle.1.tar.gz"
1515
- BUILD_TYPES="Debug RelWithDebInfo Release CodeCoverage"
16+
- PATH="${HOME}/.local/bin:$PATH"
1617
# matrix:
1718
# - GCC="6 7" OSX_PACKAGES="gcc@7 gcc@6 cmake shellcheck" BUILD_TYPE="cmake"
1819

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
cmake_minimum_required(VERSION 3.4)
1+
cmake_minimum_required(VERSION 3.10)
22

3-
cmake_policy(VERSION 3.4...3.12)
3+
cmake_policy(VERSION 3.10...3.12)
44

55
# Set the type/configuration of build to perform
66
set ( CMAKE_CONFIGURATION_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "CodeCoverage" )
@@ -525,8 +525,10 @@ function(caf_compile_executable target main_depend)
525525
COMMAND "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf"
526526
${includes} ${localDefs} ${config_Fortran_flags}
527527
-o "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target}"
528-
"${CMAKE_CURRENT_SOURCE_DIR}/${main_depend}" ${ARGN}
529-
DEPENDS "${main_depend}" ${ARGN} caf_mpi_static
528+
"${CMAKE_CURRENT_SOURCE_DIR}/${main_depend}"
529+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libopencoarrays_test_utilities.a"
530+
${ARGN}
531+
DEPENDS "${main_depend}" ${ARGN} caf_mpi_static opencoarrays_test_utilities
530532
VERBATIM
531533
)
532534
add_custom_target("build_${target}" ALL

developer-scripts/travis/install.linux.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ trap '__caf_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
2121

2222
echo "Performing Travis-CI installation phase on Linux..."
2323

24+
echo "Installing CMake binaries using install.sh..."
25+
26+
./install.sh --package=cmake --install-prefix="${HOME}/.local"
27+
2428
if [[ "${BUILD_TYPE:-}" != InstallScript ]]; then # Ubuntu on Travis-CI, NOT testing install.sh
2529
if ! [[ -x "${HOME}/.local/bin/mpif90" && -x "${HOME}/.local/bin/mpicc" ]]; then
2630
# mpich install not cached

prerequisites/build-functions/build_and_install.sh

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,34 @@ build_and_install()
3232
cp "${download_path}/${package_source_directory}/src/include/mpiimpl.h.patched" "${download_path}/${package_source_directory}/src/include/mpiimpl.h"
3333
fi
3434

35-
info "Configuring ${package_to_build} ${version_to_build} with the following command:"
36-
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" \"${download_path}/${package_source_directory}\"/configure --prefix=\"${install_path}\""
37-
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" "${download_path}/${package_source_directory}"/configure --prefix="${install_path}"
38-
info "Building with the following command:"
39-
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" make -j\"${num_threads}\""
40-
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" make "-j${num_threads}"
41-
info "Installing ${package_to_build} in ${install_path}"
42-
if [[ ! -z "${SUDO:-}" ]]; then
43-
info "You do not have write permissions to the installation path ${install_path}"
44-
info "If you have administrative privileges, enter your password to install ${package_to_build}"
35+
if [[ "${package_to_build}" == "cmake" && $(uname) == "Linux" ]]; then
36+
37+
export cmake_binary_installer="${download_path}/cmake-${version_to_build}-Linux-x86_64.sh"
38+
${SUDO:-} mkdir -p "$install_path"
39+
chmod u+x "${cmake_binary_installer}"
40+
info "Installing Cmake with the following command: "
41+
info "\"${cmake_binary_installer}\" --prefix=\"$install_path\" --exclude-subdir"
42+
"${cmake_binary_installer}" --prefix="$install_path" --exclude-subdir
43+
44+
else # build from source
45+
46+
info "Configuring ${package_to_build} ${version_to_build} with the following command:"
47+
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" \"${download_path}/${package_source_directory}\"/configure --prefix=\"${install_path}\""
48+
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" "${download_path}/${package_source_directory}"/configure --prefix="${install_path}"
49+
info "Building with the following command:"
50+
info "FC=\"${FC:-'gfortran'}\" CC=\"${CC:-'gcc'}\" CXX=\"${CXX:-'g++'}\" make -j\"${num_threads}\""
51+
FC="${FC:-'gfortran'}" CC="${CC:-'gcc'}" CXX="${CXX:-'g++'}" make "-j${num_threads}"
52+
info "Installing ${package_to_build} in ${install_path}"
53+
if [[ ! -z "${SUDO:-}" ]]; then
54+
info "You do not have write permissions to the installation path ${install_path}"
55+
info "If you have administrative privileges, enter your password to install ${package_to_build}"
56+
fi
57+
info "Installing with the following command: ${SUDO:-} make install"
58+
${SUDO:-} make install
59+
4560
fi
46-
info "Installing with the following command: ${SUDO:-} make install"
47-
${SUDO:-} make install
4861

49-
else # ${package_to_build} == "gcc"
62+
elif [[ ${package_to_build} == "gcc" ]]; then
5063

5164
info "pushd ${download_path}/${package_source_directory} "
5265
pushd "${download_path}/${package_source_directory}"
@@ -83,7 +96,10 @@ build_and_install()
8396
info "Installing with the following command: ${SUDO:-} make install"
8497
${SUDO:-} make install
8598

86-
fi # end if [[ "${package_to_build}" != "gcc" ]]; then
99+
else
100+
emergency "This branch should never be reached."
101+
fi # end if [[ "${package_to_build}" != "gcc" && "${package_to_build}" != "cmake" ]]; then
102+
87103

88104
info "popd"
89105
popd

prerequisites/build-functions/set_or_print_default_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set_or_print_default_version()
2626
# denominator because, for licensing reasons, OS X only has bash 3 by default.)
2727
# See http://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash
2828
package_version=(
29-
"cmake:3.4.0"
29+
"cmake:3.10.0"
3030
"gcc:8.2.0"
3131
"mpich:3.2"
3232
"wget:1.16.3"

prerequisites/build-functions/set_or_print_url.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ else
7171
"flex;flex-${version_to_build-}.tar.bz2"
7272
"bison;bison-${version_to_build-}.tar.gz"
7373
"make;make-${version_to_build-}.tar.bz2"
74-
"cmake;cmake-${version_to_build-}.tar.gz"
7574
"subversion;subversion-${version_to_build-}.tar.gz"
7675
)
76+
if [[ $(uname) == "Linux" ]]; then
77+
package_url_tail+=("cmake;cmake-${version_to_build}-Linux-x86_64.sh")
78+
else
79+
package_url_tail+=("cmake;cmake-${version_to_build-}.tar.gz")
80+
fi
7781
for package in "${package_url_tail[@]}" ; do
7882
KEY="${package%%;*}"
7983
VALUE="${package##*;}"
@@ -84,6 +88,7 @@ else
8488
fi
8589
done
8690

91+
8792
if [[ -z "${url_head:-}" || -z "${url_tail}" ]]; then
8893
emergency "Package ${package_name:-} not recognized. Use --l or --list-packages to list the allowable names."
8994
fi

prerequisites/build-functions/unpack_if_necessary.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ unpack_if_necessary()
55
if [[ "${fetch}" == "svn" || "${fetch}" == "git" ]]; then
66
package_source_directory="${version_to_build}"
77
else
8-
info "Unpacking ${url_tail}."
9-
info "pushd ${download_path}"
10-
pushd "${download_path}"
11-
info "Unpack command: tar xf ${url_tail}"
12-
tar xf "${url_tail}"
13-
info "popd"
14-
popd
8+
if [[ "${url_tail}" == *tar.gz || "${url_tail}" == *tar.bz2 || "${url_tail}" == *.tar.xz ]]; then
9+
info "Unpacking ${url_tail}."
10+
info "pushd ${download_path}"
11+
pushd "${download_path}"
12+
info "Unpack command: tar xf ${url_tail}"
13+
tar xf "${url_tail}"
14+
info "popd"
15+
popd
16+
else
17+
info "Skipping unpacking because ${url_tail} is not a compressed archive (matching one of *.tar.{gz,bz2,xz}). "
18+
fi
1519
# shellcheck disable=SC2034
1620
package_source_directory="${package_name}-${version_to_build}"
1721
fi

src/mpi/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@ set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags})
221221
set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries})
222222

223223
if(MPI_HAS_FAULT_TOL_EXT) # AND (NOT openmpi))
224-
option(CAF_ENABLE_FAILED_IMAGES "Enable failed images support" TRUE)
224+
option(CAF_ENABLE_FAILED_IMAGES "Enable failed images support" FALSE)
225+
message(STATUS "The MPI implementation appears to have the experimental features for ULFM
226+
that will allow you to build OpenCoarrays with failed images support. However,
227+
ULFM support did not make it into the MPI-4 standard, and it is known to
228+
trigger some bugs. Because of this we have disabled it by default. You may
229+
add the `-DCAF_ENABLE_FAILED_IMAGES:BOOL=ON` CMake flag or edit the value
230+
with ccmake or cmake-gui if you would like to experiment with failed images.")
225231
else()
226232
set(CAF_ENABLE_FAILED_IMAGES FALSE
227233
CACHE

src/tests/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ if (HIGH_RESOLUTION_TIMER)
1515
)
1616
endif()
1717

18-
add_subdirectory(integration)
19-
add_subdirectory(unit)
20-
add_subdirectory(installation)
21-
add_subdirectory(regression)
18+
set( directory_list
19+
utilities
20+
integration
21+
unit
22+
installation
23+
regression
24+
)
25+
foreach(directory ${directory_list})
26+
add_subdirectory(${directory})
27+
endforeach()

src/tests/unit/teams/teams_subset.f90

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
program teams_subset
2+
!! author: Nathan Weeks
3+
!!
4+
!! Regression test for prior potential deadlock in change team/end team
25
use iso_fortran_env, only : team_type
6+
use assertions_interface, only : assert
37
implicit none
48

5-
type(team_type) :: team
6-
integer :: initial_team_image, max_image(2), min_image(2), myteam
7-
8-
initial_team_image = this_image()
9-
10-
if (initial_team_image == 1 .or. initial_team_image == num_images()) then
11-
myteam = 1
12-
else
13-
myteam = 2
14-
end if
15-
16-
form team (myteam, team)
17-
18-
if (myteam == 1) then
19-
change team(team)
20-
max_image = [initial_team_image, this_image()]
21-
call co_max(max_image)
22-
min_image = [initial_team_image, this_image()]
23-
call co_min(min_image)
24-
end team
25-
if (any(min_image /= [1, 1]) .or. any(max_image /= [num_images(), 2])) then
26-
write(*,*) "Test failed."
27-
error stop
9+
type(team_type) team
10+
11+
associate( initial_team_image => this_image())
12+
associate( myteam => merge(1,2,any(initial_team_image==[1,num_images()])) )
13+
14+
form team (myteam, team)
15+
16+
if (myteam == 1) then
17+
block
18+
integer max_image(2), min_image(2)
19+
change team(team)
20+
max_image = [initial_team_image, this_image()]
21+
call co_max(max_image)
22+
min_image = [initial_team_image, this_image()]
23+
call co_min(min_image)
24+
end team
25+
call assert( all(min_image==1), "minimum image number in team 1 is 1" )
26+
call assert( all(max_image==[num_images(), 2]), "maximum image numbers on team 1 is num_images() or 2")
27+
end block
2828
end if
29-
end if
3029

31-
sync all
30+
sync all
3231

33-
if (initial_team_image == 1) write(*,*) "Test passed."
32+
if (initial_team_image == 1) print *,"Test passed."
33+
34+
end associate; end associate
3435

3536
end program

0 commit comments

Comments
 (0)