11"""Collection of utilities to detect properties of the underlying architecture."""
22
3- from functools import cached_property
3+ from functools import cache , cached_property
44from subprocess import PIPE , Popen , DEVNULL , run
55from pathlib import Path
66import ctypes
1414import psutil
1515
1616from devito .logger import warning
17- from devito .tools import as_tuple , all_equal , memoized_func
17+ from devito .tools import as_tuple , all_equal
1818
1919__all__ = ['platform_registry' , 'get_cpu_info' , 'get_gpu_info' , 'get_nvidia_cc' ,
2020 'get_cuda_path' , 'get_hip_path' , 'check_cuda_runtime' , 'get_m1_llvm_path' ,
4141 'PVC' , 'INTELGPUMAX' , 'MAX1100' , 'MAX1550' ]
4242
4343
44- @memoized_func
44+ @cache
4545def get_cpu_info ():
4646 """Attempt CPU info autodetection."""
4747
@@ -163,7 +163,7 @@ def get_cpu_brand():
163163 return cpu_info
164164
165165
166- @memoized_func
166+ @cache
167167def get_gpu_info ():
168168 """Attempt GPU info autodetection."""
169169
@@ -488,7 +488,7 @@ def parse_product_arch():
488488 return None
489489
490490
491- @memoized_func
491+ @cache
492492def get_nvidia_cc ():
493493 libnames = ('libcuda.so' , 'libcuda.dylib' , 'cuda.dll' )
494494 for libname in libnames :
@@ -511,7 +511,7 @@ def get_nvidia_cc():
511511 return 10 * cc_major .value + cc_minor .value
512512
513513
514- @memoized_func
514+ @cache
515515def get_cuda_path ():
516516 # *** First try: via commonly used environment variables
517517 for i in ['CUDA_HOME' , 'CUDA_ROOT' ]:
@@ -531,7 +531,7 @@ def get_cuda_path():
531531 return None
532532
533533
534- @memoized_func
534+ @cache
535535def get_advisor_path ():
536536 """
537537 Detect if Intel Advisor is installed on the machine and return
@@ -552,7 +552,7 @@ def get_advisor_path():
552552 return path
553553
554554
555- @memoized_func
555+ @cache
556556def get_hip_path ():
557557 # *** First try: via commonly used environment variables
558558 for i in ['HIP_HOME' ]:
@@ -563,7 +563,7 @@ def get_hip_path():
563563 return None
564564
565565
566- @memoized_func
566+ @cache
567567def get_m1_llvm_path (language ):
568568 # Check if Apple's llvm is installed (installable via Homebrew), which supports
569569 # OpenMP.
@@ -595,7 +595,7 @@ def get_m1_llvm_path(language):
595595 return None
596596
597597
598- @memoized_func
598+ @cache
599599def check_cuda_runtime ():
600600 libnames = ('libcudart.so' , 'libcudart.dylib' , 'cudart.dll' )
601601 for libname in libnames :
@@ -623,7 +623,7 @@ def check_cuda_runtime():
623623 warning ("Unable to check compatibility of NVidia driver and runtime" )
624624
625625
626- @memoized_func
626+ @cache
627627def lscpu ():
628628 try :
629629 p1 = Popen (['lscpu' ], stdout = PIPE , stderr = PIPE )
@@ -645,7 +645,7 @@ def lscpu():
645645 return {}
646646
647647
648- @memoized_func
648+ @cache
649649def get_platform ():
650650 """Attempt Platform autodetection."""
651651
@@ -1111,7 +1111,7 @@ def march(cls):
11111111 return fallback
11121112
11131113
1114- @memoized_func
1114+ @cache
11151115def node_max_mem_trans_nbytes (platform ):
11161116 """
11171117 Return the maximum memory transaction size in bytes for the underlying
0 commit comments