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


##########
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:
   I think this is true only on x64 
https://github.com/apache/tvm/blob/6ad7638be249fef0b2ce3f1112dd857e850949f1/src/runtime/threading_backend.cc#L304-L305



-- 
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