Skip to content

Commit d5655ab

Browse files
committed
Attempt to fix missing OpenMPI C on travis macOS
- Modernized some usage of FindMPI.cmake
1 parent adc3d5d commit d5655ab

File tree

7 files changed

+35
-17
lines changed

7 files changed

+35
-17
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
language: generic
2+
language: c
33

44
os: osx
55

@@ -97,11 +97,11 @@ before_install:
9797

9898
install:
9999
- pwd
100-
- travis_wait 40 developer-scripts/travis/install.${TRAVIS_OS_NAME}.sh
100+
- ./developer-scripts/travis/install.${TRAVIS_OS_NAME}.sh
101101

102102
script:
103103
- pwd
104-
- developer-scripts/travis/test-script.${BUILD_TYPE:-cmake}.sh
104+
- ./developer-scripts/travis/test-script.${BUILD_TYPE:-cmake}.sh
105105

106106
after_script:
107107
- find . -name '*.gcno' -print

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,14 @@ endif()
244244

245245
find_package( MPI )
246246

247-
if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC))
247+
if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC_EXECUTABLE))
248248
# Get default install location of MPICH from install.sh
249+
message(WARNING "Could not find all MPI components!")
250+
message(WARNING "
251+
MPI_C_FOUND = ${MPI_C_FOUND}
252+
MPI_Fortran_FOUND = ${MPI_Fortran_FOUND}
253+
MPIEXEC_EXECUTABLE = ${MPIEXEC_EXECUTABLE}
254+
")
249255
execute_process( COMMAND "./install.sh" -P mpich
250256
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
251257
OUTPUT_VARIABLE DEFAULT_MPICH_INSTALL_LOC
@@ -262,7 +268,7 @@ endif()
262268
list(REMOVE_DUPLICATES MPI_Fortran_INCLUDE_PATH)
263269

264270
# Test for consistent MPI environment
265-
if (NOT MPIEXEC)
271+
if (NOT MPIEXEC_EXECUTABLE)
266272
message ( ERROR "CMake failed to find `mpiexec` or similar. If building with `./install.sh` please
267273
report this bug to the OpenCoarrays developers at
268274
https://github.com/sourceryinstitute/opencoarrays/issues, otherwise point CMake
@@ -271,7 +277,7 @@ else()
271277
add_definitions(-DHAVE_MPI)
272278
endif()
273279

274-
get_filename_component(MPIEXEC_RELATIVE_LOC "${MPIEXEC}"
280+
get_filename_component(MPIEXEC_RELATIVE_LOC "${MPIEXEC_EXECUTABLE}"
275281
PROGRAM)
276282
get_filename_component(MPIEXEC_ABS_LOC "${MPIEXEC_RELATIVE_LOC}"
277283
REALPATH)

developer-scripts/travis/install.osx.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ echo "Performing Travis-CI installation phase on macOS..."
2424
# Update and install via Homebrew on macOS
2525
brew update > /dev/null
2626

27+
brew install gcc
28+
brew link --overwrite gcc
29+
2730
for pkg in ${OSX_PACKAGES}; do
28-
brew ls --versions "${pkg}" >/dev/null || brew install --force-bottle "${pkg}" || brew link --overwrite "${pkg}"
29-
brew outdated "${pkg}" || brew upgrade --force-bottle "${pkg}"
31+
brew ls --versions "${pkg}" >/dev/null || brew install "${pkg}" || brew link --overwrite "${pkg}"
32+
brew outdated "${pkg}" || brew upgrade "${pkg}"
3033
done
3134

3235
# Uninstall mpich and openmpi so that we can install our own version

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ for version in ${GCC}; do
3737
brew outdated "${mpi}" || brew upgrade "${mpi}"
3838
brew unlink "${mpi}" || true
3939
done
40-
brew link open-mpi
40+
brew link --overwrite open-mpi
41+
otool -L "$(brew --prefix open-mpi)/lib/libmpi.dylib"
42+
otool -L "$(brew --prefix libevent)/lib/libevent.dylib"
43+
OMPI_CC="$(prew --prefix gcc)/bin/gcc-${version}"
44+
export OMPI_CC
4145
fi
4246
${FC} --version
4347
${CC} --version
@@ -50,7 +54,12 @@ for version in ${GCC}; do
5054
[[ -d "${BLD_DIR}" ]] && rm -rf "${BLD_DIR:?}"/* || true
5155
(
5256
cd "${BLD_DIR}"
53-
cmake -DCMAKE_INSTALL_PREFIX:PATH="${HOME}/OpenCoarrays" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ..
57+
cmake -Wdev \
58+
-DCMAKE_INSTALL_PREFIX:PATH="${HOME}/OpenCoarrays" \
59+
-DCMAKE_BUILD_TYPE:STRING="${BUILD_TYPE}" \
60+
-DMPI_CXX_SKIP_MPICXX:BOOL=ON \
61+
-DMPI_ASSUME_NO_BUILTIN_MPI:BOOL=ON \
62+
-DMPI_SKIP_GUESSING ..
5463
make -j 4
5564
CTEST_FLAGS=(--output-on-failure --schedule-random --repeat-until-fail "${NREPEAT:-5}" --timeout "${TEST_TIMEOUT:-200}")
5665
if [[ "${BUILD_TYPE}" =~ Deb ]]; then

prerequisites/install-functions/build_opencoarrays.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ build_opencoarrays()
3737
if ! ((${#MPIEXEC_CANDIDATES[@]} >= 1)); then
3838
emergency "Could not find a suitable \`mpiexec\` in directory containing mpi wrappers (${MPICC%/*})"
3939
else
40-
MPIEXEC="${MPIEXEC_CANDIDATES[0]}"
40+
MPIEXEC_EXECUTABLE="${MPIEXEC_CANDIDATES[0]}"
4141
fi
4242

4343
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_installation_path.sh"
4444
set_or_print_installation_path
4545

4646
info "Configuring OpenCoarrays in ${PWD} with the command:"
47-
info "CC=\"${CC}\" FC=\"${FC}\" $CMAKE \"${opencoarrays_src_dir}\" \"${WDEVFLAG}\" -DCMAKE_INSTALL_PREFIX=\"${install_path}\" -DMPIEXEC=\"${MPIEXEC}\" -DMPI_C_COMPILER=\"${MPICC}\" -DMPI_Fortran_COMPILER=\"${MPIFC}\""
48-
CC="${CC}" FC="${FC}" $CMAKE "${opencoarrays_src_dir}" "${WDEVFLAG}" -DCMAKE_INSTALL_PREFIX="${install_path}" -DMPIEXEC="${MPIEXEC}" -DMPI_C_COMPILER="${MPICC}" -DMPI_Fortran_COMPILER="${MPIFC}"
47+
info "CC=\"${CC}\" FC=\"${FC}\" $CMAKE \"${opencoarrays_src_dir}\" \"${WDEVFLAG}\" -DCMAKE_INSTALL_PREFIX=\"${install_path}\" -DMPIEXEC_EXECUTABLE=\"${MPIEXEC_EXECUTABLE}\" -DMPI_C_COMPILER=\"${MPICC}\" -DMPI_Fortran_COMPILER=\"${MPIFC}\""
48+
CC="${CC}" FC="${FC}" $CMAKE "${opencoarrays_src_dir}" "${WDEVFLAG}" -DCMAKE_INSTALL_PREFIX="${install_path}" -DMPIEXEC_EXECUTABLE="${MPIEXEC_EXECUTABLE}" -DMPI_C_COMPILER="${MPICC}" -DMPI_Fortran_COMPILER="${MPIFC}"
4949
info "Building OpenCoarrays in ${PWD} with the command make -j${num_threads}"
5050
make "-j${num_threads}"
5151
if [[ ! -z ${SUDO:-} ]]; then

src/extensions/cafrun.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ set -o pipefail
5050
# Configured variables
5151
#---------------------
5252
#
53-
# CAF_VERSION, MPIEXEC, MPIEXEC_NUMPROC_FLAG, MPIEXEC_PREFLAGS, MPIEXEC_POSTFLAGS,
53+
# CAF_VERSION, MPIEXEC_EXECUTABLE, MPIEXEC_NUMPROC_FLAG, MPIEXEC_PREFLAGS, MPIEXEC_POSTFLAGS,
5454
# HAVE_FAILED_IMG
5555
#
5656

5757
caf_version='@CAF_VERSION@'
58-
CAFRUN="@MPIEXEC@"
58+
CAFRUN="@MPIEXEC_EXECUTABLE@"
5959
if [[ "${CAFRUN}" == @*@ ]]; then
6060
CAFRUN=mpiexec
6161
fi

src/mpi/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cmake_host_system_information(RESULT N_CPU QUERY NUMBER_OF_LOGICAL_CORES)
1515
set(N_CPU ${N_CPU} PARENT_SCOPE)
1616
cmake_host_system_information(RESULT HOST_NAME QUERY HOSTNAME)
1717
set(HOSTNAME ${HOSTNAME} PARENT_SCOPE)
18-
execute_process(COMMAND ${MPIEXEC} --version
18+
execute_process(COMMAND ${MPIEXEC_EXECUTABLE} --version
1919
OUTPUT_VARIABLE mpi_version_out)
2020
if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]")
2121
message( STATUS "OpenMPI detected")
@@ -249,7 +249,7 @@ configure_file("${CMAKE_SOURCE_DIR}/src/extensions/caf.in" "${CMAKE_BINARY_DIR}/
249249

250250
# List of carrun.in variables needing configuration:
251251
#
252-
# @CAF_VERSION@ @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ @MPIEXEC_PREFLAGS@ @MPIEXEC_POSTFLAGS@
252+
# @CAF_VERSION@ @MPIEXEC_EXECUTABLE@ @MPIEXEC_NUMPROC_FLAG@ @MPIEXEC_PREFLAGS@ @MPIEXEC_POSTFLAGS@
253253
# @HAVE_FAILED_IMG@
254254
#
255255

0 commit comments

Comments
 (0)