Skip to content

fix configuration option for OpenMP offload target + logic in sanity check step in LLVM easyblock #3755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions easybuild/easyblocks/l/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,7 @@ def llvm_src_dir(self):
return self.start_dir

def _configure_build_targets(self):
# list of CUDA compute capabilities to use can be specifed in two ways (where (2) overrules (1)):
# (1) in the easyconfig file, via the custom cuda_compute_capabilities;
# (2) in the EasyBuild configuration, via --cuda-compute-capabilities configuration option;
cuda_cc_list = build_option('cuda_compute_capabilities') or self.cfg['cuda_compute_capabilities'] or []
cuda_cc_list = self.cfg.get_cuda_cc_template_value("cuda_cc_space_sep", required=False).split()
cuda_toolchain = hasattr(self.toolchain, 'COMPILER_CUDA_FAMILY')
amd_gfx_list = self.cfg['amd_gfx_list'] or []

Expand Down Expand Up @@ -521,7 +518,7 @@ def _configure_final_build(self):
if self.cfg['build_openmp_offload']:
# Force dlopen of the GPU libraries at runtime, not using existing libraries
if LooseVersion(self.version) >= '19':
self.runtimes_cmake_args['LIBOMPTARGET_PLUGINS_TO_BUILD'] = '%s' % '|'.join(self.offload_targets)
self._cmakeopts['LIBOMPTARGET_PLUGINS_TO_BUILD'] = self.list_to_cmake_arg(self.offload_targets)
dlopen_plugins = set(self.offload_targets) & set(AVAILABLE_OFFLOAD_DLOPEN_PLUGIN_OPTIONS)
if dlopen_plugins:
self._cmakeopts['LIBOMPTARGET_DLOPEN_PLUGINS'] = self.list_to_cmake_arg(dlopen_plugins)
Expand Down Expand Up @@ -803,9 +800,9 @@ def configure_step(self):
if not get_software_root('CUDA'):
setvar('CUDA_NVCC_EXECUTABLE', 'IGNORE')

if self.cfg['build_openmp_offload'] and '19' <= LooseVersion(self.version) < '20':
gpu_archs = []
gpu_archs += ['sm_%s' % cc for cc in self.cuda_cc]
# 20.1+ uses a generic IR for OpenMP DeviceRTL
if self.cfg['build_openmp_offload'] and LooseVersion(self.version) < '20.1':
gpu_archs = self.cfg.get_cuda_cc_template_value("cuda_sm_space_sep", required=False).split()
gpu_archs += self.amd_gfx
if gpu_archs:
self._cmakeopts['LIBOMPTARGET_DEVICE_ARCHITECTURES'] = self.list_to_cmake_arg(gpu_archs)
Expand Down Expand Up @@ -1466,18 +1463,17 @@ def sanity_check_step(self, custom_paths=None, custom_commands=None, *args, **kw
omp_lib_files += [f'libomptarget-amdgpu-{gfx}.bc' for gfx in self.amd_gfx]
else:
omp_lib_files += ['libomptarget-amdgpu.bc']

if version < '19':
# Before LLVM 19, omp related libraries are installed under 'ROOT/lib''
check_lib_files += omp_lib_files
check_bin_files += ['llvm-omp-kernel-replay']
if version < '20':
check_bin_files += ['llvm-omp-device-info']
else:
# Starting from LLVM 19, omp related libraries are installed the runtime library directory
check_librt_files += omp_lib_files
check_bin_files += ['llvm-omp-kernel-replay']
if version < '20':
check_bin_files += ['llvm-omp-device-info']
else:
check_bin_files += ['llvm-offload-device-info']
check_bin_files += ['llvm-offload-device-info']
if version < '19':
# Before LLVM 19, omp related libraries are installed under 'ROOT/lib''
check_lib_files += omp_lib_files
else:
# Starting from LLVM 19, omp related libraries are installed the runtime library directory
check_librt_files += omp_lib_files

if self.cfg['build_openmp_tools']:
check_files += [os.path.join('lib', 'clang', resdir_version, 'include', 'ompt.h')]
Expand Down