2022-02-15 17:54:02 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-09-22 12:26:48 -07:00
|
|
|
# Copyright 2022 The JAX Authors.
|
2022-02-15 17:54:02 +00:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2024-11-26 11:27:32 -06:00
|
|
|
set -xu
|
2023-03-30 18:34:47 +00:00
|
|
|
|
2024-01-17 22:48:09 +00:00
|
|
|
# Function to run tests with specified GPUs
|
|
|
|
run_tests() {
|
|
|
|
local base_dir=./logs
|
|
|
|
local gpu_devices="$1"
|
|
|
|
export HIP_VISIBLE_DEVICES=$gpu_devices
|
2024-01-30 21:01:12 +00:00
|
|
|
python3 -m pytest --html=$base_dir/multi_gpu_pmap_test_log.html --reruns 3 tests/pmap_test.py
|
|
|
|
python3 -m pytest --html=$base_dir/multi_gpu_multi_device_test_log.html --reruns 3 tests/multi_device_test.py
|
2024-01-17 22:48:09 +00:00
|
|
|
python3 -m pytest_html_merger -i $base_dir/ -o $base_dir/final_compiled_report.html
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check for required commands
|
|
|
|
if ! command -v lspci &> /dev/null; then
|
|
|
|
echo "lspci command not found, aborting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! command -v python3 &> /dev/null; then
|
|
|
|
echo "Python3 is not available, aborting."
|
|
|
|
exit 1
|
2023-03-30 18:34:47 +00:00
|
|
|
fi
|
|
|
|
|
2024-01-17 22:48:09 +00:00
|
|
|
# GPU detection and test execution
|
|
|
|
gpu_count=$(lspci | grep -c 'controller.*AMD/ATI')
|
|
|
|
echo "Number of AMD/ATI GPUs detected: $gpu_count"
|
|
|
|
|
|
|
|
if [[ $gpu_count -gt 8 ]]; then
|
|
|
|
run_tests "0,1,2,3,4,5,6,7"
|
|
|
|
elif [[ $gpu_count -gt 4 ]]; then
|
|
|
|
run_tests "0,1,2,3"
|
|
|
|
elif [[ $gpu_count -gt 2 ]]; then
|
|
|
|
run_tests "0,1"
|
|
|
|
else
|
|
|
|
run_tests "0"
|
|
|
|
fi
|