From e046dc3ca423c7c58c34881a5adf1fb69122ff75 Mon Sep 17 00:00:00 2001 From: Stephen Sachs Date: Thu, 30 Jun 2022 15:25:41 +0200 Subject: [PATCH] lammps: compiler flags for Intel compiler on AMD zen+ procs (#31183) Co-authored-by: Stephen Sachs --- var/spack/repos/builtin/packages/lammps/package.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/var/spack/repos/builtin/packages/lammps/package.py b/var/spack/repos/builtin/packages/lammps/package.py index 801bd2e60f..02d090dc4b 100644 --- a/var/spack/repos/builtin/packages/lammps/package.py +++ b/var/spack/repos/builtin/packages/lammps/package.py @@ -4,6 +4,8 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import datetime as dt +import archspec + from spack.package import * @@ -530,6 +532,13 @@ def cmake_args(self): cxx_flags = '-Ofast -mfma -fvectorize -funroll-loops' args.append(self.define('CMAKE_CXX_FLAGS_RELEASE', cxx_flags)) + # Overwrite generic cpu tune option + cmake_tune_flags = archspec.cpu.TARGETS[spec.target.name].optimization_flags( + spec.compiler.name, + spec.compiler.version + ) + args.append(self.define('CMAKE_TUNE_FLAGS', cmake_tune_flags)) + lammps_sizes = self.spec.variants['lammps_sizes'].value args.append(self.define('LAMMPS_SIZES', lammps_sizes))