From 8c1399ff7c7a45e607495df345a9d1b89d9691f7 Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Thu, 14 Oct 2021 17:33:15 +0530 Subject: LAMMPS: update recipe for %aocc (#26710) * updating the recipe for betterment * addressing the suggesions received from reviewers * adding package helper macros Co-authored-by: mohan002 --- var/spack/repos/builtin/packages/lammps/package.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/lammps/package.py b/var/spack/repos/builtin/packages/lammps/package.py index 619242fba7..52cf57ca91 100644 --- a/var/spack/repos/builtin/packages/lammps/package.py +++ b/var/spack/repos/builtin/packages/lammps/package.py @@ -196,6 +196,10 @@ class Lammps(CMakePackage, CudaPackage): if spec.satisfies('@20180629:+lib'): args.append('-DBUILD_LIB=ON') + if spec.satisfies('%aocc'): + cxx_flags = '-Ofast -mfma -fvectorize -funroll-loops' + args.append(self.define('CMAKE_CXX_FLAGS_RELEASE', cxx_flags)) + args.append(self.define_from_variant('WITH_JPEG', 'jpeg')) args.append(self.define_from_variant('WITH_PNG', 'png')) args.append(self.define_from_variant('WITH_FFMPEG', 'ffmpeg')) @@ -214,11 +218,14 @@ class Lammps(CMakePackage, CudaPackage): if '^mkl' in spec: args.append('-DFFT=MKL') if '^amdfftw' in spec: - fftw_prefix = spec['amdfftw'].prefix - args.append('-DFFTW_HOME={0}'.format(fftw_prefix)) - args.append('-DFFTW_INCLUDE_DIRS={0}' - .format(fftw_prefix.include)) - args.append('-DFFTW_LIBRARY_DIRS={0}'.format(fftw_prefix.lib)) + # If FFTW3 is selected, then CMake will try to detect, if threaded + # FFTW libraries are available and enable them by default. + args.append(self.define('FFT', 'FFTW3')) + # Using the -DFFT_SINGLE setting trades off a little accuracy + # for reduced memory use and parallel communication costs + # for transposing 3d FFT data. + args.append(self.define('FFT_SINGLE', True)) + if '+kokkos' in spec: args.append('-DEXTERNAL_KOKKOS=ON') if '+user-adios' in spec: -- cgit v1.2.3-70-g09d2