OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask Class Reference

Wrapper for a local plain-copy block communication request. More...

#include <communicator.hh>

+ Inheritance diagram for olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask:
+ Collaboration diagram for olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask:

Public Member Functions

 HomogeneousCopyTask (const std::vector< std::type_index > &fields, const std::vector< CellID > &targetCells, ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > &target, const std::vector< CellID > &sourceCells, ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > &source)
 
 ~HomogeneousCopyTask ()
 
void copy () override
 
void wait () override
 
- Public Member Functions inherited from olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::CopyTask
virtual ~CopyTask ()
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask

Wrapper for a local plain-copy block communication request.

Definition at line 530 of file communicator.hh.

Constructor & Destructor Documentation

◆ HomogeneousCopyTask()

template<typename T , typename DESCRIPTOR >
olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask::HomogeneousCopyTask ( const std::vector< std::type_index > & fields,
const std::vector< CellID > & targetCells,
ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > & target,
const std::vector< CellID > & sourceCells,
ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > & source )
inline

Definition at line 547 of file communicator.hh.

550 :
551 _sourceFields(source.getDataRegistry().deviceFieldArrays(fields)),
552 _targetFields(target.getDataRegistry().deviceFieldArrays(fields)),
553 _onlyPopulationField(fields.size() == 1 && fields[0] == typeid(descriptors::POPULATION)),
554 _targetCells(targetCells),
555 _sourceCells(sourceCells),
556 _target(target),
557 _source(source),
558 _stream(std::make_unique<gpu::cuda::device::Stream>(cudaStreamNonBlocking))
559 {
560 OLB_ASSERT(_sourceCells.size() == _targetCells.size(),
561 "Source cell count must match target cell count");
562 }
auto & getDataRegistry()
Return reference to Data's FieldTypeRegistry.
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45

References OLB_ASSERT.

◆ ~HomogeneousCopyTask()

template<typename T , typename DESCRIPTOR >
olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask::~HomogeneousCopyTask ( )
inline

Definition at line 564 of file communicator.hh.

References olb::ConcreteBlockCommunicator< BLOCK >::wait().

+ Here is the call graph for this function:

Member Function Documentation

◆ copy()

template<typename T , typename DESCRIPTOR >
void olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask::copy ( )
inlineoverridevirtual

Implements olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::CopyTask.

Definition at line 569 of file communicator.hh.

570 {
571 if (_onlyPopulationField) {
572 gpu::cuda::DeviceContext<T,DESCRIPTOR> sourceLattice(_source);
573 gpu::cuda::DeviceContext<T,DESCRIPTOR> targetLattice(_target);
574 gpu::cuda::async_copy_field<descriptors::POPULATION>(_stream->get(), sourceLattice, targetLattice, _sourceCells, _targetCells);
575 } else {
576 gpu::cuda::async_copy_any_fields(_stream->get(), _sourceFields, _targetFields, _sourceCells, _targetCells);
577 }
578 }

References olb::gpu::cuda::async_copy_any_fields().

+ Here is the call graph for this function:

◆ wait()

template<typename T , typename DESCRIPTOR >
void olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::HomogeneousCopyTask::wait ( )
inlineoverridevirtual

Implements olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::CopyTask.

Definition at line 580 of file communicator.hh.

581 {
582 _stream->synchronize();
583 }

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