easyblock = 'ConfigureMake'

name = 'OpenMPI'
version = '2.1.1'

homepage = 'http://www.open-mpi.org/'
description = """The Open MPI Project is an open source MPI-2 implementation."""

toolchain = {'name': 'GCC', 'version': '6.4.0-2.28'}

source_urls = ['http://www.open-mpi.org/software/ompi/v%(version_major_minor)s/downloads']
sources = [SOURCELOWER_TAR_GZ]
checksums = ['afe4bef3c4378bc76eea96c623d5aa4c1c98b9e057d281c646e68869292a77dc']

dependencies = [('hwloc', '1.11.7')]

configopts = '--enable-shared --enable-mpi-thread-multiple --with-verbs --enable-mpi-cxx '
configopts += '--enable-mpirun-prefix-by-default '  # suppress failure modes in relation to mpirun path
configopts += '--with-hwloc=$EBROOTHWLOC '  # hwloc support
configopts += '--without-ucx '  # hard disable UCX, to dance around bug (https://github.com/open-mpi/ompi/issues/4345)

# to enable SLURM integration (site-specific)
# configopts += '--with-slurm --with-pmi=/usr/include/slurm --with-pmi-libdir=/usr'

# needed for --with-verbs
osdependencies = [('libibverbs-dev', 'libibverbs-devel', 'rdma-core-devel')]

libs = ["mpi_mpifh", "mpi", "ompitrace", "open-pal", "open-rte"]
sanity_check_paths = {
    'files': ["bin/%s" % binfile for binfile in ["ompi_info", "opal_wrapper", "orterun"]] +
             ["lib/lib%s.%s" % (libfile, SHLIB_EXT) for libfile in libs] +
             ["include/%s.h" % x for x in ["mpi-ext", "mpif-config", "mpif", "mpi", "mpi_portable_platform"]],
    'dirs': [],
}

moduleclass = 'mpi'
