slm: OpenCL code base  0.1
Macros | Functions
integration.cl File Reference

Streamline trajectory integration kernel and related tracing functions. More...

Go to the source code of this file.

Macros

#define BYTE_REVERSAL(initial_rng_state)
 Byte reversal. More...
 
#define INITIALIZE_RNG(initial_rng_state)
 Initialize the Lehmer random number generator. More...
 

Functions

__kernel void integrate_trajectory (__global const float2 *seed_point_array, __global const bool *mask_array, __global const float2 *uv_array, __global char2 *trajectories_array, __global ushort *traj_nsteps_array, __global float *traj_length_array, __global uint *slc_array, __global uint *slt_array)
 GPU kernel that drives streamline integration from seed positions given in seed_point_array, controlled by the 'flow' vector field given in uv_array, and either terminated at pixels masked in mask_array or because a streamline exceeds a threshold distance (length or number of integration points) given by parameters stored in info. More...
 

Detailed Description

Streamline trajectory integration kernel and related tracing functions.

Author
CPS
Todo:

Fix big-DTM crash issue

Perhaps use compiler directive volatile where variables not const?

Update doc about trajectory integration to describe subpixel seeding & jittering

Bug:
Crashes (reported as 'abort 6' by PyOpenCL) occur for very large DTMs. The reason remains obscure: it may be because of GPU timeout, but more likely is because of a memory leakage.

Definition in file integration.cl.

Macro Definition Documentation

◆ BYTE_REVERSAL

#define BYTE_REVERSAL (   initial_rng_state)
Value:
initial_rng_state = (initial_rng_state>>24)&0xff \
| (initial_rng_state>> 8)&0xff00 \
| (initial_rng_state<< 8)&0xff0000 \
| (initial_rng_state<<24)&0xff000000;

Byte reversal.

Macro to perform byte reversal per GJS's suggestion.

Parameters
[in,out]initial_rng_stateRNG state (thus initally the seed) and RNG variate

Definition at line 25 of file integration.cl.

◆ INITIALIZE_RNG

#define INITIALIZE_RNG (   initial_rng_state)
Value:
initial_rng_state = i+(j+seed_idx); \
/*initial_rng_state = i+(j+seed_idx*SUBPIXEL_SEED_POINT_DENSITY)\
* *SUBPIXEL_SEED_POINT_DENSITY;*/ \
BYTE_REVERSAL(initial_rng_state); \
lehmer_rand_uint(&initial_rng_state); \
BYTE_REVERSAL(initial_rng_state);

Initialize the Lehmer random number generator.

Macro to scramble the initial RNG state to reduce correlation of neighboring streamline jitters

Parameters
[in,out]initial_rng_stateRNG state (thus initally the seed) and RNG variate

Definition at line 41 of file integration.cl.