manupa-arm commented on a change in pull request #8576:
URL: https://github.com/apache/tvm/pull/8576#discussion_r733012527



##########
File path: tests/scripts/setup-pytest-env.sh
##########
@@ -32,7 +32,35 @@ export PYTHONPATH="${TVM_PATH}/python"
 export TVM_PYTEST_RESULT_DIR="${TVM_PATH}/build/pytest-results"
 mkdir -p "${TVM_PYTEST_RESULT_DIR}"
 
+if [ -n "${CI_CPUSET_NUM_CPUS-}" ]; then
+    # When the # of CPUs has been restricted (e.g. when --cpuset-cpus has been 
passed to docker by
+    # docker/bash.sh), explicitly use all available CPUs. This environment 
variable is set by
+    # docker/bash.sh when it sets --cpuset-cpus.
+    PYTEST_NUM_CPUS="${CI_CPUSET_NUM_CPUS}"
+else
+    # Else attempt to use $(nproc) - 1.
+    PYTEST_NUM_CPUS=$(nproc)
+    if [ -z "${PYTEST_NUM_CPUS}" ]; then
+        echo "WARNING: nproc failed; running pytest with only 1 CPU"
+        PYTEST_NUM_CPUS=1
+    elif [ ${PYTEST_NUM_CPUS} -gt 1 ]; then
+        PYTEST_NUM_CPUS=$(expr ${PYTEST_NUM_CPUS} - 1)  # Don't nuke 
interactive work.
+    fi
+
+    # Don't use >4 CPUs--in general, we only use 4 CPUs in testing, so we want 
to retain this

Review comment:
       Why 4 ?
   
   Also would it be possible for us to specialize run_pytest to for certain 
subset of tests that we think could benefit from this. i.e. --parallel 
<some_number> ?




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