Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions devito/arch/archinfo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Collection of utilities to detect properties of the underlying architecture."""

from functools import cached_property
from functools import cache, cached_property
from subprocess import PIPE, Popen, DEVNULL, run
from pathlib import Path
import ctypes
Expand All @@ -14,7 +14,7 @@
import psutil

from devito.logger import warning
from devito.tools import as_tuple, all_equal, memoized_func
from devito.tools import as_tuple, all_equal

__all__ = ['platform_registry', 'get_cpu_info', 'get_gpu_info', 'get_nvidia_cc',
'get_cuda_path', 'get_hip_path', 'check_cuda_runtime', 'get_m1_llvm_path',
Expand All @@ -41,7 +41,7 @@
'PVC', 'INTELGPUMAX', 'MAX1100', 'MAX1550']


@memoized_func
@cache
def get_cpu_info():
"""Attempt CPU info autodetection."""

Expand Down Expand Up @@ -163,7 +163,7 @@ def get_cpu_brand():
return cpu_info


@memoized_func
@cache
def get_gpu_info():
"""Attempt GPU info autodetection."""

Expand Down Expand Up @@ -488,7 +488,7 @@ def parse_product_arch():
return None


@memoized_func
@cache
def get_nvidia_cc():
libnames = ('libcuda.so', 'libcuda.dylib', 'cuda.dll')
for libname in libnames:
Expand All @@ -511,7 +511,7 @@ def get_nvidia_cc():
return 10*cc_major.value + cc_minor.value


@memoized_func
@cache
def get_cuda_path():
# *** First try: via commonly used environment variables
for i in ['CUDA_HOME', 'CUDA_ROOT']:
Expand All @@ -531,7 +531,7 @@ def get_cuda_path():
return None


@memoized_func
@cache
def get_advisor_path():
"""
Detect if Intel Advisor is installed on the machine and return
Expand All @@ -552,7 +552,7 @@ def get_advisor_path():
return path


@memoized_func
@cache
def get_hip_path():
# *** First try: via commonly used environment variables
for i in ['HIP_HOME']:
Expand All @@ -563,7 +563,7 @@ def get_hip_path():
return None


@memoized_func
@cache
def get_m1_llvm_path(language):
# Check if Apple's llvm is installed (installable via Homebrew), which supports
# OpenMP.
Expand Down Expand Up @@ -595,7 +595,7 @@ def get_m1_llvm_path(language):
return None


@memoized_func
@cache
def check_cuda_runtime():
libnames = ('libcudart.so', 'libcudart.dylib', 'cudart.dll')
for libname in libnames:
Expand Down Expand Up @@ -623,7 +623,7 @@ def check_cuda_runtime():
warning("Unable to check compatibility of NVidia driver and runtime")


@memoized_func
@cache
def lscpu():
try:
p1 = Popen(['lscpu'], stdout=PIPE, stderr=PIPE)
Expand All @@ -645,7 +645,7 @@ def lscpu():
return {}


@memoized_func
@cache
def get_platform():
"""Attempt Platform autodetection."""

Expand Down Expand Up @@ -1111,7 +1111,7 @@ def march(cls):
return fallback


@memoized_func
@cache
def node_max_mem_trans_nbytes(platform):
"""
Return the maximum memory transaction size in bytes for the underlying
Expand Down
13 changes: 6 additions & 7 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from functools import partial
from functools import cache, partial
from hashlib import sha1
from os import environ, path, makedirs
from packaging.version import Version
Expand All @@ -19,13 +19,12 @@
from devito.exceptions import CompilationError
from devito.logger import debug, warning
from devito.parameters import configuration
from devito.tools import (as_list, change_directory, filter_ordered,
memoized_func, make_tempdir)
from devito.tools import as_list, change_directory, filter_ordered, make_tempdir

__all__ = ['sniff_mpi_distro', 'compiler_registry']


@memoized_func
@cache
def sniff_compiler_version(cc, allow_fail=False):
"""
Detect the compiler version.
Expand Down Expand Up @@ -99,7 +98,7 @@ def sniff_compiler_version(cc, allow_fail=False):
return ver


@memoized_func
@cache
def sniff_mpi_distro(mpiexec):
"""
Detect the MPI version.
Expand All @@ -117,7 +116,7 @@ def sniff_mpi_distro(mpiexec):
return 'unknown'


@memoized_func
@cache
def sniff_mpi_flags(mpicc='mpicc'):
mpi_distro = sniff_mpi_distro('mpiexec')
if mpi_distro != 'OpenMPI':
Expand All @@ -131,7 +130,7 @@ def sniff_mpi_flags(mpicc='mpicc'):
return compile_flags.split(), link_flags.split()


@memoized_func
@cache
def call_capture_output(cmd):
"""
Memoize calls to codepy's `call_capture_output` to avoid leaking memory due
Expand Down
Loading
Loading