in configure.py [0:0]
def set_other_mpi_vars(environ_cp):
"""Set other MPI related variables."""
# Link the MPI header files
mpi_home = environ_cp.get('MPI_HOME')
# Determine the location of the MPI header files
include_home = ""
if os.path.exists(os.path.join(mpi_home, 'include/mpi.h')):
symlink_force('%s/include/mpi.h' % mpi_home, 'third_party/mpi/mpi.h')
include_home = mpi_home + "/include"
elif os.path.exists(os.path.join(mpi_home, 'include/mpi/mpi.h')):
symlink_force('%s/include/mpi/mpi.h' % mpi_home, 'third_party/mpi/mpi.h')
include_home = mpi_home + "/include/mpi"
else:
raise ValueError(
'Cannot find the MPI header file in %s/include or %s/include/mpi' %
mpi_home, mpi_home)
# Determine if we use OpenMPI or MVAPICH, these require different header files
# to be included here to make bazel dependency checker happy
if os.path.exists(os.path.join(include_home, 'mpi_portable_platform.h')):
symlink_force(
os.path.join(include_home, 'mpi_portable_platform.h'),
'third_party/mpi/mpi_portable_platform.h')
write_to_bazelrc("build --define mpi_library_is_openmpi_based=true")
else:
# MVAPICH / MPICH
symlink_force(
os.path.join(include_home, 'mpio.h'), 'third_party/mpi/mpio.h')
symlink_force(
os.path.join(include_home, 'mpicxx.h'), 'third_party/mpi/mpicxx.h')
write_to_bazelrc("build --define mpi_library_is_openmpi_based=false")
if os.path.exists(os.path.join(mpi_home, 'lib/libmpi.so')):
symlink_force(
os.path.join(mpi_home, 'lib/libmpi.so'), 'third_party/mpi/libmpi.so')
elif os.path.exists(os.path.join(mpi_home, 'lib64/libmpi.so')):
symlink_force(
os.path.join(mpi_home, 'lib64/libmpi.so'), 'third_party/mpi/libmpi.so')
elif os.path.exists(os.path.join(mpi_home, 'lib32/libmpi.so')):
symlink_force(
os.path.join(mpi_home, 'lib32/libmpi.so'), 'third_party/mpi/libmpi.so')
else:
raise ValueError(
'Cannot find the MPI library file in %s/lib or %s/lib64 or %s/lib32' %
mpi_home, mpi_home, mpi_home)