Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
694f7d9e
Commit
694f7d9e
authored
1 month ago
by
Gordian Edenhofer
Browse files
Options
Downloads
Patches
Plain Diff
Skip instead of raise optimize_kl device test for one device
parent
c87fdeb8
No related branches found
No related tags found
1 merge request
!993
Multi gpu
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
test/test_re/test_optimize_kl.py
+3
-9
3 additions, 9 deletions
test/test_re/test_optimize_kl.py
with
4 additions
and
10 deletions
.gitlab-ci.yml
+
1
−
1
View file @
694f7d9e
...
@@ -43,7 +43,7 @@ test_serial:
...
@@ -43,7 +43,7 @@ test_serial:
stage
:
test
stage
:
test
script
:
script
:
-
pytest -n auto -q --cov=nifty8 --ignore test/test_re/test_optimize_kl.py test
-
pytest -n auto -q --cov=nifty8 --ignore test/test_re/test_optimize_kl.py test
-
pytest -n auto -q --cov=nifty8 --cov-append test/test_re/test_optimize_kl.py
-
env XLA_FLAGS="--xla_force_host_platform_device_count=4"
pytest -n auto -q --cov=nifty8 --cov-append test/test_re/test_optimize_kl.py
-
>
-
>
python3 -m coverage report --omit "*plot*" | tee coverage.txt
python3 -m coverage report --omit "*plot*" | tee coverage.txt
coverage
:
'
/(?i)total.*?
(100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
coverage
:
'
/(?i)total.*?
(100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
...
...
This diff is collapsed.
Click to expand it.
test/test_re/test_optimize_kl.py
+
3
−
9
View file @
694f7d9e
#!/usr/bin/env python3
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause
# SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause
import
os
os
.
environ
[
"
XLA_FLAGS
"
]
=
(
"
--xla_force_host_platform_device_count=4
"
# Use 4 CPU devices
)
import
pytest
import
pytest
pytest
.
importorskip
(
"
jax
"
)
pytest
.
importorskip
(
"
jax
"
)
...
@@ -20,13 +14,13 @@ from jax import random
...
@@ -20,13 +14,13 @@ from jax import random
from
jax.tree_util
import
tree_map
from
jax.tree_util
import
tree_map
from
numpy.testing
import
assert_allclose
,
assert_array_equal
from
numpy.testing
import
assert_allclose
,
assert_array_equal
jax
.
config
.
update
(
"
jax_enable_x64
"
,
True
)
import
nifty8.re
as
jft
import
nifty8.re
as
jft
from
nifty8.re.optimize_kl
import
concatenate_zip
from
nifty8.re.optimize_kl
import
concatenate_zip
pmp
=
pytest
.
mark
.
parametrize
pmp
=
pytest
.
mark
.
parametrize
jax
.
config
.
update
(
"
jax_enable_x64
"
,
True
)
def
random_draw
(
key
,
shape
,
dtype
,
method
):
def
random_draw
(
key
,
shape
,
dtype
,
method
):
def
_isleaf
(
x
):
def
_isleaf
(
x
):
...
@@ -326,7 +320,7 @@ def test_optimize_kl_device_consistency(
...
@@ -326,7 +320,7 @@ def test_optimize_kl_device_consistency(
):
):
devices
=
jax
.
devices
()
devices
=
jax
.
devices
()
if
not
len
(
devices
)
>
1
:
if
not
len
(
devices
)
>
1
:
raise
RuntimeError
(
"
Need more than one device for test.
"
)
pytest
.
skip
(
"
Need more than one device for test.
"
)
if
residual_device_map
==
"
pmap
"
and
n_samples
>
len
(
devices
):
if
residual_device_map
==
"
pmap
"
and
n_samples
>
len
(
devices
):
pytest
.
skip
(
"
n_samples>len(devices), skipping for pmap.
"
)
pytest
.
skip
(
"
n_samples>len(devices), skipping for pmap.
"
)
if
(
if
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment