Skip to content

Commit 5a250a1

Browse files
authored
Merge pull request #526 from sourceryinstitute/debug-config-fix
Fix failing CI tests for - the int8 co_reduce factorial test (thanks to Andre's commits and PR; this is a bug in OpenCoarrays/GFortran) - Failing macOS builds due to upgrades in Homebrew (an issue with the CI system)
2 parents 840374a + 86cbf34 commit 5a250a1

File tree

7 files changed

+86
-17
lines changed

7 files changed

+86
-17
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ os: osx
66
env:
77
global:
88
- CACHE="${HOME}/.local"
9-
- MPICH_VER="3.2"
9+
- MPICH_VER="3.2.1"
1010
- MPICH_URL_HEAD="https://www.mpich.org/static/downloads/${MPICH_VER}"
1111
- MPICH_URL_TAIL="mpich-${MPICH_VER}.tar.gz"
12-
- MPICH_GCC6_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/979804/"
13-
- MPICH_GCC7_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/976779/"
14-
- MPICH_BOT_URL_TAIL="mpich-3.2_3.yosemite.bottle.1.tar.gz"
15-
- BUILD_TYPES="Release Debug RelWithDebInfo CodeCoverage"
12+
- MPICH_GCC6_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/1956499/"
13+
- MPICH_GCC7_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/1956441/"
14+
- MPICH_BOT_URL_TAIL="mpich-3.2.1_1.high_sierra.bottle.1.tar.gz"
15+
- BUILD_TYPES="Debug RelWithDebInfo Release CodeCoverage"
1616
matrix:
1717
- GCC=6 OSX_PACKAGES="gcc@6 shellcheck" BUILD_TYPE="InstallScript"
1818
- GCC="6 7" OSX_PACKAGES="gcc gcc@6 cmake shellcheck" BUILD_TYPE="cmake"

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ the C compiler if it matches the Fortran compiler ID." )
158158
set( CMAKE_Fortran_COMPILER_VERSION "${DETECTED_VER}" )
159159
endif()
160160

161+
if(CMAKE_BUILD_TYPE MATCHES "Debug|DEBUG|debug")
162+
add_definitions(-DEXTRA_DEBUG_OUTPUT)
163+
endif()
164+
161165
# We have populated CMAKE_Fortran_COMPILER_VERSION if it was missing
162166
if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0))
163167
set(opencoarrays_aware_compiler true)
@@ -744,6 +748,11 @@ if(opencoarrays_aware_compiler)
744748
add_caf_test(source-alloc-no-sync 8 source-alloc-sync)
745749
endif()
746750

751+
# Fixed on GCC 6 > 6.4, 7 > 7.3 and 8.x
752+
if (FALSE) # FIXME!
753+
add_caf_test(non-coarray-vector-indexed-lhs issue-322-non-coarray-vector-idx-lhs)
754+
endif()
755+
747756
# Open GCC 7 regressions
748757
if ((CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER}) OR
749758
(gfortran_compiler AND (

developer-scripts/travis/install.linux.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,21 @@ if [[ "${BUILD_TYPE:-}" != InstallScript ]]; then # Ubuntu on Travis-CI, NOT tes
2525
if ! [[ -x "${HOME}/.local/bin/mpif90" && -x "${HOME}/.local/bin/mpicc" ]]; then
2626
# mpich install not cached
2727
# could use prerequisites/build instead...
28-
wget "${MPICH_URL_HEAD}/${MPICH_URL_TAIL}"
29-
tar -xzvf "${MPICH_URL_TAIL}"
30-
export CC=gcc-${GCC}
31-
export FC=gfortran-${GCC}
28+
echo "Downloading MPICH from ${MPICH_URL_HEAD}/${MPICH_URL_TAIL} ..."
29+
wget "${MPICH_URL_HEAD}/${MPICH_URL_TAIL}" > wget_mpich.log 2>&1 || cat wget_mpich.log
30+
echo "Extracting MPICH ..."
31+
tar -xzvf "${MPICH_URL_TAIL}" > tar_mpich.log 2>&1 || cat tar_mpich.log
32+
export CC=gcc-${GCC}
33+
export FC=gfortran-${GCC}
3234
(
33-
cd "${MPICH_URL_TAIL%.tar.gz}"
34-
./configure --prefix="${CACHE}"
35-
make -j 4
36-
make install
37-
)
35+
cd "${MPICH_URL_TAIL%.tar.gz}"
36+
echo "Configuring MPICH ..."
37+
${TRAVIS:+travis_wait} ./configure --prefix="${CACHE}" > configure_mpich.log 2>&1 || cat configure_mpich.log
38+
echo "Building MPICH ..."
39+
${TRAVIS:+travis_wait 30} make -j 4 > make_mpich.log 2>&1 || cat make_mpich.log
40+
echo "Installing MPICH ..."
41+
${TRAVIS:+travis_wait} make install > install_mpich.log 2>&1 || cat install_mpich.log
42+
)
3843
fi
3944
fi
4045

developer-scripts/travis/test-script.cmake.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ for version in ${GCC}; do
3333
# but puting it here simplifies the Travis code a lot
3434
MPICH_BOT_URL_HEAD=MPICH_GCC${version}_BOT_URL_HEAD
3535
brew uninstall --force --ignore-dependencies mpich || true
36-
wget "${!MPICH_BOT_URL_HEAD}${MPICH_BOT_URL_TAIL}"
36+
echo "Downloading Custom MPICH bottle ${!MPICH_BOT_URL_HEAD}${MPICH_BOT_URL_TAIL} ..."
37+
wget "${!MPICH_BOT_URL_HEAD}${MPICH_BOT_URL_TAIL}" > wget_mpichbottle.log 2>&1 || cat wget_mpichbottle.log
3738
brew install --force-bottle "${MPICH_BOT_URL_TAIL}"
3839
brew ls --versions mpich >/dev/null || brew install --force-bottle mpich
3940
rm "${MPICH_BOT_URL_TAIL}"

src/mpi/mpi_caf.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,19 @@ bool caf_owns_mpi = false;
263263

264264
/* Foo function pointers for coreduce.
265265
The handles when arguments are passed by reference. */
266+
int (*int8_t_by_reference)(void *, void *);
267+
int (*int16_t_by_reference)(void *, void *);
266268
int (*int32_t_by_reference)(void *, void *);
269+
int (*int64_t_by_reference)(void *, void *);
267270
float (*float_by_reference)(void *, void *);
268271
double (*double_by_reference)(void *, void *);
269272
/* Strings are always passed by reference. */
270273
void (*char_by_reference)(void *, int, void *, void *, int, int);
271274
/* The handles when arguments are passed by value. */
275+
int8_t (*int8_t_by_value)(int8_t, int8_t);
276+
int16_t (*int16_t_by_value)(int16_t, int16_t);
272277
int (*int32_t_by_value)(int32_t, int32_t);
278+
int64_t (*int64_t_by_value)(int64_t, int64_t);
273279
float (*float_by_value)(float, float);
274280
double (*double_by_value)(double, double);
275281

@@ -6635,7 +6641,10 @@ name##_by_value_adapter (void *invec, void *inoutvec, int *len, \
66356641
} \
66366642
}
66376643

