Skip to content

Commit 4535367

Browse files
committed
Add test utility function to check for memory requirement
1 parent 7b6e91a commit 4535367

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dpnp/tests/helper.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,3 +540,14 @@ def requires_intel_mkl_version(version): # pragma: no cover
540540

541541
build_deps = numpy.show_config(mode="dicts")["Build Dependencies"]
542542
return build_deps["blas"]["version"] >= version
543+
544+
545+
def requires_memory(no_of_gbs, device=None):
546+
"""
547+
Check if the required number of GBs in memory of a device (the default one
548+
if not provided) is available.
549+
550+
"""
551+
552+
free_mem = get_dev_info(device).get("free_memory", 0)
553+
return free_mem > no_of_gbs * (1024**3)

0 commit comments

Comments
 (0)