Points Conversions

Provides utilities for copying data between host and device points.

Authors

Simone Balducci, Felice Pantaleo, Marco Rovere, Wahid Redjeb, Aurora Perego, Francesco Giacomini

namespace clue

Functions

template<concepts::queue TQueue, std::size_t Ndim, std::floating_point THostInput, std::floating_point TDeviceInput, concepts::device TDev>
void copyToHost(TQueue &queue, PointsHost<Ndim, THostInput> &h_points, const PointsDevice<Ndim, TDeviceInput, TDev> &d_points)

Copies the results of the clustering from the device points to the host points.

Template Parameters:
concepts::queue TQueue

The type of the queue for the device operations

std::size_t Ndim

The number of dimensions of the points

std::floating_point THostInput

The type of the input coordinates and weights for the host points

std::floating_point TDeviceInput

The type of the input coordinates and weights for the device points

concepts::device TDev

The type of device that the points are allocated on

Parameters:
TQueue &queue

The queue used for the device operations

PointsHost<Ndim, THostInput> &h_points

The points allocated on the host, where the clustering results will be saved

const PointsDevice<Ndim, TDeviceInput, TDev> &d_points

The points allocated on the device, where the clustering has been run

template<concepts::queue TQueue, std::size_t Ndim, std::floating_point TInput, concepts::device TDev>
auto copyToHost(TQueue &queue, const PointsDevice<Ndim, TInput, TDev> &d_points)

Copies the results of the clustering from the device points to the host points.

Template Parameters:
concepts::queue TQueue

The type of the queue for the device operations

std::size_t Ndim

The number of dimensions of the points

std::floating_point TInput

The type of the input coordinates and weights for the device points

concepts::device TDev

The type of device that the points are allocated on

Parameters:
TQueue &queue

The queue used for the device operations

h_points

The points allocated on the host, where the clustering results will be saved

const PointsDevice<Ndim, TInput, TDev> &d_points

The points allocated on the device, where the clustering has been run

template<concepts::queue TQueue, std::size_t Ndim, std::floating_point THostInput, std::floating_point TDeviceInput, concepts::device TDev>
void copyToHostAsync(TQueue &queue, PointsHost<Ndim, THostInput> &h_points, const PointsDevice<Ndim, TDeviceInput, TDev> &d_points)

Copies the results of the clustering from the device points to the host points.

Note

This function is asynchronous and does not block the host thread. The user must ensure that the device points remain valid until the copy operation is complete.

Template Parameters:
concepts::queue TQueue

The type of the queue for the device operations

std::size_t Ndim

The number of dimensions of the points

std::floating_point THostInput

The type of the input coordinates and weights for the host points

std::floating_point TDeviceInput

The type of the input coordinates and weights for the device points

concepts::device TDev

The type of device that the points are allocated on

Parameters:
TQueue &queue

The queue used for the device operations

PointsHost<Ndim, THostInput> &h_points

The points allocated on the host, where the clustering results will be saved

const PointsDevice<Ndim, TDeviceInput, TDev> &d_points

The points allocated on the device, where the clustering has been run

template<concepts::queue TQueue, std::size_t Ndim, std::floating_point TDeviceInput, concepts::device TDev, std::floating_point THostInput>
void copyToDevice(TQueue &queue, PointsDevice<Ndim, TDeviceInput, TDev> &d_points, const PointsHost<Ndim, THostInput> &h_points)

Copies the coordinates and weights of the points from the host to the device.

Template Parameters:
concepts::queue TQueue

The type of the queue for the device operations

std::size_t Ndim

The number of dimensions of the points

std::floating_point TDeviceInput

The type of the input coordinates and weights for the device points

concepts::device TDev

The type of device that the points are allocated on

std::floating_point THostInput

The type of the input coordinates and weights for the host points

Parameters:
TQueue &queue

The queue used for the device operations

PointsDevice<Ndim, TDeviceInput, TDev> &d_points

The empty points allocated on the device

const PointsHost<Ndim, THostInput> &h_points

The points allocated on the host, containing the points’ coordinates and weights

template<concepts::queue TQueue, std::size_t Ndim, std::floating_point TInput, concepts::device TDev>
auto copyToDevice(TQueue &queue, const PointsHost<Ndim, TInput> &h_points)

Copies the coordinates and weights of the points from the host to the device.

Template Parameters:
concepts::queue TQueue

The type of the queue for the device operations

std::size_t Ndim

The number of dimensions of the points

std::floating_point TInput

The type of the input coordinates and weights for the host points

concepts::device TDev

The type of device that the points are allocated on

Parameters:
TQueue &queue

The queue used for the device operations

d_points

The empty points allocated on the device

const PointsHost<Ndim, TInput> &h_points

The points allocated on the host, containing the points’ coordinates and weights

template<concepts::queue TQueue, std::size_t Ndim, std::floating_point TDeviceInput, concepts::device TDev, std::floating_point THostInput>
void copyToDeviceAsync(TQueue &queue, PointsDevice<Ndim, TDeviceInput, TDev> &d_points, const PointsHost<Ndim, THostInput> &h_points)

Copies the coordinates and weights of the points from the host to the device.

Note

This function is asynchronous and does not block the host thread. The user must ensure that the host points remain valid until the copy operation is complete.

Template Parameters:
concepts::queue TQueue

The type of the queue for the device operations

std::size_t Ndim

The number of dimensions of the points

std::floating_point TDeviceInput

The type of the input coordinates and weights for the device points

concepts::device TDev

The type of device that the points are allocated on

std::floating_point THostInput

The type of the input coordinates and weights for the host points

Parameters:
TQueue &queue

The queue used for the device operations

PointsDevice<Ndim, TDeviceInput, TDev> &d_points

The empty points allocated on the device

const PointsHost<Ndim, THostInput> &h_points

The points allocated on the host, containing the points’ coordinates and weights