Use list for set_*_backends inputs
@@ -12,14 +12,14 @@ def _get_backend(str s):
raise ValueError('Unknown backend: {}'.format(s))
-def set_reduction_backends(str s):
+def set_reduction_backends(backends):
global _reduction_backends
- _reduction_backends = [_get_backend(t) for t in s.split(',') if t]
+ _reduction_backends = [_get_backend(b) for b in backends]
-def set_routine_backends(str s):
+def set_routine_backends(backends):
global _routine_backends
- _routine_backends = [_get_backend(t) for t in s.split(',') if t]
+ _routine_backends = [_get_backend(b) for b in backends]
def _get_routine_backends():
@@ -27,9 +27,10 @@ def _get_routine_backends():
cdef _set_default_backends():
- cdef str default_backends = os.getenv('CUPY_BACKENDS', '')
- set_reduction_backends(default_backends)
- set_routine_backends(default_backends)
+ cdef str b, backend_names = os.getenv('CUPY_BACKENDS', '')
+ cdef list backends = [b for b in backend_names.split(',') if b]
+ set_reduction_backends(backends)
+ set_routine_backends(backends)
_set_default_backends()
