From 3363cc81a814cb99b71595eef9e597bdfe2b30c5 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Mon, 22 Jun 2015 01:27:21 -0500 Subject: [PATCH] Make doctest output predictable --- doc/tutorial.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 5ed456705..995af8f87 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -849,8 +849,8 @@ variable, as one might do in C or another programming language: ... "{ [i]: 0<=i<n }", ... """ ... <float32> a_temp = sin(a[i]) - ... out1[i] = a_temp - ... out2[i] = sqrt(1-a_temp*a_temp) + ... out1[i] = a_temp {id=out1} + ... out2[i] = sqrt(1-a_temp*a_temp) {dep=out1} ... """) The angle brackets ``<>`` denote the creation of a temporary. The name of @@ -861,6 +861,9 @@ the conventional :mod:`numpy` scalar types (:class:`numpy.int16`, :class:`numpy.complex128`) will work. (Yes, :mod:`loopy` supports and generates correct code for complex arithmetic.) +(If you're wondering, the dependencies above were added to make the doctest +produce predictable output.) + The generated code places this variable into what OpenCL calls 'private' memory, local to each work item. @@ -876,8 +879,8 @@ memory, local to each work item. for (int i = 0; i <= -1 + n; ++i) { a_temp = sin(a[i]); - out2[i] = sqrt(1.0f + -1.0f * a_temp * a_temp); out1[i] = a_temp; + out2[i] = sqrt(1.0f + -1.0f * a_temp * a_temp); } } -- GitLab