From 06ca7f4f3e98217998a183959b4ccd7d61227ab8 Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Date: Fri, 16 Apr 2021 16:34:48 +0200
Subject: numactl: enable building with pgi@20: (#23026)

---
 var/spack/repos/builtin/packages/numactl/package.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/var/spack/repos/builtin/packages/numactl/package.py b/var/spack/repos/builtin/packages/numactl/package.py
index f6c82f5522..05f5bf4bd1 100644
--- a/var/spack/repos/builtin/packages/numactl/package.py
+++ b/var/spack/repos/builtin/packages/numactl/package.py
@@ -32,14 +32,21 @@ class Numactl(AutotoolsPackage):
         bash = which('bash')
         bash('./autogen.sh')
 
+    @when('%nvhpc')
     def patch(self):
+        self._nvhpc_patch()
+
+    @when('%pgi@20:')
+    def patch(self):
+        self._nvhpc_patch()
+
+    def _nvhpc_patch(self):
         # Remove flags not recognized by the NVIDIA compiler
-        if self.spec.satisfies('%nvhpc'):
-            filter_file('-ffast-math -funroll-loops', '', 'Makefile.am')
-            filter_file('-std=gnu99', '-c99', 'Makefile.am')
+        filter_file('-ffast-math -funroll-loops', '', 'Makefile.am')
+        filter_file('-std=gnu99', '-c99', 'Makefile.am')
 
         # Avoid undefined reference errors
-        if self.spec.satisfies('@2.0.14 %nvhpc'):
+        if self.spec.satisfies('@2.0.14'):
             filter_file('numa_sched_setaffinity_v1_int',
                         'numa_sched_setaffinity_v1', 'libnuma.c')
             filter_file('numa_sched_setaffinity_v2_int',
-- 
cgit v1.2.3-70-g09d2