tfel
Loading...
Searching...
No Matches
mfront::generic_parallel::sycl::DeviceCopies Struct Reference

copies in device memory of the fields which are not accessible by the device associated with a queue. The outputs must be copied back by calling the copyOutputs method. More...

#include </home/runner/work/tfel/tfel/mfront/include/MFront/GenericParallel/SYCLDeviceCopies.hxx>

Public Member Functions

 DeviceCopies (::sycl::queue &q, const size_type n, const DataTransferPolicy p)
 constructor
 DeviceCopies (DeviceCopies &&)=delete
 DeviceCopies (const DeviceCopies &)=delete
DeviceCopies & operator= (DeviceCopies &&)=delete
DeviceCopies & operator= (const DeviceCopies &)=delete
template<typename FieldType>
void transfer (FieldType &f, const size_type size, const bool output)
 copy a field in device memory if it is not accessible by the device, and make the field refer to the copy. All the values covered by the strides of the field are copied. For an output, only the values of the field are copied back, so that the values of other outputs sharing the same memory (for example, the thermodynamic forces and the internal state variables of a point stored contiguously) are not overwritten.
template<typename ValueType>
void transfer (ValueType *&p, const size_type size, const bool output)
 copy an array in device memory if it is not accessible by the device, and make the pointer refer to the copy.
void copyOutputs ()
 copy the outputs back to their original locations, once the computations submitted to the queue are completed
bool isAccessible (const void *const p) const
bool isEnabled () const noexcept
bool holdsCopies () const noexcept
 ~DeviceCopies ()
 destructor

Detailed Description

copies in device memory of the fields which are not accessible by the device associated with a queue. The outputs must be copied back by calling the copyOutputs method.

Constructor & Destructor Documentation

◆ DeviceCopies()

mfront::generic_parallel::sycl::DeviceCopies::DeviceCopies ( ::sycl::queue & q,
const size_type n,
const DataTransferPolicy p )
inline

constructor

Parameters
[in]qqueue
[in]nnumber of points of the fields
[in]ppolicy for the transfer of the fields. With the NONE policy, no copy is made.

Member Function Documentation

◆ holdsCopies()

bool mfront::generic_parallel::sycl::DeviceCopies::holdsCopies ( ) const
inlinenodiscardnoexcept
Returns
if some arrays have been copied

◆ isAccessible()

bool mfront::generic_parallel::sycl::DeviceCopies::isAccessible ( const void *const p) const
inlinenodiscard
Returns
if the given pointer is accessible by the device: any pointer if the device is a CPU, the memory allocated by SYCL (unified shared memory) otherwise
Parameters
[in]ppointer

◆ isEnabled()

bool mfront::generic_parallel::sycl::DeviceCopies::isEnabled ( ) const
inlinenodiscardnoexcept
Returns
if the arrays which are not accessible are copied

◆ transfer() [1/2]

template<typename FieldType>
void mfront::generic_parallel::sycl::DeviceCopies::transfer ( FieldType & f,
const size_type size,
const bool output )
inline

copy a field in device memory if it is not accessible by the device, and make the field refer to the copy. All the values covered by the strides of the field are copied. For an output, only the values of the field are copied back, so that the values of other outputs sharing the same memory (for example, the thermodynamic forces and the internal state variables of a point stored contiguously) are not overwritten.

Parameters
[in,out]ffield
[in]sizenumber of components
[in]outputif true, the field is an output

◆ transfer() [2/2]

template<typename ValueType>
void mfront::generic_parallel::sycl::DeviceCopies::transfer ( ValueType *& p,
const size_type size,
const bool output )
inline

copy an array in device memory if it is not accessible by the device, and make the pointer refer to the copy.

Parameters
[in,out]ppointer to the array
[in]sizenumber of values
[in]outputif true, the array is an output

The documentation for this struct was generated from the following file: