Skip to content

Commit e6ad0ea

Browse files
yf225soumith
authored andcommitted
disable test_distributed for windows (#4317)
1 parent de28e75 commit e6ad0ea

File tree

1 file changed

+48
-45
lines changed

1 file changed

+48
-45
lines changed

test/run_test.sh

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -61,51 +61,54 @@ $PYCMD test_cuda.py $@
6161
echo "Running NCCL tests"
6262
$PYCMD test_nccl.py $@
6363

64-
distributed_set_up() {
65-
export TEMP_DIR="$(mktemp -d)"
66-
rm -rf "$TEMP_DIR/"*
67-
mkdir "$TEMP_DIR/barrier"
68-
mkdir "$TEMP_DIR/test_dir"
69-
}
70-
71-
distributed_tear_down() {
72-
rm -rf "$TEMP_DIR"
73-
}
74-
75-
trap distributed_tear_down EXIT SIGHUP SIGINT SIGTERM
76-
77-
echo "Running distributed tests for the TCP backend"
78-
distributed_set_up
79-
BACKEND=tcp WORLD_SIZE=3 $PYCMD ./test_distributed.py
80-
distributed_tear_down
81-
82-
echo "Running distributed tests for the TCP backend with file init_method"
83-
distributed_set_up
84-
BACKEND=tcp WORLD_SIZE=3 INIT_METHOD='file://'$TEMP_DIR'/shared_init_file' $PYCMD ./test_distributed.py
85-
distributed_tear_down
86-
87-
echo "Running distributed tests for the Gloo backend"
88-
distributed_set_up
89-
BACKEND=gloo WORLD_SIZE=3 $PYCMD ./test_distributed.py
90-
distributed_tear_down
91-
92-
echo "Running distributed tests for the Gloo backend with file init_method"
93-
distributed_set_up
94-
BACKEND=gloo WORLD_SIZE=3 INIT_METHOD='file://'$TEMP_DIR'/shared_init_file' $PYCMD ./test_distributed.py
95-
distributed_tear_down
96-
97-
if [ -x "$(command -v mpiexec)" ]; then
98-
echo "Running distributed tests for the MPI backend"
99-
distributed_set_up
100-
BACKEND=mpi mpiexec -n 3 --noprefix $PYCMD ./test_distributed.py
101-
distributed_tear_down
102-
103-
echo "Running distributed tests for the MPI backend with file init_method"
104-
distributed_set_up
105-
BACKEND=mpi INIT_METHOD='file://'$TEMP_DIR'/shared_init_file' mpiexec -n 3 --noprefix $PYCMD ./test_distributed.py
106-
distributed_tear_down
107-
else
108-
echo "Skipping MPI backend tests (MPI not found)"
64+
# Skipping test_distributed for Windows because it doesn't have fcntl
65+
if [[ "$OSTYPE" != "msys" ]]; then
66+
distributed_set_up() {
67+
export TEMP_DIR="$(mktemp -d)"
68+
rm -rf "$TEMP_DIR/"*
69+
mkdir "$TEMP_DIR/barrier"
70+
mkdir "$TEMP_DIR/test_dir"
71+
}
72+
73+
distributed_tear_down() {
74+
rm -rf "$TEMP_DIR"
75+
}
76+
77+
trap distributed_tear_down EXIT SIGHUP SIGINT SIGTERM
78+
79+
echo "Running distributed tests for the TCP backend"
80+
distributed_set_up
81+
BACKEND=tcp WORLD_SIZE=3 $PYCMD ./test_distributed.py
82+
distributed_tear_down
83+
84+
echo "Running distributed tests for the TCP backend with file init_method"
85+
distributed_set_up
86+
BACKEND=tcp WORLD_SIZE=3 INIT_METHOD='file://'$TEMP_DIR'/shared_init_file' $PYCMD ./test_distributed.py
87+
distributed_tear_down
88+
89+
echo "Running distributed tests for the Gloo backend"
90+
distributed_set_up
91+
BACKEND=gloo WORLD_SIZE=3 $PYCMD ./test_distributed.py
92+
distributed_tear_down
93+
94+
echo "Running distributed tests for the Gloo backend with file init_method"
95+
distributed_set_up
96+
BACKEND=gloo WORLD_SIZE=3 INIT_METHOD='file://'$TEMP_DIR'/shared_init_file' $PYCMD ./test_distributed.py
97+
distributed_tear_down
98+
99+
if [ -x "$(command -v mpiexec)" ]; then
100+
echo "Running distributed tests for the MPI backend"
101+
distributed_set_up
102+
BACKEND=mpi mpiexec -n 3 --noprefix $PYCMD ./test_distributed.py
103+
distributed_tear_down
104+
105+
echo "Running distributed tests for the MPI backend with file init_method"
106+
distributed_set_up
107+
BACKEND=mpi INIT_METHOD='file://'$TEMP_DIR'/shared_init_file' mpiexec -n 3 --noprefix $PYCMD ./test_distributed.py
108+
distributed_tear_down
109+
else
110+
echo "Skipping MPI backend tests (MPI not found)"
111+
fi
109112
fi
110113

111114
if [[ $COVERAGE -eq 1 ]]; then

0 commit comments

Comments
 (0)