Skip to content

Commit 013cff8

Browse files
authored
[r2.18] Use timeout from bazelrc and add ROCM_PATH repo_env (#3123)
1 parent a37413d commit 013cff8

File tree

1 file changed

+32
-48
lines changed

1 file changed

+32
-48
lines changed

tensorflow/tools/ci_build/linux/rocm/run_gpu_single.sh

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ N_BUILD_JOBS=$(grep -c ^processor /proc/cpuinfo)
2323
rocm-smi -i
2424
STATUS=$?
2525
if [ $STATUS -ne 0 ]; then TF_GPU_COUNT=1; else
26-
TF_GPU_COUNT=$(rocm-smi -i|grep 'Device ID' |grep 'GPU' |wc -l)
26+
TF_GPU_COUNT=$(rocm-smi -i | grep 'Device ID' | grep 'GPU' | wc -l)
2727
fi
2828
TF_TESTS_PER_GPU=1
2929
N_TEST_JOBS=$(expr ${TF_GPU_COUNT} \* ${TF_TESTS_PER_GPU})
@@ -44,57 +44,41 @@ else
4444
fi
4545

4646
# Run configure.
47-
export PYTHON_BIN_PATH=`which python3`
47+
export PYTHON_BIN_PATH=$(which python3)
4848

49-
PYTHON_VERSION=`python3 -c "import sys;print(f'{sys.version_info.major}.{sys.version_info.minor}')"`
49+
PYTHON_VERSION=$(python3 -c "import sys;print(f'{sys.version_info.major}.{sys.version_info.minor}')")
5050
export TF_PYTHON_VERSION=$PYTHON_VERSION
5151
export TF_NEED_ROCM=1
5252
export ROCM_PATH=$ROCM_INSTALL_DIR
5353

54-
if [ -f /usertools/rocm.bazelrc ]; then
55-
# Use the bazelrc files in /usertools if available
56-
bazel \
57-
--bazelrc=/usertools/rocm.bazelrc \
58-
test \
59-
--jobs=${N_BUILD_JOBS} \
60-
--local_test_jobs=${N_TEST_JOBS} \
61-
--config=sigbuild_local_cache \
62-
--config=rocm \
63-
--config=pycpp \
64-
--action_env=TF_PYTHON_VERSION=$PYTHON_VERSION \
65-
--test_env=TF_TESTS_PER_GPU=$TF_TESTS_PER_GPU \
66-
--test_env=TF_GPU_COUNT=$TF_GPU_COUNT
67-
else
68-
# Legacy style: run configure then build
69-
yes "" | $PYTHON_BIN_PATH configure.py
54+
yes "" | $PYTHON_BIN_PATH configure.py
55+
56+
TARGET_ARCHS=$(rocminfo | grep "Name: *gfx" | awk '/Name:/ {print $2}' | sort -u)
57+
if [ -z "$TARGET_ARCHS" ]; then
58+
echo "No gpu found"
59+
exit 1
60+
fi
7061

71-
# Run bazel test command. Double test timeouts to avoid flakes.
72-
bazel test \
73-
--config=rocm \
74-
-k \
75-
--test_tag_filters=gpu,-no_oss,-oss_excluded,-oss_serial,-no_gpu,-cuda-only,-benchmark-test,-rocm_multi_gpu,-tpu,-v1only \
76-
--jobs=${N_BUILD_JOBS} \
77-
--local_test_jobs=${N_TEST_JOBS} \
78-
--test_env=TF_GPU_COUNT=$TF_GPU_COUNT \
79-
--test_env=TF_TESTS_PER_GPU=$TF_TESTS_PER_GPU \
80-
--test_env=HSA_TOOLS_LIB=libroctracer64.so \
81-
--test_env=MIOPEN_DEBUG_CONV_WINOGRAD=0 \
82-
--test_env=TF_PYTHON_VERSION=$PYTHON_VERSION \
83-
--test_timeout 920,2400,7200,9600 \
84-
--build_tests_only \
85-
--test_output=errors \
86-
--test_sharding_strategy=disabled \
87-
--test_size_filters=small,medium \
88-
--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute \
89-
-- \
90-
//tensorflow/... \
91-
-//tensorflow/python/integration_testing/... \
92-
-//tensorflow/core/tpu/... \
93-
-//tensorflow/lite/... \
94-
-//tensorflow/compiler/tf2tensorrt/... \
95-
-//tensorflow/tools/toolchains/... \
96-
-//tensorflow/dtensor/python/tests:multi_client_test_nccl_2gpus \
97-
-//tensorflow/dtensor/python/tests:multi_client_test_2gpus \
98-
-//tensorflow/dtensor/python/tests:multi_client_test_nccl_local_2gpus \
99-
-//tensorflow/python/distribute/experimental:multi_worker_mirrored_strategy_test_2gpus
62+
if [ ! -d /tf ];then
63+
# The bazelrc files in /usertools expect /tf to exist
64+
mkdir /tf
10065
fi
66+
67+
# Run bazel test command. Double test timeouts to avoid flakes.
68+
bazel --bazelrc=tensorflow/tools/tf_sig_build_dockerfiles/devel.usertools/rocm.bazelrc test \
69+
--config=rocm \
70+
--config=sigbuild_local_cache \
71+
--config=pycpp \
72+
-k \
73+
--jobs=${N_BUILD_JOBS} \
74+
--local_test_jobs=${N_TEST_JOBS} \
75+
--test_env=TF_GPU_COUNT=$TF_GPU_COUNT \
76+
--test_env=TF_TESTS_PER_GPU=$TF_TESTS_PER_GPU \
77+
--test_env=MIOPEN_DEBUG_CONV_WINOGRAD=0 \
78+
--repo_env="TF_ROCM_AMDGPU_TARGETS=$TARGET_ARCHS" \
79+
--repo_env="ROCM_PATH=/opt/rocm" \
80+
--build_tests_only \
81+
--test_output=errors \
82+
--verbose_failures \
83+
--test_sharding_strategy=disabled \
84+
--run_under=//tensorflow/tools/ci_build/gpu_build:parallel_gpu_execute

0 commit comments

Comments
 (0)