diff --git a/conftest.py b/conftest.py index c20bde40916e7f7f5163c20e1c48c7b0f3d3b3a2..7e369f46d6395ab726ecfffdbb1f479c5df409c9 100644 --- a/conftest.py +++ b/conftest.py @@ -33,8 +33,7 @@ def add_path_to_ignore(path): collect_ignore += [os.path.join(SCRIPT_FOLDER, path, f) for f in os.listdir(os.path.join(SCRIPT_FOLDER, path))] -collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"), - os.path.join(SCRIPT_FOLDER, "pystencils", "opencl", "opencl.autoinit")] +collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py")] add_path_to_ignore('pystencils_tests/benchmark') add_path_to_ignore('_local_tmp') diff --git a/pystencils/opencl/autoinit.py b/pystencils/opencl/autoinit.py index f37ddc1cb06f89f266f79a50b381ab0dafae1e22..3d20169b640a83895edd9366a279fc6f2e13f6b4 100644 --- a/pystencils/opencl/autoinit.py +++ b/pystencils/opencl/autoinit.py @@ -4,8 +4,13 @@ Automatically initializes OpenCL context using any device. Use `pystencils.opencl.{init_globally_with_context,init_globally}` if you want to use a specific device. """ -from pystencils.opencl import * # noqa -from pystencils.opencl.opencljit import * # noqa -from pystencils.opencl.opencljit import init_globally +from pystencils.opencl.opencljit import ( + clear_global_ctx, init_globally, init_globally_with_context, make_python_function) -init_globally() +__all__ = ['init_globally', 'init_globally_with_context', 'clear_global_ctx', 'make_python_function'] + +try: + init_globally() +except Exception as e: + import warnings + warnings.warn(str(e))