diff --git a/conftest.py b/conftest.py index 7f5a1205956a8470670fff405a779d7aec94b64e..6d8263328d86a11288873fbb91c232bc6a18f30b 100644 --- a/conftest.py +++ b/conftest.py @@ -32,8 +32,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))