MCPcopy Create free account
hub / github.com/NVIDIA/DALI / restrict_platform

Function restrict_platform

dali/test/python/test_utils.py:916–939  ·  view source on GitHub ↗
(min_compute_cap=None, platforms=None)

Source from the content-addressed store, hash-verified

914
915
916def restrict_platform(min_compute_cap=None, platforms=None):
917 spec = []
918 if min_compute_cap is not None:
919 compute_cap = get_arch()
920 cond = f"compute cap ({compute_cap}) >= {min_compute_cap}"
921 spec.append((cond, compute_cap >= min_compute_cap))
922 if platforms is not None:
923 import platform
924
925 cond = f"platform.machine() ({platform.machine()}) in {platforms}"
926 spec.append((cond, platform.machine() in platforms))
927
928 def decorator(fun):
929 if all(val for _, val in spec):
930 return fun
931 else:
932
933 @functools.wraps(fun)
934 def dummy_case(*args, **kwargs):
935 print(f"Omitting test case in unsupported env: `{spec}`")
936
937 return dummy_case
938
939 return decorator
940
941
942def check_numba_compatibility_cpu(if_skip=True):

Callers

nothing calls this directly

Calls 2

get_archFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected