|
47 | 47 | # TF_BUILD_BAZEL_CLEAN, if set to any non-empty and non-0 value, directs the
|
48 | 48 | # script to perform bazel clean prior to main build and test steps.
|
49 | 49 | #
|
50 |
| -# TF_BUILD_SERIAL_INSTALL_TESTS, if set to any non-empty and non-0 value, |
51 |
| -# will force the Python install tests to run serially, overriding than the |
52 |
| -# concurrent testing behavior. |
| 50 | +# TF_BUILD_USE_GPU, if set to 1, limits the number of concurrent tests to |
| 51 | +# the number stored in TF_GPU_COUNT and assigns each test to a different GPU. |
53 | 52 | #
|
54 | 53 | # TF_GPU_COUNT, Set the number of GPUs in the system. We run only this many
|
55 | 54 | # concurrent tests when running GPU tests.
|
@@ -411,21 +410,21 @@ SKIP_COUNTER=0
|
411 | 410 | FAILED_TESTS=""
|
412 | 411 | FAILED_TEST_LOGS=""
|
413 | 412 |
|
414 |
| -N_JOBS=$(grep -c ^processor /proc/cpuinfo) |
415 |
| -if [[ -z ${N_JOBS} ]]; then |
416 |
| - # Try the Mac way of getting number of CPUs |
417 |
| - N_JOBS=$(sysctl -n hw.ncpu) |
418 |
| -fi |
419 |
| - |
420 |
| -if [[ -z ${N_JOBS} ]]; then |
421 |
| - N_JOBS=8 |
422 |
| - echo "Cannot determine the number of processors" |
423 |
| - echo "Using default concurrent job counter ${N_JOBS}" |
424 |
| -fi |
425 |
| - |
426 |
| -if [[ ! -z "${TF_BUILD_SERIAL_INSTALL_TESTS}" ]] && |
427 |
| - [[ "${TF_BUILD_SERIAL_INSTALL_TESTS}" != "0" ]]; then |
| 413 | +if [[ "${TF_BUILD_USE_GPU}" == "1" ]]; then |
428 | 414 | N_JOBS=$TF_GPU_COUNT
|
| 415 | +else |
| 416 | + N_JOBS=$(grep -c ^processor /proc/cpuinfo) |
| 417 | + if [[ -z ${N_JOBS} ]]; then |
| 418 | + # Try the Mac way of getting number of CPUs |
| 419 | + N_JOBS=$(sysctl -n hw.ncpu) |
| 420 | + fi |
| 421 | + |
| 422 | + # If still cannot determine the number of CPUs, pick 8. |
| 423 | + if [[ -z ${N_JOBS} ]]; then |
| 424 | + N_JOBS=8 |
| 425 | + echo "Cannot determine the number of processors" |
| 426 | + echo "Using default concurrent job counter ${N_JOBS}" |
| 427 | + fi |
429 | 428 | fi
|
430 | 429 |
|
431 | 430 | echo "Running Python tests-on-install with ${N_JOBS} concurrent jobs..."
|
@@ -485,9 +484,14 @@ while true; do
|
485 | 484 | TEST_LOGS="${TEST_LOGS} ${TEST_LOG}"
|
486 | 485 |
|
487 | 486 | # Launch test asynchronously
|
488 |
| - "${SCRIPT_DIR}/../gpu_build/parallel_gpu_execute.sh" \ |
| 487 | + if [[ "${TF_BUILD_USE_GPU}" == "1" ]]; then |
| 488 | + "${SCRIPT_DIR}/../gpu_build/parallel_gpu_execute.sh" \ |
| 489 | + "${SCRIPT_DIR}/py_test_delegate.sh" \ |
| 490 | + "${PYTHON_BIN_PATH}" "${PY_TEST_DIR}/${TEST_BASENAME}" "${TEST_LOG}" & |
| 491 | + else |
489 | 492 | "${SCRIPT_DIR}/py_test_delegate.sh" \
|
490 |
| - "${PYTHON_BIN_PATH}" "${PY_TEST_DIR}/${TEST_BASENAME}" "${TEST_LOG}" & |
| 493 | + "${PYTHON_BIN_PATH}" "${PY_TEST_DIR}/${TEST_BASENAME}" "${TEST_LOG}" & |
| 494 | + fi |
491 | 495 |
|
492 | 496 | if [[ "${TEST_COUNTER}" -ge "${N_PAR_TESTS}" ]]; then
|
493 | 497 | # Run in exclusive mode
|
|
0 commit comments