Skip to content
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

make Amber easyblock aware of FlexiBLAS #2720

Merged
merged 2 commits into from
Aug 25, 2022
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
18 changes: 15 additions & 3 deletions easybuild/easyblocks/a/amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ def configure_step(self):
if self.toolchain.options.get('openmp', None):
self.cfg.update('configopts', '-DOPENMP=TRUE')

# note: for Amber 20, a patch is required to fix the CMake scripts so they're aware of FlexiBLAS:
# - cmake/patched-cmake-modules/FindBLASFixed.cmake
# - cmake/patched-cmake-modules/FindLAPACKFixed.cmake
Comment on lines +144 to +146
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this code is traversed for Amber 19 too, don't we need a version check here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be harmless as is: if you're using a toolchain that includes FlexiBLAS, you'll use -DBLA_VENDOR=FlexiBLAS, which will cause a clear configuration error if the patches are not included (they most likely also work with Amber 19, I didn't check).
The patch is available in fwautele/easybuild-easyconfigs#1, so it should become part of easybuilders/easybuild-easyconfigs#14386 soon (the patch for Amber 20 is exactly the same as for AmberTools 21).

If you're using a toolchain that doesn't include FlexiBLAS but does include OpenBLAS, you'll use -DBLA_VENDOR=OpenBLAS, which is what the CMake script does automatically already (we're just making that explicit now and taking control).

For other toolchains, we don't specify -DBLA_VENDOR and we leave it up to the CMake scripts to figure out which BLAS/LAPACK to use, which is also what happens without these changes.

Long story short: none of the existing easyconfigs should be "hurt" by the changes being made here...

flexiblas_root = get_software_root('FlexiBLAS')
if flexiblas_root:
self.cfg.update('configopts', '-DBLA_VENDOR=FlexiBLAS')
else:
openblas_root = get_software_root('OpenBLAS')
if openblas_root:
self.cfg.update('configopts', '-DBLA_VENDOR=OpenBLAS')

cudaroot = get_software_root('CUDA')
if cudaroot:
self.with_cuda = True
Expand Down Expand Up @@ -213,13 +224,14 @@ def configuremake_install_step(self):

# define environment variables for MPI, BLAS/LAPACK & dependencies
mklroot = get_software_root('imkl')
openblasroot = get_software_root('OpenBLAS')
flexiblas_root = get_software_root('FlexiBLAS')
openblas_root = get_software_root('OpenBLAS')
if mklroot:
env.setvar('MKL_HOME', os.getenv('MKLROOT'))
elif openblasroot:
elif flexiblas_root or openblas_root:
lapack = os.getenv('LIBLAPACK')
if lapack is None:
raise EasyBuildError("LIBLAPACK (from OpenBLAS) not found in environment.")
raise EasyBuildError("$LIBLAPACK for OpenBLAS or FlexiBLAS not defined in build environment!")
else:
env.setvar('GOTO', lapack)

Expand Down