From 0b7e385d39460aef7043cf02a5051efa42700a9e Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Thu, 11 Jul 2013 17:34:11 -0400 Subject: [PATCH] Buncha doc tweaks --- doc/{source => }/.gitignore | 0 doc/Makefile | 4 +-- doc/{source => }/_static/akdoc.css | 0 doc/{source => }/_templates/layout.html | 0 doc/{source => }/algorithm.rst | 0 doc/{source => }/array.rst | 0 doc/{source => }/conf.py | 2 +- doc/{source => }/howto.rst | 0 doc/{source => }/index.rst | 36 +++---------------------- doc/{source => }/misc.rst | 0 doc/{source => }/runtime.rst | 0 doc/{source => }/subst.rst | 0 doc/{source => }/tools.rst | 0 13 files changed, 7 insertions(+), 35 deletions(-) rename doc/{source => }/.gitignore (100%) rename doc/{source => }/_static/akdoc.css (100%) rename doc/{source => }/_templates/layout.html (100%) rename doc/{source => }/algorithm.rst (100%) rename doc/{source => }/array.rst (100%) rename doc/{source => }/conf.py (99%) rename doc/{source => }/howto.rst (100%) rename doc/{source => }/index.rst (62%) rename doc/{source => }/misc.rst (100%) rename doc/{source => }/runtime.rst (100%) rename doc/{source => }/subst.rst (100%) rename doc/{source => }/tools.rst (100%) diff --git a/doc/source/.gitignore b/doc/.gitignore similarity index 100% rename from doc/source/.gitignore rename to doc/.gitignore diff --git a/doc/Makefile b/doc/Makefile index d03f64d1..c2a7ea99 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -10,7 +10,7 @@ BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest @@ -35,7 +35,7 @@ help: .PHONY: help clean html web pickle htmlhelp latex changes linkcheck constants: - python make_constants.py > source/constants.inc + python make_constants.py > constants.inc clean: -rm -rf build/* diff --git a/doc/source/_static/akdoc.css b/doc/_static/akdoc.css similarity index 100% rename from doc/source/_static/akdoc.css rename to doc/_static/akdoc.css diff --git a/doc/source/_templates/layout.html b/doc/_templates/layout.html similarity index 100% rename from doc/source/_templates/layout.html rename to doc/_templates/layout.html diff --git a/doc/source/algorithm.rst b/doc/algorithm.rst similarity index 100% rename from doc/source/algorithm.rst rename to doc/algorithm.rst diff --git a/doc/source/array.rst b/doc/array.rst similarity index 100% rename from doc/source/array.rst rename to doc/array.rst diff --git a/doc/source/conf.py b/doc/conf.py similarity index 99% rename from doc/source/conf.py rename to doc/conf.py index 555d0b87..0a54b48e 100644 --- a/doc/source/conf.py +++ b/doc/conf.py @@ -49,7 +49,7 @@ copyright = '2009, Andreas Kloeckner' # # The short X.Y version. ver_dic = {} -execfile("../../pyopencl/version.py", ver_dic) +execfile("../pyopencl/version.py", ver_dic) version = ".".join(str(x) for x in ver_dic["VERSION"]) # The full version, including alpha/beta/rc tags. release = ver_dic["VERSION_TEXT"] diff --git a/doc/source/howto.rst b/doc/howto.rst similarity index 100% rename from doc/source/howto.rst rename to doc/howto.rst diff --git a/doc/source/index.rst b/doc/index.rst similarity index 62% rename from doc/source/index.rst rename to doc/index.rst index 60ff9f3e..7e95d502 100644 --- a/doc/source/index.rst +++ b/doc/index.rst @@ -27,40 +27,12 @@ What makes PyOpenCL special? :ref:`MIT license <license>` and free for commercial, academic, and private use. -Here's an example, to give you an impression:: +Here's an example, to give you an impression: - import pyopencl as cl - import numpy - import numpy.linalg as la +.. literalinclude:: ../examples/demo.py - a = numpy.random.rand(50000).astype(numpy.float32) - b = numpy.random.rand(50000).astype(numpy.float32) - - ctx = cl.create_some_context() - queue = cl.CommandQueue(ctx) - - mf = cl.mem_flags - a_buf = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=a) - b_buf = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=b) - dest_buf = cl.Buffer(ctx, mf.WRITE_ONLY, b.nbytes) - - prg = cl.Program(ctx, """ - __kernel void sum(__global const float *a, - __global const float *b, __global float *c) - { - int gid = get_global_id(0); - c[gid] = a[gid] + b[gid]; - } - """).build() - - prg.sum(queue, a.shape, None, a_buf, b_buf, dest_buf) - - a_plus_b = numpy.empty_like(a) - cl.enqueue_copy(queue, a_plus_b, dest_buf) - - print la.norm(a_plus_b - (a+b)) - -(You can find this example as :file:`examples/demo.py` in the PyOpenCL +(You can find this example as +:download:`examples/demo.py <../examples/demo.py>` in the PyOpenCL source distribution.) Contents diff --git a/doc/source/misc.rst b/doc/misc.rst similarity index 100% rename from doc/source/misc.rst rename to doc/misc.rst diff --git a/doc/source/runtime.rst b/doc/runtime.rst similarity index 100% rename from doc/source/runtime.rst rename to doc/runtime.rst diff --git a/doc/source/subst.rst b/doc/subst.rst similarity index 100% rename from doc/source/subst.rst rename to doc/subst.rst diff --git a/doc/source/tools.rst b/doc/tools.rst similarity index 100% rename from doc/source/tools.rst rename to doc/tools.rst -- GitLab