Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
c52a33a1
"vscode:/vscode.git/clone" did not exist on "c787298547f948465e1fa55751a21dc87d5e03d1"
Unverified
Commit
c52a33a1
authored
Jun 09, 2021
by
Nicolas Hug
Committed by
GitHub
Jun 09, 2021
Browse files
Skip some CPU-only tests on CircleCI machines with GPU (#4002)
parent
ea6be124
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
+31
-6
.circleci/config.yml
.circleci/config.yml
+9
-1
.circleci/config.yml.in
.circleci/config.yml.in
+9
-1
test/common_utils.py
test/common_utils.py
+13
-4
No files found.
.circleci/config.yml
View file @
c52a33a1
...
...
@@ -687,12 +687,20 @@ jobs:
paths
:
-
conda
-
env
-
run
:
# Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# They're avaiable in all the other workflows (OSX and Windows).
# But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
name
:
export CIRCLECI env var
command
:
echo "CIRCLECI=true" >> ./env.list
-
run
:
name
:
Install torchvision
command
:
docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
-
run
:
name
:
Run tests
command
:
docker run -
e CIRCLECI
-t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
command
:
docker run -
-env-file ./env.list
-t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
-
run
:
name
:
Post Process
command
:
docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/post_process.sh
...
...
.circleci/config.yml.in
View file @
c52a33a1
...
...
@@ -687,12 +687,20 @@ jobs:
paths:
- conda
- env
- run:
# Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
# Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
# They're avaiable in all the other workflows (OSX and Windows).
# But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
# So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
name: export CIRCLECI env var
command: echo "CIRCLECI=true" >> ./env.list
- run:
name: Install torchvision
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
- run:
name: Run tests
command: docker run -
e CIRCLECI
-t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
command: docker run -
-env-file ./env.list
-t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
- run:
name: Post Process
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/post_process.sh
...
...
test/common_utils.py
View file @
c52a33a1
...
...
@@ -26,6 +26,7 @@ IN_CIRCLE_CI = os.getenv("CIRCLECI", False) == 'true'
IN_RE_WORKER
=
os
.
environ
.
get
(
"INSIDE_RE_WORKER"
)
is
not
None
IN_FBCODE
=
os
.
environ
.
get
(
"IN_FBCODE_TORCHVISION"
)
==
"1"
CUDA_NOT_AVAILABLE_MSG
=
'CUDA device not available'
CIRCLECI_GPU_NO_CUDA_MSG
=
"We're in a CircleCI GPU machine, and this test doesn't need cuda."
@
contextlib
.
contextmanager
...
...
@@ -256,11 +257,19 @@ def call_args_to_kwargs_only(call_args, *callable_or_arg_names):
def
cpu_and_gpu
():
# TODO: make this properly handle CircleCI
import
pytest
# noqa
# ignore CPU tests in RE as they're already covered by another contbuild
devices
=
[]
if
IN_RE_WORKER
else
[
'cpu'
]
# also ignore CPU tests in CircleCI machines that have a GPU: these tests
# are run on CPU-only machines already.
if
IN_RE_WORKER
:
devices
=
[]
else
:
if
IN_CIRCLE_CI
and
torch
.
cuda
.
is_available
():
mark
=
pytest
.
mark
.
skip
(
reason
=
CIRCLECI_GPU_NO_CUDA_MSG
)
else
:
mark
=
()
devices
=
[
pytest
.
param
(
'cpu'
,
marks
=
mark
)]
if
torch
.
cuda
.
is_available
():
cuda_marks
=
()
...
...
@@ -278,7 +287,6 @@ def cpu_and_gpu():
def
needs_cuda
(
test_func
):
# TODO: make this properly handle CircleCI
import
pytest
# noqa
if
IN_FBCODE
and
not
IN_RE_WORKER
:
...
...
@@ -293,12 +301,13 @@ def needs_cuda(test_func):
def
cpu_only
(
test_func
):
# TODO: make this properly handle CircleCI
import
pytest
# noqa
if
IN_RE_WORKER
:
# The assumption is that all RE workers have GPUs.
return
pytest
.
mark
.
dont_collect
(
test_func
)
elif
IN_CIRCLE_CI
and
torch
.
cuda
.
is_available
():
return
pytest
.
mark
.
skip
(
reason
=
CIRCLECI_GPU_NO_CUDA_MSG
)(
test_func
)
else
:
return
test_func
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment