DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::DeviceTransferable< Derived > Class Template Reference

CRTP mixin giving a class uniform to_device / to_host / device / getDeviceArrayBytes methods. More...

#include <DeviceTransferable.hpp>

Public Member Functions

void to_device (DeviceBackend B)
 Mirror every registered ArrayPair to the given device backend.
 
void to_host ()
 Pull every registered pair back to host memory.
 
DeviceBackend device ()
 Consistent device backend across all registered pairs.
 
index getDeviceArrayBytes ()
 Total footprint of every registered father+son pair in bytes.
 

Detailed Description

template<typename Derived>
class DNDS::DeviceTransferable< Derived >

CRTP mixin giving a class uniform to_device / to_host / device / getDeviceArrayBytes methods.

The derived class only has to expose its device-managed members via a for_each_device_member(F&&) method template that invokes F(m) once per MemberRef<ArrayPairType>:

template <typename F>
void for_each_device_member(F&& f)
{
for_each_member_list(device_array_list(), std::forward<F>(f));
}
void for_each_member_list(TList &&obj_member_list, F &&f)
Invoke f(member) for every element of a std::tuple of members.

Once that is in place, all four member functions below iterate every registered pair and forward the device operation.

Definition at line 35 of file DeviceTransferable.hpp.

Member Function Documentation

◆ device()

template<typename Derived >
DeviceBackend DNDS::DeviceTransferable< Derived >::device ( )
inline

Consistent device backend across all registered pairs.

Asserts that every pair's father and son live on the same backend; throws a descriptive message if not.

Definition at line 61 of file DeviceTransferable.hpp.

Here is the call graph for this function:

◆ getDeviceArrayBytes()

template<typename Derived >
index DNDS::DeviceTransferable< Derived >::getDeviceArrayBytes ( )
inline

Total footprint of every registered father+son pair in bytes.

Definition at line 94 of file DeviceTransferable.hpp.

◆ to_device()

template<typename Derived >
void DNDS::DeviceTransferable< Derived >::to_device ( DeviceBackend  B)
inline

Mirror every registered ArrayPair to the given device backend.

Definition at line 39 of file DeviceTransferable.hpp.

Here is the caller graph for this function:

◆ to_host()

template<typename Derived >
void DNDS::DeviceTransferable< Derived >::to_host ( )
inline

Pull every registered pair back to host memory.

Definition at line 49 of file DeviceTransferable.hpp.


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