From f29a7e5293e35d19cf4baba500d4258eec7ac58b Mon Sep 17 00:00:00 2001 From: u83311 Date: Mon, 7 Feb 2022 11:48:49 -0800 Subject: [PATCH 1/6] compiler: Adding DPCPP compiler --- devito/arch/compiler.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index 6f7e241cef..5df92a57fa 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -455,6 +455,18 @@ def __lookup_cmds__(self): self.MPICC = 'mpicc' self.MPICXX = 'mpicxx' +class DPCPPCompiler(Compiler): + + def __init__(self, *args, **kwargs): + super().__init__(*args, cpp=False, **kwargs) + + self.cflags += ['-qopenmp', '-fopenmp-targets=spir64'] + + def __lookup_cmds__(self): + self.CC = 'icx' + self.CXX = 'icpx' + self.MPICC = 'mpic++' + self.MPICXX = 'mpicxx' class PGICompiler(Compiler): @@ -634,6 +646,7 @@ def __lookup_cmds__(self): 'icc': IntelCompiler, 'intel-knl': IntelKNLCompiler, 'knl': IntelKNLCompiler, + 'dpcpp': DPCPPCompiler, } """ Registry dict for deriving Compiler classes according to the environment variable From 967daec42a6cb5884cefef638c5e4709b8dd6aef Mon Sep 17 00:00:00 2001 From: u83311 Date: Tue, 8 Feb 2022 01:05:02 -0800 Subject: [PATCH 2/6] arch: IntelDevice and intelgpuX platform --- devito/arch/archinfo.py | 13 ++++++++++--- devito/passes/iet/languages/openmp.py | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index 0dafb17bfb..0e66dc6a9f 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -14,11 +14,11 @@ __all__ = ['platform_registry', 'get_cpu_info', 'get_gpu_info', 'get_nvidia_cc', 'Platform', 'Cpu64', 'Intel64', 'Amd', 'Arm', 'Power', 'Device', - 'NvidiaDevice', 'AmdDevice', + 'NvidiaDevice', 'AmdDevice','IntelDevice', 'INTEL64', 'SNB', 'IVB', 'HSW', 'BDW', 'SKX', 'KNL', 'KNL7210', # Intel 'AMD', 'ARM', 'M1', # ARM 'POWER8', 'POWER9', # Other loosely supported CPU architectures - 'AMDGPUX', 'NVIDIAX'] # GPUs + 'AMDGPUX', 'NVIDIAX', 'INTELGPUX'] # GPUs @memoized_func @@ -571,6 +571,11 @@ def memavail(self, deviceid=0): except (AttributeError, KeyError): return None +class IntelDevice(Device): + + @cached_property + def march(self): + return '' class NvidiaDevice(Device): @@ -637,6 +642,7 @@ def march(cls): # Devices NVIDIAX = NvidiaDevice('nvidiaX') AMDGPUX = AmdDevice('amdgpuX') +INTELGPUX = IntelDevice('intelgpuX') platform_registry = { @@ -657,7 +663,8 @@ def march(cls): 'power8': POWER8, 'power9': POWER9, 'nvidiaX': NVIDIAX, # Generic NVidia GPU - 'amdgpuX': AMDGPUX # Generic AMD GPU + 'amdgpuX': AMDGPUX, # Generic AMD GPU + 'intelgpuX': INTELGPUX #Generic Intel GPU } """ Registry dict for deriving Platform classes according to the environment variable diff --git a/devito/passes/iet/languages/openmp.py b/devito/passes/iet/languages/openmp.py index 824797dad7..c0ffdc9655 100644 --- a/devito/passes/iet/languages/openmp.py +++ b/devito/passes/iet/languages/openmp.py @@ -1,7 +1,7 @@ import cgen as c from sympy import Not -from devito.arch import AMDGPUX, NVIDIAX +from devito.arch import AMDGPUX, NVIDIAX, INTELGPUX from devito.ir import (Call, Conditional, List, Prodder, ParallelIteration, ParallelBlock, PointerCast, While, FindSymbols) from devito.passes.iet.definitions import DataManager, DeviceAwareDataManager @@ -121,6 +121,7 @@ class OmpBB(PragmaLangBB): # Platform mapping AMDGPUX: None, NVIDIAX: None, + INTELGPUX: None, # Runtime library 'init': None, 'thread-num': DefFunction('omp_get_thread_num'), From 2a708cf5373ce40470716953af204b5493eacccb Mon Sep 17 00:00:00 2001 From: u83311 Date: Thu, 10 Feb 2022 00:54:45 -0800 Subject: [PATCH 3/6] arch: Extra newlines --- devito/arch/archinfo.py | 2 ++ devito/arch/compiler.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index 0e66dc6a9f..16cf26045a 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -571,12 +571,14 @@ def memavail(self, deviceid=0): except (AttributeError, KeyError): return None + class IntelDevice(Device): @cached_property def march(self): return '' + class NvidiaDevice(Device): @cached_property diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index 5df92a57fa..32e42e1b27 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -455,6 +455,7 @@ def __lookup_cmds__(self): self.MPICC = 'mpicc' self.MPICXX = 'mpicxx' + class DPCPPCompiler(Compiler): def __init__(self, *args, **kwargs): @@ -468,6 +469,7 @@ def __lookup_cmds__(self): self.MPICC = 'mpic++' self.MPICXX = 'mpicxx' + class PGICompiler(Compiler): def __init__(self, *args, **kwargs): From 523f60e5a39563b841a30811f63dabb35852e48f Mon Sep 17 00:00:00 2001 From: Istvan Reguly Date: Thu, 10 Feb 2022 16:12:29 +0100 Subject: [PATCH 4/6] arch: missing whitespace from archinfo --- devito/arch/archinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index 16cf26045a..dbefe0fba8 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -666,7 +666,7 @@ def march(cls): 'power9': POWER9, 'nvidiaX': NVIDIAX, # Generic NVidia GPU 'amdgpuX': AMDGPUX, # Generic AMD GPU - 'intelgpuX': INTELGPUX #Generic Intel GPU + 'intelgpuX': INTELGPUX # Generic Intel GPU } """ Registry dict for deriving Platform classes according to the environment variable From f8afece224f2380b36a44befd5eff3db7f725cea Mon Sep 17 00:00:00 2001 From: Istvan Reguly Date: Fri, 11 Feb 2022 15:27:26 +0100 Subject: [PATCH 5/6] arch: missing whitespace --- devito/arch/archinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index dbefe0fba8..678ea4b625 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -14,7 +14,7 @@ __all__ = ['platform_registry', 'get_cpu_info', 'get_gpu_info', 'get_nvidia_cc', 'Platform', 'Cpu64', 'Intel64', 'Amd', 'Arm', 'Power', 'Device', - 'NvidiaDevice', 'AmdDevice','IntelDevice', + 'NvidiaDevice', 'AmdDevice', 'IntelDevice', 'INTEL64', 'SNB', 'IVB', 'HSW', 'BDW', 'SKX', 'KNL', 'KNL7210', # Intel 'AMD', 'ARM', 'M1', # ARM 'POWER8', 'POWER9', # Other loosely supported CPU architectures From b65f0f0bb6a74ac28883fc3c3b4a495580be223f Mon Sep 17 00:00:00 2001 From: u83311 Date: Mon, 14 Feb 2022 12:29:07 -0800 Subject: [PATCH 6/6] compiler: comments on dpcpp compiler, no need for cpp=False --- devito/arch/compiler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index 32e42e1b27..aec2aaf9f4 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -459,11 +459,13 @@ def __lookup_cmds__(self): class DPCPPCompiler(Compiler): def __init__(self, *args, **kwargs): - super().__init__(*args, cpp=False, **kwargs) + super().__init__(*args, **kwargs) self.cflags += ['-qopenmp', '-fopenmp-targets=spir64'] def __lookup_cmds__(self): + # OneAPI Base Kit comes with dpcpp/icpx, both are clang++, + # and icx, which is clang self.CC = 'icx' self.CXX = 'icpx' self.MPICC = 'mpic++'