Skip to content

caf script should capture MPI scripts with full paths #193

@jeffhammond

Description

@jeffhammond

I installed OpenCoarrays like this:

# MPICH_* override because MPICH was built against GCC-5
export MPICH_CC=gcc-6
export MPICH_FC=gfortran-6
export MPI_DIR=/opt/mpich/dev/gcc/default # Jeff's Mac
git clone https://github.com/sourceryinstitute/opencoarrays.git && cd opencoarrays && \
mkdir build && cd build && \
CC=$MPI_DIR/bin/mpicc FC=$MPI_DIR/bin/mpifort cmake .. \
-DCMAKE_INSTALL_PREFIX=/opt/opencoarrays/mpich-dev-gcc-6 \
-DMPI_C_COMPILER=$MPI_DIR/bin/mpicc -DMPI_Fortran_COMPILER=$MPI_DIR/bin/mpifort && \
make -j4 && \
ctest && \
make install

When I went to use caf, I saw this error:

github-official jrhammon$ make allfortran
cd FORTRAN/Synch_p2p;       /Applications/Xcode.app/Contents/Developer/usr/bin/make p2p
/opt/opencoarrays/mpich-dev-gcc-6/bin/caf -std=f2008 -ffree-form -cpp -O3  -DPRKVERSION="'2.16'" -DRADIUS=  p2p.f90 -o p2p
ifort: command line warning #10006: ignoring unknown option '-std=f2008'
ifort: command line warning #10006: ignoring unknown option '-ffree-form'
ifort: command line warning #10006: ignoring unknown option '-fcoarray=lib'
^Cmake[1]: *** [p2p] Error 2
make: *** [allfortranserial] Interrupt: 2

This is because I have mpif90 associated with ifort in my PATH. I rely upon absolute paths to get GCC and LLVM MPI wrappers, as I did above.

Unfortunately, caf doesn't remember what MPI wrapper was used to build the library:

# Default to "mpif90" Fortran compiler if environment variable CAFC has zero length:
if [ -z "$CAFC" ]; then
   CAFC=mpif90
fi

It really should do this, both because of people like me who don't necessarily have the right mpif90 first in their PATH on purpose, but also for anyone that doesn't know better and switches MPI installation.

This will likely prevent all sorts of awful bug reports associated with people that compile with MPICH but try to run with Open-MPI, and vice versa.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions