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

fix two bugs in GROMACS easyblock when using GCC & MKL for FFT and BLAS/LAPACK #2212

Merged
merged 3 commits into from
Nov 23, 2020

Conversation

ostueker
Copy link
Contributor

First change eliminates the (wrong) variable $EBROOTMKL from the easyblock as per discussion of @boegel and @mboisson on EasyBuild Slack.

Secondly GROMACS 2020.4' cmake was refusing to use MKL as FFT library (using the gomkl-2020a toolchain), which was fixed by appending -lpthread -lm -ldl to -DMKL_LIBRARIES.

@boegel boegel added this to the 4.3.2 milestone Nov 11, 2020
@boegel boegel added the bug fix label Nov 11, 2020
@boegel boegel changed the title gromacs.py: fix two bugs when using GCC & MKL for FFT and BLAS/LAPACK fix two bugs in GROMACS easyblock when using GCC & MKL for FFT and BLAS/LAPACK Nov 11, 2020
libs = os.getenv('LAPACK_STATIC_LIBS').split(',')
mkl_libs = [os.path.join(os.getenv('LAPACK_LIB_DIR'), lib) for lib in libs if lib != 'libgfortran.a']
mkl_libs = ['-Wl,--start-group'] + mkl_libs + ['-Wl,--end-group']
mkl_libs = ['-Wl,--start-group'] + mkl_libs + ['-Wl,--end-group -lpthread -lm -ldl']
Copy link
Member

Choose a reason for hiding this comment

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

Is it OK to always include -lpthread -lm -ldl here?

Can you clarify which error this fixes exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When trying to compile GROMACS 2020.4 with the gomkl-2020a (GCC + MKL) toolchain (which we found to produce an mdrun that runs a bit faster than the foss-toolchain), cmake wasn't finding the FFT provided by MKL unless I added the -lpthread -lm -ldl flags:

  Linking with MKL was requested, but was not successful: The include path to
  mkl.h in MKL_INCLUDE_DIR, and the link libraries in
  MKL_LIBRARIES=-Wl,--start-group;/cvmfs/soft.computecanada.ca/easybuild/software/2020/Core/imkl/2020.1.217/mkl/lib/intel64/libmkl_gf_lp64.a;/cvmfs/soft.computecanada.ca/easybuild/software/2020/Core/imkl/2020.1.217/mkl/lib/intel64/libmkl_sequential.a;/cvmfs/soft.computecanada.ca/easybuild/software/2020/Core/imkl/2020.1.217/mkl/lib/intel64/libmkl_core.a;-Wl,--end-group
  need to match what the MKL documentation says you need for your system: Use
  full paths to library files, in the right order, and separated by
  semicolons.
Call Stack (most recent call first):
  CMakeLists.txt:716 (include)

I used the MKL advisor to suggest the linker-flags, which is how I came to try adding -lpthread -lm -ldl, which solved the above error.

Copy link
Contributor

@akesandgren akesandgren left a comment

Choose a reason for hiding this comment

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

LGTM

@akesandgren
Copy link
Contributor

Going in, thanks @ostueker!

@akesandgren akesandgren merged commit 3981e7c into easybuilders:develop Nov 23, 2020
@ostueker ostueker deleted the gromacs_fixIMKL branch June 15, 2022 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants