Skip to content

Commit

Permalink
Set archspec compiler flags for NVHPC (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
samcmill authored Aug 2, 2024
1 parent 2a91503 commit 44fc88c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions hpccm/building_blocks/nvhpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def __init__(self, **kwargs):

self.toolchain = toolchain(CC='nvc', CXX='nvc++', F77='nvfortran',
F90='nvfortran', FC='nvfortran')
self.toolchain.CFLAGS = hpccm.config.get_cpu_optimization_flags('nvhpc', version=self.__version)
self.toolchain.CXXFLAGS = hpccm.config.get_cpu_optimization_flags('nvhpc', version=self.__version)
self.toolchain.FFLAGS = hpccm.config.get_cpu_optimization_flags('nvhpc', version=self.__version)
self.toolchain.FCFLAGS = hpccm.config.get_cpu_optimization_flags('nvhpc', version=self.__version)

if Version(self.__version) >= Version('24.7'):
self.__cuda_version_default = '12.5'
Expand Down
12 changes: 11 additions & 1 deletion test/test_nvhpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging # pylint: disable=unused-import
import unittest

from helpers import aarch64, centos, docker, ppc64le, ubuntu, x86_64
from helpers import aarch64, centos, docker, ppc64le, ubuntu, x86_64, zen2

from hpccm.building_blocks.nvhpc import nvhpc
from hpccm.toolchain import toolchain
Expand Down Expand Up @@ -282,3 +282,13 @@ def test_toolchain(self):
self.assertEqual(tc.FC, 'nvfortran')
self.assertEqual(tc.F77, 'nvfortran')
self.assertEqual(tc.F90, 'nvfortran')

@zen2
def test_toolchain_zen2(self):
"""CPU arch optimization flags"""
n = nvhpc()
tc = n.toolchain
self.assertEqual(tc.CFLAGS, '-tp zen2')
self.assertEqual(tc.CXXFLAGS, '-tp zen2')
self.assertEqual(tc.FFLAGS, '-tp zen2')
self.assertEqual(tc.FCFLAGS, '-tp zen2')
3 changes: 2 additions & 1 deletion test/test_openmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging # pylint: disable=unused-import
import unittest

from helpers import centos, docker, ubuntu
from helpers import centos, cpu_target_none, docker, ubuntu

from hpccm.building_blocks.nvhpc import nvhpc
from hpccm.building_blocks.openmpi import openmpi
Expand Down Expand Up @@ -117,6 +117,7 @@ def test_ldconfig(self):

@ubuntu
@docker
@cpu_target_none
def test_nvhpc(self):
"""HPC SDK toolchain"""
compiler = nvhpc(eula=True)
Expand Down

0 comments on commit 44fc88c

Please sign in to comment.