diff options
author | Anthony LaTorre <telatorre@gmail.com> | 2011-05-08 17:35:15 -0400 |
---|---|---|
committer | Anthony LaTorre <telatorre@gmail.com> | 2011-05-08 17:35:15 -0400 |
commit | 152240722edb92f84de18818c137804b7db63e6a (patch) | |
tree | 18e6b2deb3040e5ef356e3119f66aea6277c53e1 | |
parent | 16736eeae08d9627ad751c65919900ae9191a08f (diff) | |
download | chroma-152240722edb92f84de18818c137804b7db63e6a.tar.gz chroma-152240722edb92f84de18818c137804b7db63e6a.tar.bz2 chroma-152240722edb92f84de18818c137804b7db63e6a.zip |
print speed; the current kernel is able to render 8844 triangles with 480,000 photons in roughly 3.5 seconds
-rw-r--r-- | test.py | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -64,25 +64,23 @@ rotate(np.int32(mesh.size), mesh_gpu, np.float32(-np.pi/2), gpuarray.vec.make_fl translate(np.int32(mesh.size), mesh_gpu, gpuarray.vec.make_float3(0,30,0), block=(256,1,1), grid=(mesh.size//256+1,1)) -t0 = time.time() + for i in range(100): rotate(np.int32(x.size), x_gpu, np.float32(np.pi/50), gpuarray.vec.make_float3(0,0,1), block=(256,1,1), grid=(width*height//256+1,1)) rotate(np.int32(p.size), p_gpu, np.float32(np.pi/50), gpuarray.vec.make_float3(0,0,1), block=(256,1,1), grid=(width*height//256+1,1)) + t0 = time.time() intersect(np.int32(x.size), x_gpu, p_gpu, np.int32(mesh.size//3), mesh_gpu, pixel_gpu, block=(256,1,1), grid=(width*height//256+1,1)) - cuda.Context.synchronize() + elapsed = time.time() - t0 + + print '%i triangles, %i photons, %f sec; (%f photons/s)' % \ + (mesh.size//3, pixel.size, elapsed, pixel.size/elapsed) + cuda.memcpy_dtoh(pixel, pixel_gpu) pygame.surfarray.blit_array(screen, pixel.reshape(size)) pygame.display.flip() - -elapsed = time.time() - t0 - -print '%i triangles, %i photons, %f sec; (%f photons/s)' % \ - (mesh.size//3, pixel.size, elapsed, pixel.size/elapsed) - - raw_input('press enter to exit') |