#IT4Innovations
#BS 2024


easyblock = 'ConfigureMake'

name = 'OpenMPI'
version = '2.1.0'

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

toolchain = {'name': 'GCC', 'version': '12.2.0'}

source_urls = ['https://www.open-mpi.org/software/ompi/v%(version_major_minor)s/downloads']
sources = [SOURCELOWER_TAR_GZ]
patches = ['OpenMPI-2.1_fix-ib-query.patch']
checksums = [
    '265a9c64a468cce464edd069ed8612e1865c5f112f84f4a7a855fb2a0d15e74b',  # openmpi-2.1.0.tar.gz
    '662d7ef1d0cd0890d2dc4ecb5243012be29bf6b4003da0f006e7cd2125d40e4c',  # OpenMPI-2.1_fix-ib-query.patch
]

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

configopts = '--enable-shared --enable-mpi-thread-multiple --with-verbs '
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)

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

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

moduleclass = 'mpi'

