[yt-svn] commit/yt: atmyers: Merged in ngoldbaum/yt (pull request #2094)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Mar 30 15:16:19 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/d923aa143295/
Changeset:   d923aa143295
Branch:      yt
User:        atmyers
Date:        2016-03-30 22:16:08+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2094)

Handle KeyboardInterrupt in volume rendering cython loop
Affected #:  1 file

diff -r e376760e7ac426c9e47ff916655e60bc7ec78a2d -r d923aa143295f0ef48f3e9c87e70b1f21b82d530 yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -31,6 +31,8 @@
 from cython.parallel import prange, parallel, threadid
 from vec3_ops cimport dot, subtract, L2_norm, fma
 
+from cpython.exc cimport PyErr_CheckSignals
+
 DEF Nch = 4
 
 cdef class PartitionedGrid:
@@ -458,6 +460,7 @@
         size = nx * ny
         cdef ImageAccumulator *idata
         cdef np.float64_t width[3]
+        cdef int chunksize = 100
         for i in range(3):
             width[i] = self.width[i]
         with nogil, parallel(num_threads = num_threads):
@@ -465,7 +468,7 @@
             idata.supp_data = self.supp_data
             v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
             v_dir = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
-            for j in prange(size, schedule="static", chunksize=100):
+            for j in prange(size, schedule="static", chunksize=chunksize):
                 vj = j % ny
                 vi = (j - vj) / ny + iter[0]
                 vj = vj + iter[2]
@@ -476,6 +479,9 @@
                 max_t = fclip(im.zbuffer[vi, vj], 0.0, 1.0)
                 walk_volume(vc, v_pos, v_dir, self.sampler,
                             (<void *> idata), NULL, max_t)
+                if (j % (10*chunksize)) == 0:
+                    with gil:
+                        PyErr_CheckSignals()
                 for i in range(Nch):
                     im.image[vi, vj, i] = idata.rgba[i]
             free(idata)

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160330/05563cbc/attachment.htm>


More information about the yt-svn mailing list