Changeset 6dba2f0 in sasmodels
- Timestamp:
- Jan 27, 2018 9:00:07 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- e59f60a
- Parents:
- 2ab1bac
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
conftest.py
r2ab1bac r6dba2f0 20 20 import pytest 21 21 from _pytest.unittest import TestCaseFunction 22 23 try:24 # Ask OpenCL for the default context so that we know that one exists25 import pyopencl as cl26 cl.create_some_context(interactive=False)27 TEST_PYOPENCL = True28 except ImportError:29 TEST_PYOPENCL = False30 31 def pytest_ignore_collect(path, config):32 ignore = TEST_PYOPENCL and path.basename == "kernelcl.py"33 return ignore34 22 35 23 USE_DOCSTRING_AS_DESCRIPTION = True -
sasmodels/core.py
ra69d8cd r6dba2f0 21 21 from . import mixture 22 22 from . import kernelpy 23 from . import kernelcl 23 24 from . import kerneldll 24 25 from . import custom 25 26 26 if os.environ.get("SAS_OPENCL", "").lower() == "none": 27 HAVE_OPENCL = False 28 else: 29 try: 30 from . import kernelcl 31 HAVE_OPENCL = True 32 except Exception: 33 HAVE_OPENCL = False 27 # Other modules look for HAVE_OPENCL in core, not in kernelcl. 28 HAVE_OPENCL = kernelcl.HAVE_OPENCL 34 29 35 30 CUSTOM_MODEL_PATH = os.environ.get('SAS_MODELPATH', "") -
sasmodels/kernelcl.py
r2d81cfe r6dba2f0 58 58 import numpy as np # type: ignore 59 59 60 import pyopencl as cl # type: ignore 61 from pyopencl import mem_flags as mf 62 from pyopencl.characterize import get_fast_inaccurate_build_options 63 60 64 try: 61 #raise NotImplementedError("OpenCL not yet implemented for new kernel template") 62 import pyopencl as cl # type: ignore 63 # Ask OpenCL for the default context so that we know that one exists 64 cl.create_some_context(interactive=False) 65 if os.environ.get("SAS_OPENCL", "").lower() == "none": 66 HAVE_OPENCL = False 67 else: 68 # Ask OpenCL for the default context so that we know that one exists 69 cl.create_some_context(interactive=False) 70 HAVE_OPENCL = True 65 71 except Exception as exc: 66 72 warnings.warn("OpenCL startup failed with ***" 67 73 + str(exc) + "***; using C compiler instead") 68 raise RuntimeError("OpenCL not available") 69 70 from pyopencl import mem_flags as mf 71 from pyopencl.characterize import get_fast_inaccurate_build_options 74 HAVE_OPENCL = False 72 75 73 76 from . import generate … … 102 105 cl._DEFAULT_INCLUDE_OPTIONS = [quote_path(v) for v in cl._DEFAULT_INCLUDE_OPTIONS] 103 106 104 fix_pyopencl_include() 105 107 if HAVE_OPENCL: 108 fix_pyopencl_include() 106 109 107 110 # The max loops number is limited by the amount of local memory available
Note: See TracChangeset
for help on using the changeset viewer.