diff --git a/site_scons/components/__init__.py b/site_scons/components/__init__.py index c0bf04b5599..044c5c2b6da 100644 --- a/site_scons/components/__init__.py +++ b/site_scons/components/__init__.py @@ -105,15 +105,8 @@ def ofi_config(config): return rc -def define_mercury(reqs): - """Mercury definitions""" - libs = ['rt'] - - if reqs.get_env('PLATFORM') == 'darwin': - libs = [] - else: - reqs.define('rt', libs=['rt']) - +def define_ofi(reqs): + """OFI definitions""" fabrics = ( "cxi", "efa", @@ -178,6 +171,9 @@ def define_mercury(reqs): patch_rpath=['lib64'], build_env={'CFLAGS': "-fstack-usage -fPIC"}) + +def define_ucx(reqs): + """UCX definitions""" ucx_configure = ['./configure', '--disable-assertions', '--disable-params-check', '--enable-mt', '--without-go', '--without-java', '--prefix=$UCX_PREFIX', '--libdir=$UCX_PREFIX/lib64', '--enable-cma', '--without-cuda', @@ -204,6 +200,31 @@ def define_mercury(reqs): build_env={'CFLAGS': '-Wno-error'}, package='ucx-devel' if inst(reqs, 'ucx') else None) + +def define_mercury(reqs): + """Mercury definitions""" + libs = ['rt'] + + if reqs.get_env('PLATFORM') == 'darwin': + libs = [] + else: + reqs.define('rt', libs=['rt']) + + providers = reqs.get_env('PROVIDERS') + if 'all' in providers: + mercury_plugins = ['ofi', 'ucx'] + else: + mercury_plugins = providers + + if 'ofi' in mercury_plugins: + define_ofi(reqs) + if 'ucx' in mercury_plugins: + define_ucx(reqs) + + def define_from_plugin(x, y): + """Return a define for a plugin""" + return f'-D{x}:BOOL=' + ('ON' if y in mercury_plugins else 'OFF') + mercury_build = ['cmake', '-DBUILD_SHARED_LIBS:BOOL=ON', '-DCMAKE_CXX_FLAGS:STRING="-std=c++11"', @@ -223,8 +244,8 @@ def define_mercury(reqs): '-DMERCURY_ENABLE_DEBUG:BOOL=ON', '-DNA_USE_DYNAMIC_PLUGINS:BOOL=ON', '-DNA_USE_SM:BOOL=ON', - '-DNA_USE_OFI:BOOL=ON', - '-DNA_USE_UCX:BOOL=ON', + define_from_plugin('NA_USE_OFI', 'ofi'), + define_from_plugin('NA_USE_UCX', 'ucx'), '../mercury'] build_type = "RelWithDebInfo" @@ -249,7 +270,7 @@ def define_mercury(reqs): ['make', 'install']], libs=['mercury'], pkgconfig='mercury', - requires=['ofi', 'ucx'] + libs, + requires=mercury_plugins + libs, out_of_src_build=True, package='mercury-devel' if inst(reqs, 'mercury') else None, build_env={'CFLAGS': '-fstack-usage'}) diff --git a/site_scons/prereq_tools/base.py b/site_scons/prereq_tools/base.py index df176f1f467..bb745403f3e 100644 --- a/site_scons/prereq_tools/base.py +++ b/site_scons/prereq_tools/base.py @@ -522,6 +522,8 @@ def __init__(self, env, opts): opts.Add(BoolVariable('CRT_PP', 'Preprocess CaRT sources', False)) opts.Add(BoolVariable('HEAP_PROFILER', 'Instrument C code with Gperftools Heap Profiler', False)) + opts.Add(ListVariable('PROVIDERS', "List of providers to build", 'all', + ['all', 'ofi', 'ucx'])) opts.Update(self.__env) @@ -595,8 +597,13 @@ def __init__(self, env, opts): def run_build(self, opts): """Build and dependencies""" - common_reqs = ['ofi', 'ucx', 'hwloc', 'mercury', 'uuid', 'crypto', 'protobufc', + common_reqs = ['hwloc', 'mercury', 'uuid', 'crypto', 'protobufc', 'lz4', 'isal', 'isal_crypto', 'argobots'] + providers = self.__env.get('PROVIDERS') + if 'all' in providers: + common_reqs += ['ofi', 'ucx'] + else: + common_reqs += providers client_reqs = ['fused', 'json-c', 'capstone', 'aio'] server_reqs = ['pmdk', 'spdk'] test_reqs = ['cmocka']