Copyright (C) 2017-2018, Colin P Stark and Gavin J Stark. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @file integration.ml * @brief Integration using GPU for trace *
val
pv_noisy : Streamlines.Properties.t_props_trace
‑> (unit ‑> unit) ‑>
unit
pv_noisy t
Shortcut to use Properties.t_props_trace verbosity for Properties.pv_noisy
val
pv_debug : Streamlines.Properties.t_props_trace
‑> (unit ‑> unit) ‑>
unit
pv_debug t
Shortcut to use Properties.t_props_trace verbosity for Properties.pv_debug
val pv_info
: Streamlines.Properties.t_props_trace
‑> (unit ‑> unit) ‑>
unit
pv_info t
Shortcut to use Properties.t_props_trace verbosity for Properties.pv_info
val
pv_verbose : Streamlines.Properties.t_props_trace
‑> (unit ‑> unit) ‑>
unit
pv_verbose t
Shortcut to use Properties.t_props_trace verbosity for Properties.pv_verbose
type
t_chunk
=
{
required : bool; |
direction : string; |
downup_index : int; |
downup_sign : float; |
chunk_index : int; |
seed_offset : int; |
num_seeds : int; |
}
t_chunk
val chunk :
Streamlines.Core.t_core_data
‑> bool ‑> (int * int
* int) ‑> t_chunk
chunk data downstream (n, seed_start,
seed_end)
Create a chunk (index n) with the given seeds, for upstream or downstream
val
generate_chunks : int ‑> Streamlines.Core.t_core_data
‑> int ‑> int * t_chunk list
generate_chunks num_seeds data
num_chunks_required
Generate a to_do_list of chunks
type
t_memory
=
{
uv_array : Streamlines.Globals.t_ba_floats; |
chunk_slc_array : Streamlines.Globals.t_ba_ints; |
chunk_slt_array : Streamlines.Globals.t_ba_ints; |
chunk_nsteps_array : Streamlines.Globals.t_ba_int16s; |
chunk_length_array : Streamlines.Globals.t_ba_floats; |
chunk_trajcs_array : Streamlines.Globals.t_ba_chars; |
seeds_buffer : Streamlines.Pocl.t_buffer; |
mask_buffer : Streamlines.Pocl.t_buffer; |
uv_buffer : Streamlines.Pocl.t_buffer; |
chunk_slc_buffer : Streamlines.Pocl.t_buffer; |
chunk_slt_buffer : Streamlines.Pocl.t_buffer; |
chunk_nsteps_buffer : Streamlines.Pocl.t_buffer; |
chunk_length_buffer : Streamlines.Pocl.t_buffer; |
chunk_trajcs_buffer : Streamlines.Pocl.t_buffer; |
}
t_memory
Structure containing the memory and OpenCL buffers for interacting with the integrate_trajectories kernel.
val
copy_read : Streamlines.Pocl.t
‑> ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t
‑>
Owl_opencl_generated.cl_mem
copy_read pocl
Shortcut for creating an OpenCL buffer that is read-only by the kernel and copied from a big array before execution
val
copy_read_write : Streamlines.Pocl.t
‑> ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t
‑>
Owl_opencl_generated.cl_mem
copy_read_write pocl
Shortcut for creating an OpenCL buffer that is read-write by the kernel and copied from a big array before execution
val
write_only : Streamlines.Pocl.t
‑> ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t
‑>
Owl_opencl_generated.cl_mem
write_only pocl
Shortcut for creating an OpenCL buffer that is write-only by the kernel
val
memory_create_buffers : Streamlines.Pocl.t
‑> Streamlines.Core.t_core_data
‑> ('a, 'b) ODM.t ‑> int ‑>
t_memory
memory_create_buffers pocl data seeds
chunk_size
Create a t_memory strucure with big arrays and PyOpenCL buffers to allow CPU-GPU data transfer for the integrate_trajectories kernel
val
memory_clear : t_memory
‑> Streamlines.Pocl.t
‑> unit
memory_clear t pocl
Clear the chunk buffers and copy them to the GPU, prior to execution of the integrate_trajectories kernel
val
memory_copyback : t_memory
‑> Streamlines.Pocl.t
‑> unit
memory_copyback t pocl
Copy back the chunk buffers from the GPU to the big arrays after execution of the integrate_trajectories kernel
val
results_create : Streamlines.Core.t_core_data
‑> ('a, 'b) ODM.t ‑> Streamlines.Core.t_trace_results
results_create data seeds
Create the trace results structure given the seeds
val
gpu_integrate_chunk : Streamlines.Pocl.t
‑> Streamlines.Core.t_core_data
‑> t_memory ‑> bytes list array ‑> Streamlines.Core.t_trace_results
‑> string ‑> t_chunk ‑> unit
gpu_integrate_chunk pocl data memory
streamline_lists results cl_kernel_source t
Integrate a chunk of seeds on the GPU - this is a set of consecutive seeds in either upstream or downstream - and aggregate the results
val
gpu_integrate_trajectories : Streamlines.Pocl.t
‑> Streamlines.Core.t_core_data
‑> ('a, 'b) ODM.t ‑> int ‑>
t_chunk list ‑> Streamlines.Core.t_trace_results
gpu_integrate_trajectories pocl data seeds
chunk_size to_do_list
Carry out GPU computations in the chunks on to_do_list.
Each chunk is handled with a separate compilation, and results are aggregated.
val
integrate_trajectories : Streamlines.Properties.t_props_trace
‑> Streamlines.Pocl.t
‑> Streamlines.Core.t_core_data
‑> ('a, 'b) ODM.t ‑> Streamlines.Core.t_trace_results
integrate_trajectories tprops pocl data
seeds
Integrate trajectories both upstream and downstream from the seeds array of unpadded ROI coordinates.
Trace each streamline from its corresponding seed point using 2nd-order Runge-Kutta integration of the topographic gradient vector field.