diff options
author | AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> | 2021-02-08 15:33:56 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 11:03:56 +0100 |
commit | 9eb5c8f8434f61c66a6f4d57a0acf0fd376fd375 (patch) | |
tree | 0be977871e2d39b0d0a136c175de84af96ab8dae | |
parent | 83f7541420da7bbab796f5c2089a363a35923aa7 (diff) | |
download | spack-9eb5c8f8434f61c66a6f4d57a0acf0fd376fd375.tar.gz spack-9eb5c8f8434f61c66a6f4d57a0acf0fd376fd375.tar.bz2 spack-9eb5c8f8434f61c66a6f4d57a0acf0fd376fd375.tar.xz spack-9eb5c8f8434f61c66a6f4d57a0acf0fd376fd375.zip |
cp2k: added support for AMD toolchain (#21371)
-rw-r--r-- | var/spack/repos/builtin/packages/cp2k/package.py | 67 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/elpa/package.py | 14 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/libxsmm/package.py | 2 |
3 files changed, 55 insertions, 28 deletions
diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 35a930960f..79ec2ad727 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -158,6 +158,7 @@ class Cp2k(MakefilePackage, CudaPackage): conflicts('smm=libxsmm', when='target=aarch64:', msg='libxsmm is not available on arm') conflicts('^fftw~openmp', when='+openmp') + conflicts('^amdfftw~openmp', when='+openmp') conflicts('^openblas threads=none', when='+openmp') conflicts('^openblas threads=pthreads', when='+openmp') @@ -192,11 +193,11 @@ class Cp2k(MakefilePackage, CudaPackage): makefile_basename = '.'.join([ self.makefile_architecture, self.makefile_version ]) - return os.path.join('arch', makefile_basename) + return join_path('arch', makefile_basename) @property def archive_files(self): - return [os.path.join(self.stage.source_path, self.makefile)] + return [join_path(self.stage.source_path, self.makefile)] def edit(self, spec, prefix): pkgconf = which('pkg-config') @@ -204,6 +205,9 @@ class Cp2k(MakefilePackage, CudaPackage): if '^fftw' in spec: fftw = spec['fftw:openmp' if '+openmp' in spec else 'fftw'] fftw_header_dir = fftw.headers.directories[0] + elif '^amdfftw' in spec: + fftw = spec['amdfftw:openmp' if '+openmp' in spec else 'amdfftw'] + fftw_header_dir = fftw.headers.directories[0] elif '^intel-mkl' in spec: fftw = spec['intel-mkl'] fftw_header_dir = fftw.headers.directories[0] + '/fftw' @@ -227,6 +231,7 @@ class Cp2k(MakefilePackage, CudaPackage): 'nvhpc': ['-fast'], 'cray': ['-O2'], 'xl': ['-O3'], + 'aocc': ['-O1'], } dflags = ['-DNDEBUG'] @@ -263,6 +268,10 @@ class Cp2k(MakefilePackage, CudaPackage): '-ffree-line-length-none', '-ggdb', # make sure we get proper Fortran backtraces ] + elif '%aocc' in spec: + fcflags += [ + '-ffree-form', + ] elif '%pgi' in spec or '%nvhpc' in spec: fcflags += ['-Mfreeform', '-Mextend'] elif '%cray' in spec: @@ -297,8 +306,8 @@ class Cp2k(MakefilePackage, CudaPackage): dflags.extend(['-D__PLUMED2']) cppflags.extend(['-D__PLUMED2']) libs.extend([ - os.path.join(self.spec['plumed'].prefix.lib, - 'libplumed.{0}'.format(dso_suffix)) + join_path(self.spec['plumed'].prefix.lib, + 'libplumed.{0}'.format(dso_suffix)) ]) cc = spack_cc if '~mpi' in spec else spec['mpi'].mpicc @@ -351,7 +360,7 @@ class Cp2k(MakefilePackage, CudaPackage): if 'wannier90' in spec: cppflags.append('-D__WANNIER90') - wannier = os.path.join( + wannier = join_path( spec['wannier90'].libs.directories[0], 'libwannier.a' ) libs.append(wannier) @@ -371,9 +380,9 @@ class Cp2k(MakefilePackage, CudaPackage): # runtime due to wrong offsets into the shared library # symbols. libs.extend([ - os.path.join( + join_path( spec['libint'].libs.directories[0], 'libderiv.a'), - os.path.join( + join_path( spec['libint'].libs.directories[0], 'libint.a'), ]) else: @@ -394,18 +403,17 @@ class Cp2k(MakefilePackage, CudaPackage): if '+pexsi' in spec: cppflags.append('-D__LIBPEXSI') - fcflags.append('-I' + os.path.join( + fcflags.append('-I' + join_path( spec['pexsi'].prefix, 'fortran')) libs.extend([ - os.path.join(spec['pexsi'].libs.directories[0], - 'libpexsi.a'), - os.path.join(spec['superlu-dist'].libs.directories[0], - 'libsuperlu_dist.a'), - os.path.join( + join_path(spec['pexsi'].libs.directories[0], 'libpexsi.a'), + join_path(spec['superlu-dist'].libs.directories[0], + 'libsuperlu_dist.a'), + join_path( spec['parmetis'].libs.directories[0], 'libparmetis.{0}'.format(dso_suffix) ), - os.path.join( + join_path( spec['metis'].libs.directories[0], 'libmetis.{0}'.format(dso_suffix) ), @@ -416,11 +424,18 @@ class Cp2k(MakefilePackage, CudaPackage): elpa_suffix = '_openmp' if '+openmp' in elpa else '' elpa_incdir = elpa.headers.directories[0] - fcflags += ['-I{0}'.format(os.path.join(elpa_incdir, 'modules'))] - libs.append(os.path.join(elpa.libs.directories[0], - ('libelpa{elpa_suffix}.{dso_suffix}' - .format(elpa_suffix=elpa_suffix, - dso_suffix=dso_suffix)))) + fcflags += ['-I{0}'.format(join_path(elpa_incdir, 'modules'))] + + # Currently AOCC support only static libraries of ELPA + if '%aocc' in spec: + libs.append(join_path(elpa.prefix.lib, + ('libelpa{elpa_suffix}.a' + .format(elpa_suffix=elpa_suffix)))) + else: + libs.append(join_path(elpa.prefix.lib, + ('libelpa{elpa_suffix}.{dso_suffix}' + .format(elpa_suffix=elpa_suffix, + dso_suffix=dso_suffix)))) if spec.satisfies('@:4.999'): if elpa.satisfies('@:2014.5.999'): @@ -433,7 +448,7 @@ class Cp2k(MakefilePackage, CudaPackage): cppflags.append('-D__ELPA={0}{1:02d}' .format(elpa.version[0], int(elpa.version[1]))) - fcflags += ['-I{0}'.format(os.path.join(elpa_incdir, 'elpa'))] + fcflags += ['-I{0}'.format(join_path(elpa_incdir, 'elpa'))] if spec.satisfies('+sirius'): sirius = spec['sirius'] @@ -469,12 +484,12 @@ class Cp2k(MakefilePackage, CudaPackage): gpuver = 'K20X' if 'smm=libsmm' in spec: - lib_dir = os.path.join( + lib_dir = join_path( 'lib', self.makefile_architecture, self.makefile_version ) mkdirp(lib_dir) try: - copy(env['LIBSMM_PATH'], os.path.join(lib_dir, 'libsmm.a')) + copy(env['LIBSMM_PATH'], join_path(lib_dir, 'libsmm.a')) except KeyError: raise KeyError('Point environment variable LIBSMM_PATH to ' 'the absolute path of the libsmm.a file') @@ -545,7 +560,7 @@ class Cp2k(MakefilePackage, CudaPackage): if spec.satisfies('+cuda'): mkf.write('NVCC = {0}\n'.format( - os.path.join(spec['cuda'].prefix, 'bin', 'nvcc'))) + join_path(spec['cuda'].prefix, 'bin', 'nvcc'))) # Write compiler flags to file def fflags(var, lst): @@ -576,7 +591,7 @@ class Cp2k(MakefilePackage, CudaPackage): if self.spec.satisfies('@:6.9999'): # prior to version 7.1 was the Makefile located in makefiles/ - build_dir = os.path.join(build_dir, 'makefiles') + build_dir = join_path(build_dir, 'makefiles') return build_dir @@ -597,12 +612,12 @@ class Cp2k(MakefilePackage, CudaPackage): super(Cp2k, self).build(spec, prefix) def install(self, spec, prefix): - exe_dir = os.path.join('exe', self.makefile_architecture) + exe_dir = join_path('exe', self.makefile_architecture) install_tree(exe_dir, self.prefix.bin) install_tree('data', self.prefix.share.data) def check(self): - data_dir = os.path.join(self.stage.source_path, 'data') + data_dir = join_path(self.stage.source_path, 'data') # CP2K < 7 still uses $PWD to detect the current working dir # and Makefile is in a subdir, account for both facts here: diff --git a/var/spack/repos/builtin/packages/elpa/package.py b/var/spack/repos/builtin/packages/elpa/package.py index c168163e7c..c05b712900 100644 --- a/var/spack/repos/builtin/packages/elpa/package.py +++ b/var/spack/repos/builtin/packages/elpa/package.py @@ -22,6 +22,7 @@ class Elpa(AutotoolsPackage, CudaPackage): version('2017.11.001', sha256='59f99c3abe2190fac0db8a301d0b9581ee134f438669dbc92551a54f6f861820') version('2017.05.003', sha256='bccd49ce35a323bd734b17642aed8f2588fea4cc78ee8133d88554753bc3bf1b') version('2017.05.002', sha256='568b71024c094d667b5cbb23045ad197ed5434071152ac608dae490ace5eb0aa') + version('2017.05.001', sha256='28f7edad60984d93da299016ad33571dc6db1cdc9fab0ceaef05dc07de2c7dfd') version('2016.11.001.pre', sha256='69b67f0f6faaa2b3b5fd848127b632be32771636d2ad04583c5269d550956f92') version('2016.05.004', sha256='08c59dc9da458bab856f489d779152e5506e04f0d4b8d6dcf114ca5fbbe46c58') version('2016.05.003', sha256='c8da50c987351514e61491e14390cdea4bdbf5b09045261991876ed5b433fca4') @@ -79,6 +80,10 @@ class Elpa(AutotoolsPackage, CudaPackage): if spec.target.family == 'aarch64': options.append('--disable-sse-assembly') + if '%aocc' in spec: + options.append('--disable-shared') + options.append('--enable-static') + # If no features are found, enable the generic ones if not any(f in spec.target for f in simd_features): options.append('--enable-generic') @@ -89,6 +94,12 @@ class Elpa(AutotoolsPackage, CudaPackage): 'CFLAGS=-O2' ]) + if '%aocc' in spec: + options.extend([ + 'FCFLAGS=-O3', + 'CFLAGS=-O3' + ]) + if '+cuda' in spec: prefix = spec['cuda'].prefix options.append('--enable-gpu') @@ -113,7 +124,8 @@ class Elpa(AutotoolsPackage, CudaPackage): 'FC={0}'.format(spec['mpi'].mpifc), 'CXX={0}'.format(spec['mpi'].mpicxx), 'LDFLAGS={0}'.format(spec['lapack'].libs.search_flags), - 'LIBS={0}'.format(spec['lapack'].libs.link_flags), + 'LIBS={0} {1}'.format( + spec['lapack'].libs.link_flags, spec['blas'].libs.link_flags), 'SCALAPACK_LDFLAGS={0}'.format(spec['scalapack'].libs.joined()) ]) diff --git a/var/spack/repos/builtin/packages/libxsmm/package.py b/var/spack/repos/builtin/packages/libxsmm/package.py index 3de1cfb461..8be2af3011 100644 --- a/var/spack/repos/builtin/packages/libxsmm/package.py +++ b/var/spack/repos/builtin/packages/libxsmm/package.py @@ -82,7 +82,7 @@ class Libxsmm(MakefilePackage): ] # JIT (AVX and later) makes MNK, M, N, or K spec. superfluous -# make_args += ['MNK=1 4 5 6 8 9 13 16 17 22 23 24 26 32'] + # make_args += ['MNK=1 4 5 6 8 9 13 16 17 22 23 24 26 32'] # include call trace as the build is already de-optimized if '+debug' in spec: |