Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fluiddyn
transonic
Commits
fb6302e061fb
Commit
2004bf30
authored
Sep 19, 2019
by
Pierre Augier
Browse files
Fix a bug with `can_import_accelerator()`
parent
fa1205e90cf6
Changes
3
Hide whitespace changes
Inline
Side-by-side
transonic/config.py
View file @
fb6302e0
...
...
@@ -50,8 +50,6 @@ backend_set_by_user = False
def
set_backend
(
backend
:
str
):
from
transonic.util
import
can_import_accelerator
backend
=
backend
.
lower
()
supported_backends
=
[
"pythran"
,
"cython"
,
"numba"
,
"python"
]
if
backend
not
in
supported_backends
:
...
...
@@ -62,8 +60,11 @@ def set_backend(backend: str):
backend_default
=
backend
backend_set_by_user
=
True
# warning: this import has to be here!
from
transonic.util
import
can_import_accelerator
if
not
can_import_accelerator
(
backend
):
warn
(
f
"
Backend set to
{
backend
}
but accelerator not importable
"
)
warn
(
f
'
Backend set to
"
{
backend
}
"
but accelerator not importable
'
)
try
:
...
...
transonic/justintime.py
View file @
fb6302e0
...
...
@@ -228,7 +228,7 @@ class JIT:
func
,
self
.
native
,
self
.
xsimd
,
self
.
openmp
)
if
not
can_import_accelerator
():
if
not
can_import_accelerator
(
self
.
backend
.
name
):
# TODO: add a warning if backend is specified by user
return
func
...
...
transonic/run.py
View file @
fb6302e0
...
...
@@ -85,7 +85,7 @@ def run():
backend
=
backends
[
args
.
backend
]
backend
.
make_backend_files
(
paths
,
force
=
args
.
force
)
if
not
can_import_accelerator
()
or
args
.
no_compile
:
if
not
can_import_accelerator
(
backend
.
name
)
or
args
.
no_compile
:
return
# find pythran files not already compiled
...
...
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