Skip to content

Ban ligomp.so at GCCcore level #4951

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion easybuild/toolchains/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"""
import re

from easybuild.toolchains.gcccore import GCCcore
from easybuild.toolchains.gcccore import GCCcore, GCCCORE_BANNED_LIBRARIES
from easybuild.tools import LooseVersion
from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME

Expand All @@ -43,6 +43,16 @@ class GccToolchain(GCCcore):
SUBTOOLCHAIN = [GCCcore.NAME, SYSTEM_TOOLCHAIN_NAME]
OPTIONAL = False

def banned_linked_shared_libs(self):
"""
List of shared libraries (names, file names, paths) which are
not allowed to be linked in any installed binary/library.
"""
banned_libs = super().banned_linked_shared_libs()

# Restore libraries that were banned at GCCcore level but ok for GCC
return list(set(banned_libs) - set(GCCCORE_BANNED_LIBRARIES))

def is_deprecated(self):
"""Return whether or not this toolchain is deprecated."""
# GCC toolchains older than GCC version 8.x are deprecated since EasyBuild v4.5.0
Expand Down
12 changes: 12 additions & 0 deletions easybuild/toolchains/gcccore.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
from easybuild.tools import LooseVersion
from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME

# At GCCcore level we do not allow OpenMP
GCCCORE_BANNED_LIBRARIES = ['libgomp.so']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has there been a discussion of what version of GCCcore we should add this check for? I do not think it is worthwhile to apply this to all GCCcore versions we have.

Probably start with one of:

  • 14.2.0 (2025a generation)
  • 14.3.0 (2025b generation)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, I think it only really matters once we introduce modern LLVM (although it was probably also a potential issue for Intel compilers since we introduced GCCcore)



class GCCcore(Gcc):
"""Compiler-only toolchain, including only GCC and binutils."""
Expand All @@ -46,6 +49,15 @@ class GCCcore(Gcc):
# for old versions of some toolchains (GCC, intel) it is not part of the hierarchy and hence optional
OPTIONAL = True

def banned_linked_shared_libs(self):
"""
List of shared libraries (names, file names, paths) which are
not allowed to be linked in any installed binary/library.
"""
banned_libs = super().banned_linked_shared_libs()

return banned_libs + GCCCORE_BANNED_LIBRARIES

def is_deprecated(self):
"""Return whether or not this toolchain is deprecated."""
# GCC toolchains older than GCC version 8.x are deprecated since EasyBuild v4.5.0
Expand Down
25 changes: 14 additions & 11 deletions easybuild/toolchains/linalg/flexiblas.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

from easybuild.tools.toolchain.linalg import LinAlg

from easybuild.tools.options import build_option
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import get_shared_lib_ext

Expand All @@ -48,18 +49,20 @@ def det_flexiblas_backend_libs():
# System-wide (config directory):
# OPENBLAS
# library = libflexiblas_openblas.so
res = run_shell_cmd("flexiblas list", hidden=True)

shlib_ext = get_shared_lib_ext()
flexiblas_lib_regex = re.compile(r'library = (?P<lib>lib.*\.%s)' % shlib_ext, re.M)
flexiblas_libs = flexiblas_lib_regex.findall(res.output)

backend_libs = []
for flexiblas_lib in flexiblas_libs:
# assumption here is that the name of FlexiBLAS library (like 'libflexiblas_openblas.so')
# maps directly to name of the backend library ('libopenblas.so')
backend_lib = 'lib' + flexiblas_lib.replace('libflexiblas_', '')
backend_libs.append(backend_lib)
# in a unittest context the flexiblas command does not exist, but in a normal context it always does
if not build_option('unit_testing_mode'):
res = run_shell_cmd("flexiblas list", hidden=True)

shlib_ext = get_shared_lib_ext()
flexiblas_lib_regex = re.compile(r'library = (?P<lib>lib.*\.%s)' % shlib_ext, re.M)
flexiblas_libs = flexiblas_lib_regex.findall(res.output)

for flexiblas_lib in flexiblas_libs:
# assumption here is that the name of FlexiBLAS library (like 'libflexiblas_openblas.so')
# maps directly to name of the backend library ('libopenblas.so')
backend_lib = 'lib' + flexiblas_lib.replace('libflexiblas_', '')
backend_libs.append(backend_lib)

return backend_libs

Expand Down