-
Notifications
You must be signed in to change notification settings - Fork 310
add custom easyblock to support installation of new Intel compilers (v2021.x, oneAPI) #2305
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
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
583e2c5
make sure component name/version is set correctly before reporting un…
boegel 4acfdaf
add custom easyblock to support installation of new Intel compilers (…
boegel 14e631e
make sure sufficiently recent version is used in tests for custom int…
boegel 94e5d5f
specify URL to Intel's EULA + use 'Intel-oneAPI' as name when checkin…
boegel f916465
Only redefine HOME when it is required
ae01146
Merge pull request #37 from ocaisa/oneapi_compilers
boegel 3b3e3b8
use version-specific compiler subdirectory rather than 'latest', to m…
boegel a87296c
add support for installing list of sources to allow installing patch …
boegel 132e164
make sanity check commands for Intel oneAPI compilers stricter by che…
boegel a718baf
no need to specify components for installing (only) Intel oneAPI comp…
boegel 0481c97
fix docstring for install step in custom easyblock for oneAPI Intel c…
boegel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| # # | ||
| # Copyright 2021-2021 Ghent University | ||
| # | ||
| # This file is part of EasyBuild, | ||
| # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
| # with support of Ghent University (http://ugent.be/hpc), | ||
| # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
| # Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
| # and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
| # | ||
| # https://github.com/easybuilders/easybuild | ||
| # | ||
| # EasyBuild is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation v2. | ||
| # | ||
| # EasyBuild is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
| # # | ||
| """ | ||
| EasyBuild support for installing Intel compilers, implemented as an easyblock | ||
|
|
||
| @author: Kenneth Hoste (Ghent University) | ||
| """ | ||
| import os | ||
| from distutils.version import LooseVersion | ||
|
|
||
| from easybuild.easyblocks.generic.intelbase import IntelBase | ||
| from easybuild.tools.build_log import EasyBuildError, print_msg | ||
|
|
||
|
|
||
| class EB_intel_minus_compilers(IntelBase): | ||
| """ | ||
| Support for installing Intel compilers, starting with verion 2021.x (oneAPI) | ||
| """ | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| """ | ||
| Easyblock constructor: check version | ||
| """ | ||
| super(EB_intel_minus_compilers, self).__init__(*args, **kwargs) | ||
|
|
||
| # this easyblock is only valid for recent versions of the Intel compilers (2021.x, oneAPI) | ||
| if LooseVersion(self.version) < LooseVersion('2021'): | ||
| raise EasyBuildError("Invalid version %s, should be >= 2021.x" % self.version) | ||
|
|
||
| self.compilers_subdir = os.path.join('compiler', self.version, 'linux') | ||
|
|
||
| def prepare_step(self, *args, **kwargs): | ||
| """ | ||
| Prepare environment for installing. | ||
|
|
||
| Specify that oneAPI versions of Intel compilers don't require a runtime license. | ||
| """ | ||
| # avoid that IntelBase trips over not having license info specified | ||
| kwargs['requires_runtime_license'] = False | ||
|
|
||
| super(EB_intel_minus_compilers, self).prepare_step(*args, **kwargs) | ||
|
|
||
| def configure_step(self): | ||
| """Configure installation.""" | ||
|
|
||
| # redefine $HOME for install step, to avoid that anything is stored in $HOME/intel | ||
| # (like the 'installercache' database) | ||
| self.cfg['preinstallopts'] += " HOME=%s " % self.builddir | ||
|
|
||
| def install_step(self): | ||
| """ | ||
| Install step: install each 'source file' one by one. | ||
| To install a patch release of Intel oneAPI compilers, we need to install the HPC Toolkit first, | ||
| and then separate updates for the C++ and Fortran compilers... | ||
| """ | ||
| srcs = self.src[:] | ||
| cnt = len(srcs) | ||
| for idx, src in enumerate(srcs): | ||
| print_msg("installing part %d/%s (%s)..." % (idx + 1, cnt, src['name'])) | ||
| self.src = [src] | ||
| super(EB_intel_minus_compilers, self).install_step() | ||
|
|
||
| def sanity_check_step(self): | ||
| """ | ||
| Custom sanity check for Intel compilers. | ||
| """ | ||
|
|
||
| classic_compiler_cmds = ['icc', 'icpc', 'ifort'] | ||
| oneapi_compiler_cmds = [ | ||
| 'dpcpp', # Intel oneAPI Data Parallel C++ compiler | ||
| 'icx', # oneAPI Intel C compiler | ||
| 'icpx', # oneAPI Intel C++ compiler | ||
| 'ifx', # oneAPI Intel Fortran compiler | ||
| ] | ||
| bindir = os.path.join(self.compilers_subdir, 'bin') | ||
| classic_compiler_paths = [os.path.join(bindir, x) for x in oneapi_compiler_cmds] | ||
| oneapi_compiler_paths = [os.path.join(bindir, 'intel64', x) for x in classic_compiler_cmds] | ||
|
|
||
| custom_paths = { | ||
| 'files': classic_compiler_paths + oneapi_compiler_paths, | ||
| 'dirs': [self.compilers_subdir], | ||
| } | ||
|
|
||
| all_compiler_cmds = classic_compiler_cmds + oneapi_compiler_cmds | ||
| custom_commands = ["which %s" % c for c in all_compiler_cmds] | ||
| custom_commands.extend("%s --version | grep %s" % (c, self.version) for c in all_compiler_cmds) | ||
|
|
||
| super(EB_intel_minus_compilers, self).sanity_check_step(custom_paths=custom_paths, | ||
| custom_commands=custom_commands) | ||
|
|
||
| def make_module_req_guess(self): | ||
| """ | ||
| Paths to consider for prepend-paths statements in module file | ||
| """ | ||
| libdirs = [ | ||
| 'lib', | ||
| os.path.join('lib', 'x64'), | ||
| os.path.join('compiler', 'lib', 'intel64_lin'), | ||
| ] | ||
| libdirs = [os.path.join(self.compilers_subdir, x) for x in libdirs] | ||
| guesses = { | ||
| 'PATH': [ | ||
| os.path.join(self.compilers_subdir, 'bin'), | ||
| os.path.join(self.compilers_subdir, 'bin', 'intel64'), | ||
| ], | ||
| 'LD_LIBRARY_PATH': libdirs, | ||
| 'LIBRARY_PATH': libdirs, | ||
| } | ||
| return guesses | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.