|
12 | 12 | from codepy.jit import compile_from_string
|
13 | 13 | from codepy.toolchain import GCCToolchain
|
14 | 14 |
|
15 |
| -from devito.arch import (AMDGPUX, Cpu64, M1, NVIDIAX, SKX, POWER8, POWER9, |
| 15 | +from devito.arch import (AMDGPUX, NVIDIAX, M1, SKX, POWER8, POWER9, INTELGPUX, |
16 | 16 | get_nvidia_cc, check_cuda_runtime, get_m1_llvm_path)
|
17 | 17 | from devito.exceptions import CompilationError
|
18 | 18 | from devito.logger import debug, warning, error
|
@@ -515,19 +515,55 @@ def __lookup_cmds__(self):
|
515 | 515 | self.MPICXX = 'mpicxx'
|
516 | 516 |
|
517 | 517 |
|
518 |
| -class ICXCompiler(Compiler): |
| 518 | +class OneapiCompiler(Compiler): |
519 | 519 |
|
520 | 520 | def __init__(self, *args, **kwargs):
|
521 | 521 | super().__init__(*args, **kwargs)
|
522 | 522 |
|
523 |
| - self.cflags += ['-Ofast', '-xHost', '-fiopenmp'] |
| 523 | + language = kwargs.pop('language', configuration['language']) |
| 524 | + platform = kwargs.pop('platform', configuration['platform']) |
| 525 | + |
| 526 | + self.cflags.append("-xHost") |
| 527 | + self.cflags.append("-qopt-zmm-usage=high") |
| 528 | + |
| 529 | + if configuration['safe-math']: |
| 530 | + self.cflags.append("-fp-model=strict") |
| 531 | + else: |
| 532 | + self.cflags.append('-fast') |
| 533 | + |
| 534 | + if language == 'sycl': |
| 535 | + self.cflags.append('-fsycl') |
| 536 | + if platform is NVIDIAX: |
| 537 | + self.cflags.append('-fsycl-targets=nvptx64-cuda') |
| 538 | + else: |
| 539 | + self.cflags.append('-fsycl-targets=spir64') |
| 540 | + |
| 541 | + if language == 'openmp': |
| 542 | + self.cflags.append('-qopenmp') |
| 543 | + if platform is NVIDIAX: |
| 544 | + self.cflags.append('-fopenmp-targets=nvptx64-cuda') |
| 545 | + if platform is INTELGPUX: |
| 546 | + self.cflags.append('-fopenmp-targets=spir64') |
| 547 | + self.cflags.append('-fopenmp-target-simd') |
| 548 | + |
| 549 | + if platform is INTELGPUX: |
| 550 | + self.cflags.remove('-g') # -g disables some optimizations in IGC |
| 551 | + self.cflags.append('-gline-tables-only') |
| 552 | + self.cflags.append('-fdebug-info-for-profiling') |
| 553 | + |
| 554 | + # Make sure the MPI compiler uses `icx` underneath -- whatever the MPI distro is |
| 555 | + if kwargs.get('mpi'): |
| 556 | + ver = check_output([self.MPICC, "--version"]).decode("utf-8") |
| 557 | + if not ver.startswith("Intel(R) oneAPI"): |
| 558 | + warning("The MPI compiler `%s` doesn't use the Intel(R) oneAPI " |
| 559 | + "DPC++/C++ compiler underneath" % self.MPICC) |
524 | 560 |
|
525 | 561 | def __lookup_cmds__(self):
|
526 |
| - # OneAPI Base Kit comes with dpcpp/icpx, both are clang++, |
| 562 | + # OneAPI HPC ToolKit comes with icpx, which is clang++, |
527 | 563 | # and icx, which is clang
|
528 | 564 | self.CC = 'icx'
|
529 | 565 | self.CXX = 'icpx'
|
530 |
| - self.MPICC = 'mpic++' |
| 566 | + self.MPICC = 'mpicc' |
531 | 567 | self.MPICXX = 'mpicxx'
|
532 | 568 |
|
533 | 569 |
|
@@ -795,7 +831,8 @@ def __lookup_cmds__(self):
|
795 | 831 | 'intel': IntelCompiler,
|
796 | 832 | 'icpc': IntelCompiler,
|
797 | 833 | 'icc': IntelCompiler,
|
798 |
| - 'icx': ICXCompiler, |
| 834 | + 'icx': OneapiCompiler, |
| 835 | + 'icpx': OneapiCompiler, |
799 | 836 | 'intel-knl': IntelKNLCompiler,
|
800 | 837 | 'knl': IntelKNLCompiler,
|
801 | 838 | 'dpcpp': DPCPPCompiler,
|
|
0 commit comments