@@ -26,8 +26,10 @@ FREE_THREADING=""
2626if python -c ' import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
2727 FREE_THREADING+=" -ft"
2828 PYTEST_ARGS+=(" --require-gil-disabled" " --threads" " ${FREE_THREADING_TEST_THREADS} " " --iterations" " ${FREE_THREADING_TEST_ITERATIONS} " )
29+ PYTHON_GIL=0
2930else
3031 PYTEST_ARGS+=(" -p" " no:freethreaded" )
32+ PYTHON_GIL=1
3133fi
3234
3335
@@ -46,7 +48,7 @@ if [[ "${test_module}" == "pathfinder" ]]; then
4648 " LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \
4749 " FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS} "
4850 pwd
49- pytest " ${PYTEST_ARGS[@]} " -ra -s -v tests/ | & tee /tmp/pathfinder_test_log.txt
51+ PYTHON_GIL= " $PYTHON_GIL " pytest " ${PYTEST_ARGS[@]} " -ra -s -v tests/ | & tee /tmp/pathfinder_test_log.txt
5052 # Fail if no "INFO test_" lines are found; capture line count otherwise
5153 line_count=$( grep ' ^INFO test_' /tmp/pathfinder_test_log.txt | wc -l)
5254 echo " Number of \" INFO test_\" lines: $line_count "
@@ -66,9 +68,9 @@ elif [[ "${test_module}" == "bindings" ]]; then
6668 pushd ./cuda_bindings
6769 echo " Running bindinds tests"
6870 pwd
69- ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/
71+ PYTHON_GIL= " $PYTHON_GIL " ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/
7072 if [[ " ${SKIP_CYTHON_TEST} " == 0 ]]; then
71- ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/cython
73+ PYTHON_GIL= " $PYTHON_GIL " ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/cython
7274 fi
7375 popd
7476elif [[ " ${test_module} " == " core" ]]; then
@@ -103,11 +105,11 @@ elif [[ "${test_module}" == "core" ]]; then
103105 pushd ./cuda_core
104106 echo " Running core tests"
105107 pwd
106- ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/
108+ PYTHON_GIL= " $PYTHON_GIL " ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/
107109 # Currently our CI always installs the latest bindings (from either major version).
108110 # This is not compatible with the test requirements.
109111 if [[ " ${SKIP_CYTHON_TEST} " == 0 ]]; then
110- ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/cython
112+ PYTHON_GIL= " $PYTHON_GIL " ${SANITIZER_CMD} pytest " ${PYTEST_ARGS[@]} " -rxXs -v tests/cython
111113 fi
112114 popd
113115fi
0 commit comments