From 7522c12a37881fc576ec42acca633cab3294c175 Mon Sep 17 00:00:00 2001 From: Nikolay Polyarniy Date: Tue, 17 Nov 2015 01:57:38 +0300 Subject: [PATCH] Documentation updated abour cache_dir: - Context constructor: new param cache_dir - Program.build actualized: old param cache_dir described with taking into account Context cache_dir --- doc/runtime.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/runtime.rst b/doc/runtime.rst index 33cb2202..ce070a9f 100644 --- a/doc/runtime.rst +++ b/doc/runtime.rst @@ -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) +.. class:: Context(devices=None, properties=None, dev_type=None, cache_dir=None) Create a new context. *properties* is a list of key-value tuples, where each key must be one of :class:`context_properties`. @@ -134,6 +134,9 @@ 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 @@ -654,12 +657,17 @@ Programs and Kernels See :class:`program_build_info` for values of *param*. - .. method:: build(options=[], devices=None) + .. method:: build(options=[], devices=None, cache_dir=None) *options* is a string of compiler flags. Returns *self*. - By default, built binaries are cached in an on-disk cache called + 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 :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 -- GitLab