# IT4Innovations
# LK 2023

easyblock = 'EB_UCX_Plugins'

name = 'UCX-CUDA'
version = '1.14.1'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'http://www.openucx.org/'
description = """Unified Communication X
An open-source production grade communication framework for data centric
and high-performance applications

This module adds the UCX CUDA support.
"""

toolchain = {'name': 'GCCcore', 'version': '12.2.0'}
toolchainopts = {'pic': True}

source_urls = ['https://github.com/openucx/ucx/releases/download/v%(version)s']
sources = [{'filename': 'ucx-%(version)s.tar.gz', 'alt_location': 'UCX'}]
patches = ['%(name)s-1.11.0_link_against_existing_UCX_libs.patch']
checksums = [
    ('457187fa020e526609ba91e7750c9941d57bd57d60d6eed317b40ad8824aca93',
     'baa0634cafb269a3112f626eb226bcd2ca8c9fcf0fec3b8e2a3553baad5f77aa'),  # ucx-1.14.1.tar.gz
    {'UCX-CUDA-1.11.0_link_against_existing_UCX_libs.patch':
     '457187fa020e526609ba91e7750c9941d57bd57d60d6eed317b40ad8824aca93'},
]

builddependencies = [
    ('binutils', '2.39'),
    ('Autotools', '20220317'),
    ('pkgconf', '1.9.3'),
]

dependencies = [
    ('zlib', '1.2.12'),
    ('UCX', '1.14.1'),
    ('CUDA', '12.2.0', '', SYSTEM),
    ('GDRCopy', '2.3'),
]

configopts = '--enable-optimizations --enable-cma --enable-mt --with-verbs '
configopts += '--without-java --without-go --disable-doxygen-doc '

import os
if os.environ.get("CLUSTERNAME") in ["BARBORA"]:
   configopts += '--with-xpmem --with-knem=/opt/knem-1.1.4.90mlnx1'
if os.environ.get("CLUSTERNAME") in ["KAROLINA"]:
   configopts += '--with-xpmem --with-knem=/opt/knem-1.1.4.90mlnx3'

moduleclass = 'lib'
