Skip to content

Commit

Permalink
Merge pull request #99 from pyopencl/revert-98-master
Browse files Browse the repository at this point in the history
Revert "Explicitly cache-dir configuration"
  • Loading branch information
inducer committed Nov 17, 2015
2 parents 76eee01 + 04e1a73 commit 7a1052d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
14 changes: 3 additions & 11 deletions doc/runtime.rst
Expand Up @@ -124,7 +124,7 @@ Platforms, Devices and Contexts

Two instances of this class may be compared using *=="* and *"!="*.

.. class:: Context(devices=None, properties=None, dev_type=None, cache_dir=None)
.. class:: Context(devices=None, properties=None, dev_type=None)

Create a new context. *properties* is a list of key-value
tuples, where each key must be one of :class:`context_properties`.
Expand All @@ -134,9 +134,6 @@ Platforms, Devices and Contexts
If neither is specified, a context with a *dev_type* of
:attr:`device_type.DEFAULT` is created.

If *cache_dir* is not `None` - it will be used as default *cache_dir*
for all its' :class:`Program` instances builds (see also :meth:`Program.build`).

.. note::

Calling the constructor with no arguments will fail for recent
Expand Down Expand Up @@ -657,17 +654,12 @@ Programs and Kernels

See :class:`program_build_info` for values of *param*.

.. method:: build(options=[], devices=None, cache_dir=None)
.. method:: build(options=[], devices=None)

*options* is a string of compiler flags.
Returns *self*.

If *cache_dir* is not None - built binaries are cached in an on-disk cache
with given path.
If passed *cache_dir* is None, but context of this program was created with
not-None cache_dir - it will be used as cache directory.
If passed *cache_dir* is None and context was created with None cache_dir:
built binaries will be cached in an on-disk cache called
By default, built binaries are cached in an on-disk cache called
:file:`pyopencl-compiler-cache-vN-uidNAME-pyVERSION` in the directory
returned by :func:`tempfile.gettempdir`. By setting the environment
variable :envvar:`PYOPENCL_NO_CACHE` to any non-empty value, this
Expand Down
9 changes: 3 additions & 6 deletions pyopencl/__init__.py
Expand Up @@ -347,9 +347,6 @@ def build(self, options=[], devices=None, cache_dir=None):
elif isinstance(options, six.text_type):
options = [options.encode("utf8")]

if cache_dir is None:
cache_dir = self._context.cache_dir

options = (options
+ _DEFAULT_BUILD_OPTIONS
+ _DEFAULT_INCLUDE_OPTIONS
Expand Down Expand Up @@ -1211,7 +1208,7 @@ def gl_object_get_gl_object(self):

# {{{ convenience

def create_some_context(interactive=None, answers=None, cache_dir=None):
def create_some_context(interactive=None, answers=None):
import os
if answers is None:
if "PYOPENCL_CTX" in os.environ:
Expand All @@ -1222,7 +1219,7 @@ def create_some_context(interactive=None, answers=None, cache_dir=None):
from pyopencl.tools import get_test_platforms_and_devices
for plat, devs in get_test_platforms_and_devices():
for dev in devs:
return Context([dev], cache_dir=cache_dir)
return Context([dev])

if answers is not None:
pre_provided_answers = answers
Expand Down Expand Up @@ -1337,7 +1334,7 @@ def parse_device(choice):
raise RuntimeError("not all provided choices were used by "
"create_some_context. (left over: '%s')" % ":".join(answers))

return Context(devices, cache_dir=cache_dir)
return Context(devices)

_csc = create_some_context

Expand Down
3 changes: 1 addition & 2 deletions pyopencl/cffi_cl.py
Expand Up @@ -641,7 +641,7 @@ def _parse_context_properties(properties):
class Context(_Common):
_id = 'context'

def __init__(self, devices=None, properties=None, dev_type=None, cache_dir=None):
def __init__(self, devices=None, properties=None, dev_type=None):
c_props = _parse_context_properties(properties)
status_code = _ffi.new('cl_int*')

Expand All @@ -665,7 +665,6 @@ def __init__(self, devices=None, properties=None, dev_type=None, cache_dir=None)
dev_type))

self.ptr = _ctx[0]
self.cache_dir = cache_dir

# }}}

Expand Down

0 comments on commit 7a1052d

Please sign in to comment.