-
Notifications
You must be signed in to change notification settings - Fork 218
add support for NVHPC compiler + toolchain (based on PGI) #3454
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 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| ## | ||
| # Copyright 2015 Bart Oldeman | ||
| # | ||
| # This file is triple-licensed under GPLv2 (see below), MIT, and | ||
| # BSD three-clause licenses. | ||
| # | ||
| # 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), | ||
| # the Hercules foundation (http://www.herculesstichting.be/in_English) | ||
| # 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/>. | ||
| ## | ||
| """ | ||
| Support for NVIDIA HPC SDK ('NVHPC') compilers (nvc, nvc++, nvfortran) as toolchain compilers. NVHPC is the successor of the PGI compilers, on which this file is based upon. | ||
|
|
||
| :author: Bart Oldeman (McGill University, Calcul Quebec, Compute Canada) | ||
| :author: Damian Alvarez (Forschungszentrum Juelich GmbH) | ||
| :author: Andreas Herten (Forschungszentrum Juelich GmbH) | ||
| """ | ||
|
|
||
| import easybuild.tools.systemtools as systemtools | ||
| from easybuild.tools.build_log import EasyBuildError | ||
| from easybuild.tools.toolchain.compiler import Compiler | ||
|
|
||
|
|
||
| TC_CONSTANT_NVHPC = "NVHPC" | ||
|
|
||
|
|
||
| class Nvhpc(Compiler): | ||
| """NVHPC compiler class | ||
| """ | ||
|
|
||
| COMPILER_MODULE_NAME = ['NVHPC'] | ||
|
|
||
| COMPILER_FAMILY = TC_CONSTANT_NVHPC | ||
|
|
||
| # References: | ||
| # https://docs.nvidia.com/hpc-sdk/compilers/hpc-compilers-user-guide/index.html | ||
| # nvc --help | ||
| # And previously, for PGI: | ||
| # http://www.pgroup.com/doc/pgiref.pdf | ||
| # http://www.pgroup.com/products/freepgi/freepgi_ref/ch02.html#Mflushz | ||
| # http://www.pgroup.com/products/freepgi/freepgi_ref/ch02.html#Mfprelaxed | ||
| # http://www.pgroup.com/products/freepgi/freepgi_ref/ch02.html#Mfpapprox | ||
| COMPILER_UNIQUE_OPTION_MAP = { | ||
| 'i8': 'i8', | ||
| 'r8': 'r8', | ||
| 'optarch': '', # PGI by default generates code for the arch it is running on! | ||
| 'openmp': 'mp', | ||
| 'ieee': 'Kieee', | ||
| 'strict': ['Mnoflushz', 'Kieee'], | ||
| 'precise': ['Mnoflushz'], | ||
| 'defaultprec': ['Mflushz'], | ||
| 'loose': ['Mfprelaxed'], | ||
| 'veryloose': ['Mfprelaxed=div,order,intrinsic,recip,sqrt,rsqrt', 'Mfpapprox'], | ||
| 'vectorize': {False: 'Mnovect', True: 'Mvect'}, | ||
| } | ||
|
|
||
| # used when 'optarch' toolchain option is enabled (and --optarch is not specified) | ||
| COMPILER_OPTIMAL_ARCHITECTURE_OPTION = { | ||
| (systemtools.X86_64, systemtools.AMD): 'tp=host', | ||
| (systemtools.X86_64, systemtools.INTEL): 'tp=host', | ||
| } | ||
| # used with --optarch=GENERIC | ||
| COMPILER_GENERIC_OPTION = { | ||
| (systemtools.X86_64, systemtools.AMD): 'tp=px', | ||
| (systemtools.X86_64, systemtools.INTEL): 'tp=px', | ||
| } | ||
|
|
||
| COMPILER_CC = 'nvc' | ||
| # C++ compiler command is version-dependent, see below | ||
AndiH marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| COMPILER_CXX = 'nvc++' | ||
|
|
||
| COMPILER_F77 = 'nvfortran' | ||
| COMPILER_F90 = 'nvfortran' | ||
| COMPILER_FC = 'nvfortran' | ||
|
|
||
| LINKER_TOGGLE_STATIC_DYNAMIC = { | ||
| 'static': '-Bstatic', | ||
| 'dynamic': '-Bdynamic', | ||
| } | ||
|
|
||
| def _set_compiler_flags(self): | ||
| """Set -tp=x64 if optarch is set to False.""" | ||
| if not self.options.get('optarch', False): | ||
| self.variables.nextend('OPTFLAGS', ['tp=x64']) | ||
| super(Nvhpc, self)._set_compiler_flags() | ||
|
|
||
| def _set_compiler_vars(self): | ||
| """Set the compiler variables""" | ||
| super(Nvhpc, self)._set_compiler_vars() | ||
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,46 @@ | ||
| ## | ||
| # Copyright 2015 Bart Oldeman | ||
| # | ||
| # This file is triple-licensed under GPLv2 (see below), MIT, and | ||
| # BSD three-clause licenses. | ||
| # | ||
| # 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), | ||
| # the Hercules foundation (http://www.herculesstichting.be/in_English) | ||
| # 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 NVHPC compiler toolchain. | ||
|
|
||
| :author: Bart Oldeman (McGill University, Calcul Quebec, Compute Canada) | ||
| :author: Andreas Herten (Forschungszentrum Juelich) | ||
| """ | ||
|
|
||
| from easybuild.toolchains.compiler.nvhpc import Nvhpc | ||
| from easybuild.toolchains.gcccore import GCCcore | ||
| from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME | ||
|
|
||
|
|
||
| class NvhpcToolchain(Nvhpc): | ||
AndiH marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """Simple toolchain with just the NVIDIA HPC SDK compilers.""" | ||
| NAME = 'NVHPC' | ||
| # use GCCcore as subtoolchain rather than GCC, since two 'real' compiler-only toolchains don't mix well, | ||
| # in particular in a hierarchical module naming scheme | ||
| SUBTOOLCHAIN = [GCCcore.NAME, SYSTEM_TOOLCHAIN_NAME] | ||
| OPTIONAL = False | ||
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.