6644+
GEN_COREDUCE (redux_int8, int8_t)
6645+
GEN_COREDUCE (redux_int16, int16_t)
66386646
GEN_COREDUCE (redux_int32, int32_t)
6647+
GEN_COREDUCE (redux_int64, int64_t)
66396648
GEN_COREDUCE (redux_real32, float)
66406649
GEN_COREDUCE (redux_real64, double)
66416650

@@ -6979,8 +6988,20 @@ PREFIX (co_reduce) (gfc_descriptor_t *a, void *(*opr) (void *, void *), int opr_
69796988
* arguments to be passed by value. */
69806989
if ((opr_flags & GFC_CAF_ARG_VALUE) > 0)
69816990
{
6982-
int32_t_by_value = (typeof (VALUE_FUNC(int32_t)))opr;
6983-
MPI_Op_create(redux_int32_by_value_adapter, 1, &op);
6991+
#define ifTypeGen(type) if (GFC_DESCRIPTOR_SIZE(a) == sizeof (type ## _t)) \
6992+
{ \
6993+
type ## _t_by_value = (typeof (VALUE_FUNC(type ## _t)))opr; \
6994+
MPI_Op_create(redux_ ## type ## _by_value_adapter, 1, &op); \
6995+
}
6996+
6997+
ifTypeGen(int8)
6998+
else ifTypeGen(int16)
6999+
else ifTypeGen(int32)
7000+
else ifTypeGen(int64)
7001+
else
7002+
{
7003+
caf_runtime_error ("CO_REDUCE unsupported integer datatype");
7004+
}
69847005
}
69857006
else
69867007
{

src/tests/regression/reported/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ caf_compile_executable(issue-488-multi-dim-cobounds issue-488-multi-dim-cobounds
99
caf_compile_executable(issue-493-coindex-slice issue-493-coindex-slice.f90)
1010
caf_compile_executable(issue-503-multidim-array-broadcast issue-503-multidim-array-broadcast.f90)
1111
caf_compile_executable(issue-503-non-contig-red-ndarray issue-503-non-contig-red-ndarray.f90)
12+
caf_compile_executable(issue-322-non-coarray-vector-idx-lhs issue-322-non-coarray-vector-idx-lhs.f90)
1213
if (gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0))
1314
caf_compile_executable(issue-515-mimic-mpi-gatherv issue-515-mimic-mpi-gatherv.f90)
1415
endif()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
program mod_vecsub_01
2+
!! Issue #322 reported by @reinh-bader
3+
!! https://github.com/sourceryinstitute/OpenCoarrays/issues/322
4+
!! Related to other vector indexing issues
5+
implicit none
6+
integer, parameter :: ndim = 5, vdim = 2
7+
real :: vec(ndim), res(ndim)[*]
8+
integer :: idx(vdim)
9+
integer :: i, me
10+
logical :: ok[*]
11+
12+
res = [ (real(i), i=1, ndim) ]
13+
vec = 0.0
14+
idx = [ ndim, 1 ]
15+
ok = .true.
16+
sync all
17+
me = this_image()
18+
vec(idx) = res(1:2)[1]
19+
if (vec(1) /= 2.0 .or. vec(5) /= 1.0) then
20+
critical
21+
ok[1] = .false.
22+
write(*, *) 'FAIL on image ',me,vec(idx)
23+
end critical
24+
end if
25+
if (me == 1) then
26+
if (ok) then
27+
write(*, *) 'Test passed.'
28+
else
29+
error stop 1
30+
end if
31+
end if
32+
end program

0 commit comments

Comments
 (0)