diff options
| author | Stan Seibert <stan@mtrr.org> | 2012-02-17 13:53:36 -0500 |
|---|---|---|
| committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:38 -0700 |
| commit | aa14bc9f0947a77781c1234c38f422f18b2fe154 (patch) | |
| tree | fe9502d45c3cb6d41dbf87f29cf72af82c7571f4 /chroma/gpu | |
| parent | 3cd18a51d4e73d9148fc721527880c8dbbd08871 (diff) | |
| download | chroma-aa14bc9f0947a77781c1234c38f422f18b2fe154.tar.gz chroma-aa14bc9f0947a77781c1234c38f422f18b2fe154.tar.bz2 chroma-aa14bc9f0947a77781c1234c38f422f18b2fe154.zip | |
BVH optimization to sort child nodes by area. Only has a small effect.
Diffstat (limited to 'chroma/gpu')
| -rw-r--r-- | chroma/gpu/bvh.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/chroma/gpu/bvh.py b/chroma/gpu/bvh.py index b138bb9..5e75a1e 100644 --- a/chroma/gpu/bvh.py +++ b/chroma/gpu/bvh.py @@ -129,6 +129,22 @@ def collapse_chains(nodes, layer_bounds): grid=(120,1)) return gpu_nodes.get() +def area_sort_nodes(gpu_geometry, layer_bounds): + bvh_module = get_cu_module('bvh.cu', options=cuda_options, + include_source_directory=True) + bvh_funcs = GPUFuncs(bvh_module) + + bounds = zip(layer_bounds[:-1], layer_bounds[1:])[:-1] + bounds.reverse() + nthreads_per_block = 256 + for start, end in bounds: + bvh_funcs.area_sort_child(np.uint32(start), + np.uint32(end), + gpu_geometry, + block=(nthreads_per_block,1,1), + grid=(120,1)) + return gpu_geometry.nodes.get() + def merge_nodes(nodes, degree, max_ratio=None): bvh_module = get_cu_module('bvh.cu', options=cuda_options, |
