Commit 2004bf30 authored by Pierre Augier's avatar Pierre Augier
Browse files

Fix a bug with `can_import_accelerator()`

parent fa1205e90cf6
......@@ -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:
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment