handybeam.opencl_wrappers

class handybeam.opencl_wrappers.propagator_wrappers.Propagator(parent=None, use_device=0, use_platform=0)[source]

This is a wrapper class which inherits from the template wrapper class Wrapper and the OpenCL propagator mixin classes. An instance of this class is initialised when a world object is initialised.

__init__(parent=None, use_device=0, use_platform=0)[source]

This method intialises an instance of the Propagator class. During the initialisation process, the compiled OpenCL propagator kernels are assigned to the appropriate propagator mixin classes.

Todo

Provide description and type for the handybeam world object.

Parameters:parent (handybeam world object) – DESCRIPTION
__repr__

Return repr(self).

__str__

Return str(self).

_register_clist_propagator()

This method assigns the compiled OpenCL propagator kernel _hbk_clist_propagator to this class and then sets the correct data types for the input to the assigned kernel.

_register_hex_propagator()

This method assigns the compiled OpenCL propagator kernel _hbk_hex_propagator to this class and then sets the correct data types for the input to the assigned kernel.

_register_lamb_propagator()

This method assigns the compiled OpenCL propagator kernel _hbk_lamb_propagator to this class and then sets the correct data types for the input to the assigned kernel.

_register_rect_propagator()

This method assigns the compiled OpenCL propagator kernel _hbk_rect_propagator to this class and then sets the correct data types for the input to the assigned kernel.

clist_propagator(tx_array: handybeam.tx_array.TxArray, sampling_point_list=array([], shape=(0, 3), dtype=float32), local_work_size=(128, 1, 1), print_performance_feedback=False)

This method simulates the acoustic pressure field on a set of provided sampling points. It does this by initialising a pressure field buffer on the CPU. It then passes the required information to the appropriate OpenCl kernel and executes the computation of the pressure field on the GPU. This data is then copied over to the pressure field buffer on the CPU.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – This is a handybeam tx_array class.
  • sampling_point_list (numpy array) – Numpy array containing the list of requested sampling point coordinates.
  • local_work_size (tuple) – Tuple containing the local work sizes for the GPU.
  • print_performance_feedback (boolean) – Boolean value determining whether or not to output the GPU performance.
hex_propagator(tx_array: handybeam.tx_array.TxArray, side_length, delta, x0, y0, z0, vx1, vy1, vz1, vx2, vy2, vz2, local_work_size=(1, 1, 1), print_performance_feedback=None)

This method simulates the acoustic pressure field on a hexagonal sampling grid. It does this by initialising a pressure field buffer on the CPU. It then passes the required information to the appropriate OpenCl kernel and executes the computation of the pressure field on the GPU. This data is then copied over to the pressure field buffer on the CPU.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – This is a handybeam tx_array class.
  • side_length (numpy float / numpy int) – This assigns the side length of the hexagonal sampling grid.
  • delta (numpy float) – Distance between adjacent sampling grid points.
  • x0 (numpy float) – The x-coordinate of the origin of the sampling grid.
  • y0 (numpy float) – The y-coordinate of the origin of the sampling grid.
  • z0 (numpy float) – The z-coordinate of the origin of the sampling grid.
  • vx1 (numpy float) – The x-component of the first unit vector that parameterises the sampling grid.
  • vy1 (numpy float) – The y-component of the first unit vector that parameterises the sampling grid.
  • vz1 (numpy float) – The z-component of the first unit vector that parameterises the sampling grid.
  • vx2 (numpy float) – The x-component of the second unit vector that parameterises the sampling grid.
  • vy2 (numpy float) – The y-component of the second unit vector that parameterises the sampling grid.
  • vz2 (numpy float) – The z-component of the second unit vector that parameterises the sampling grid.
  • local_work_size (tuple) – Tuple containing the local work sizes for the GPU.
  • print_performance_feedback (boolean) – Boolean value determining whether or not to output the GPU performance.
lamb_propagator(tx_array: handybeam.tx_array.TxArray, radius, N, delta, x0, y0, z0, local_work_size=(1, 1, 1), print_performance_feedback=None)

This method simulates the acoustic pressure field on a lambert sampling grid. It does this by initialising a pressure field buffer on the CPU. It then passes the required information to the appropriate OpenCl kernel and executes the computation of the pressure field on the GPU. This data is then copied over to the pressure field buffer on the CPU.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – This is a handybeam tx_array class.
  • radius (numpy float / numpy int) – This assigns the radius of the hemisphere sampling grid.
  • N (numpy float / numpy int) – This assigns
  • delta (numpy float) – Distance between adjacent sampling grid points.
  • x0 (numpy float) – The x-coordinate of the origin of the sampling grid.
  • y0 (numpy float) – The y-coordinate of the origin of the sampling grid.
  • z0 (numpy float) – The z-coordinate of the origin of the sampling grid.
  • local_work_size (tuple) – Tuple containing the local work sizes for the GPU.
  • print_performance_feedback (boolean) – Boolean value determining whether or not to output the GPU performance.
print_performance_feedback(cl_profiling_kernel_event, cl_profiling_mem_copy_event, t_elapsed_wall_time, ray_count, output_buffer_size)

This method …

Todo

Jurek wrote this stuff so it’s up to him to comment.

Parameters:
  • cl_profiling_kernel_event (TYPE) – DESCRIPTION
  • cl_profiling_mem_copy_event (TYPE) – DESCRIPTION
  • t_elapsed_Wall_time (TYPE) – DESCRIPTION
  • ray_count (TYPE) – DESCRIPTION
  • output_buffer_size (TYPE) – DESCRIPTION
rect_propagator(tx_array: handybeam.tx_array.TxArray, N_x, N_y, delta, x0, y0, z0, vx1, vy1, vz1, vx2, vy2, vz2, local_work_size=(1, 1, 1), print_performance_feedback=None)

This method simulates the acoustic pressure field on a rectilinear sampling grid. It does this by initialising a pressure field buffer on the CPU. It then passes the required information to the appropriate OpenCl kernel and executes the computation of the pressure field on the GPU. This data is then copied over to the pressure field buffer on the CPU.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – This is a handybeam tx_array class.
  • N_x (numpy int) – This assigns the number of sampling points along the x-axis of the sampling grid.
  • N_y (numpy int) – This assigns the number of sampling points along the y-axis of the sampling grid.
  • delta (numpy float) – Distance between adjacent sampling grid points.
  • x0 (numpy float) – The x-coordinate of the origin of the sampling grid.
  • y0 (numpy float) – The y-coordinate of the origin of the sampling grid.
  • z0 (numpy float) – The z-coordinate of the origin of the sampling grid.
  • vx1 (numpy float) – The x-component of the first unit vector that parameterises the sampling grid.
  • vy1 (numpy float) – The y-component of the first unit vector that parameterises the sampling grid.
  • vz1 (numpy float) – The z-component of the first unit vector that parameterises the sampling grid.
  • vx2 (numpy float) – The x-component of the second unit vector that parameterises the sampling grid.
  • vy2 (numpy float) – The y-component of the second unit vector that parameterises the sampling grid.
  • vz2 (numpy float) – The z-component of the second unit vector that parameterises the sampling grid.
  • local_work_size (tuple) – Tuple containing the local work sizes for the GPU.
  • print_performance_feedback (boolean) – Boolean value determining whether or not to output the GPU performance.
class handybeam.opencl_wrappers.abstract_wrapper.Wrapper[source]

This is a template wrapper class for the OpenCL wrapper classes Propagator, Solver and Translator.

__init__()[source]

This method intialises an instance of the template wrapper class Wrapper.

__repr__

Return repr(self).

__str__

Return str(self).

print_performance_feedback(cl_profiling_kernel_event, cl_profiling_mem_copy_event, t_elapsed_wall_time, ray_count, output_buffer_size)[source]

This method …

Todo

Jurek wrote this stuff so it’s up to him to comment.

Parameters:
  • cl_profiling_kernel_event (TYPE) – DESCRIPTION
  • cl_profiling_mem_copy_event (TYPE) – DESCRIPTION
  • t_elapsed_Wall_time (TYPE) – DESCRIPTION
  • ray_count (TYPE) – DESCRIPTION
  • output_buffer_size (TYPE) – DESCRIPTION
class handybeam.opencl_wrappers.solver_wrappers.Solver(parent=None, use_device=2, use_platform=0)[source]

This is a wrapper class which inherits from the template wrapper class Wrapper and the OpenCL solver mixin classes. An instance of this class is initialised when a solver object is initialised.

__init__(parent=None, use_device=2, use_platform=0)[source]

This method intialises an instance of the Solver class. During the initialisation process, the compiled OpenCL solver kernels are assigned to the appropriate solver mixin classes.

Parameters:parent (handybeam world object) – DESCRIPTION
__repr__

Return repr(self).

__str__

Return str(self).

_register_single_focus_solver()

Assigns the compiled OpenCL propagator kernel _hbk_sf_solver to this class and then sets the correct data types for the input to the assigned kernel.

Used by the opencl_wrappers.Solver.__init__()

print_performance_feedback(cl_profiling_kernel_event, cl_profiling_mem_copy_event, t_elapsed_wall_time, ray_count, output_buffer_size)

This method …

