Skip to content

Commit 096454f

Browse files
author
Damian Rouson
committed
build_opencoarrays.sh sets MPI-wrapped FC/CC value
1 parent 2e585b4 commit 096454f

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

prerequisites/install-functions/build_opencoarrays.sh

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,27 @@ build_opencoarrays()
1010
build_path="${build_path}"/opencoarrays/$("${opencoarrays_src_dir}"/install.sh -V opencoarrays)
1111
mkdir -p "$build_path"
1212
pushd "$build_path"
13-
if [[ -z "${MPICC:-}" || -z "${MPIFC:-}" || -z "${CMAKE:-}" || -z "${FC:-}" || -z "${CC:-}" ]]; then
14-
emergency "Empty MPICC=$MPICC or MPIFC=$MPIFC or FC or CC or CMAKE=$CMAKE [exit 90]"
15-
else
16-
info "Configuring OpenCoarrays in ${PWD} with the command:"
17-
info "CC=\"${CC}\" FC=\"${FC}\" $CMAKE \"${opencoarrays_src_dir}\" -DCMAKE_INSTALL_PREFIX=\"${install_path}\" -DMPI_C_COMPILER=\"${MPICC}\" -DMPI_Fortran_COMPILER=\"${MPIFC}\""
18-
CC="${CC}" FC="${FC}" $CMAKE "${opencoarrays_src_dir}" -DCMAKE_INSTALL_PREFIX="${install_path}" -DMPI_C_COMPILER="${MPICC}" -DMPI_Fortran_COMPILER="${MPIFC}"
19-
info "Building OpenCoarrays in ${PWD} with the command make -j${num_threads}"
20-
make "-j${num_threads}"
21-
if [[ ! -z ${SUDO:-} ]]; then
22-
printf "\nThe chosen installation path requires sudo privileges. Please enter password if prompted.\n"
23-
fi
24-
info "Installing OpenCoarrays in ${install_path} with the command ${SUDO:-} make install"
25-
${SUDO:-} make install
13+
if [[ -z ${MPIFC:-} || -z ${MPICC:-} ]]; then
14+
emergency "build_opencoarrays.sh: empty \${MPIFC}=${MPIFC:-} or \${MPICC}=${MPICC:-}"
2615
fi
16+
MPIFC_show=`$MPIFC -show`
17+
MPICC_show=`$MPICC -show`
18+
if [[ ${MPIFC_show} != *gfortran* || ${MPICC_show} != *gcc* ]]; then
19+
emergency "build_opencoarrays.sh: MPI doesn't wrap gfortran/gcc: \${MPIFC_show}=${MPIFC_show}, \${MPICC_show}=${MPICC_show}"
20+
fi
21+
# Set FC to the MPI implementation's gfortran command with any preceding path but without any subsequent arguments:
22+
FC="${MPIFC_show%%gfortran*}"gfortran
23+
# Set CC to the MPI implementation's gcc command...
24+
CC="${MPICC_show%%gcc*}"gcc
25+
info "Configuring OpenCoarrays in ${PWD} with the command:"
26+
info "CC=\"${CC}\" FC=\"${FC}\" $CMAKE \"${opencoarrays_src_dir}\" -DCMAKE_INSTALL_PREFIX=\"${install_path}\" -DMPI_C_COMPILER=\"${MPICC}\" -DMPI_Fortran_COMPILER=\"${MPIFC}\""
27+
CC="${CC}" FC="${FC}" $CMAKE "${opencoarrays_src_dir}" -DCMAKE_INSTALL_PREFIX="${install_path}" -DMPI_C_COMPILER="${MPICC}" -DMPI_Fortran_COMPILER="${MPIFC}"
28+
info "Building OpenCoarrays in ${PWD} with the command make -j${num_threads}"
29+
make "-j${num_threads}"
30+
if [[ ! -z ${SUDO:-} ]]; then
31+
printf "\nThe chosen installation path requires sudo privileges. Please enter password if prompted.\n"
32+
fi
33+
info "Installing OpenCoarrays in ${install_path} with the command ${SUDO:-} make install"
34+
${SUDO:-} make install
2735
}
36+

0 commit comments

Comments
 (0)