masahi commented on code in PR #10896:
URL: https://github.com/apache/tvm/pull/10896#discussion_r842141244


##########
tests/python/unittest/test_runtime_module_based_interface.py:
##########
@@ -674,6 +675,19 @@ def make_module(mod):
     module_main.get_function("func_b", query_imports=True)
 
 
+def test_num_threads():
+    reported = tvm.runtime.num_threads()
+    env_threads = os.getenv("TVM_NUM_THREADS")
+    omp_env_threads = os.getenv("OMP_NUM_THREADS")
+    if env_threads is not None:
+        assert reported == env_threads
+    elif omp_env_threads is not None:
+        assert reported == omp_env_threads
+    else:
+        hardware_threads = os.cpu_count() / 2
+        assert reported == hardware_threads

Review Comment:
   yeah as long as it doesn't fail on CI I think it's ok.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to