Todo

Jurek wrote this stuff so it’s up to him to comment.

Parameters:
  • cl_profiling_kernel_event (TYPE) – DESCRIPTION
  • cl_profiling_mem_copy_event (TYPE) – DESCRIPTION
  • t_elapsed_Wall_time (TYPE) – DESCRIPTION
  • ray_count (TYPE) – DESCRIPTION
  • output_buffer_size (TYPE) – DESCRIPTION
single_focus_solver(tx_array: handybeam.tx_array.TxArray, xf, yf, zf, local_work_size=None, print_performance_feedback=False)

This method determines the set of activation coefficients required to produce a single focal point a given point in space.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – This is a handybeam tx_array class.
  • xf (numpy float) – This is the x-coordinate of the requested focal point position.
  • yf (numpy float) – This is the y-coordinate of the requested focal point position.
  • zf (numpy float) – This is the z-coordinate of the requested focal point position.
  • local_work_size (tuple) – Tuple containing the local work sizes for the GPU.
  • print_performance_feedback (boolean) – Boolean value determining whether or not to output the GPU performance.
class handybeam.opencl_wrappers.translator_wrappers.Translator(parent=None, use_device=2, use_platform=0)[source]

This is a wrapper class which inherits from the template wrapper class Wrapper and the OpenCL translator mixin classes. An instance of this class is initialised when a translator object is initialised.

__init__(parent=None, use_device=2, use_platform=0)[source]

This method intialises an instance of the Translator class. During the initialisation process, the compiled OpenCL translator kernels are assigned to the appropriate translator mixin classes.

Parameters:parent (handybeam world object) – DESCRIPTION
__repr__

Return repr(self).

__str__

Return str(self).

_register_xy_translator()

This method assigns the compiled OpenCL propagator kernel _hbk_xy_translator to this class and then sets the correct data types for the input to the assigned kernel.

_register_xyz_translator()

This method assigns the compiled OpenCL propagator kernel _hbk_xyz_translator to this class and then sets the correct data types for the input to the assigned kernel.

print_performance_feedback(cl_profiling_kernel_event, cl_profiling_mem_copy_event, t_elapsed_wall_time, ray_count, output_buffer_size)

This method …

Todo

Jurek wrote this stuff so it’s up to him to comment.

Parameters:
  • cl_profiling_kernel_event (TYPE) – DESCRIPTION
  • cl_profiling_mem_copy_event (TYPE) – DESCRIPTION
  • t_elapsed_Wall_time (TYPE) – DESCRIPTION
  • ray_count (TYPE) – DESCRIPTION
  • output_buffer_size (TYPE) – DESCRIPTION
xy_translator(tx_array: handybeam.tx_array.TxArray, x_translate, y_translate, plane_height, local_work_size=(1, 1, 1), print_performance_feedback=False)

This method translates a given focal point, created at a height plane_height, by a distance x_translate along the x-axis and y_translate along the y-axis.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – This is a handybeam tx_array class.
  • x_translate (numpy float) – This is the desired distance to translate the focal point along the x-axis.
  • y_translate (numpy float) – This is the desired distance to translate the focal point along the y-axis.
  • plane_height (numpy float) – This is the z-coordinate of the focal point position.
  • local_work_size (tuple) – Tuple containing the local work sizes for the GPU.
  • print_performance_feedback (boolean) – Boolean value determining whether or not to output the GPU performance.
xyz_translator(tx_array: handybeam.tx_array.TxArray, x_focus, y_focus, z_focus, x_translate, y_translate, z_translate, local_work_size=(1, 1, 1), print_performance_feedback=False)

This method translates a given focal point, created at a height plane_height, by a distance x_translate along the x-axis and y_translate along the y-axis.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – This is a handybeam tx_array class.
  • x_focus (numpy float) – This is the x-coordinate of the original focal point position.
  • y_focus (numpy float) – This is the y-coordinate of the original focal point position.
  • z_focus (numpy float) – This is the z-coordinate of the original focal point position.
  • x_translate (numpy float) – This is the desired distance to translate the focal point along the x-axis.
  • y_translate (numpy float) – This is the desired distance to translate the focal point along the y-axis.
  • z_translate (numpy float) – This is the desired distance to translate the focal point along the z-axis.
  • local_work_size (tuple) – Tuple containing the local work sizes for the GPU.
  • print_performance_feedback (boolean) – Boolean value determining whether or not to output the GPU performance.

Back to Welcome

Licence (documentation): Creative Commons CC BY-NC-SA 4.0

Licence (source code): Apache 2.0

EU logo

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 737087.


This project has received funding from Ultrahaptics.

Ultrahaptics logo