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

Wrapper for a non-blocking block propagation send request. More...

#include <communicator.hh>

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

Public Member Functions

 SendTask (MPI_Comm comm, int tag, int rank, const std::vector< std::type_index > &fields, const std::vector< CellID > &cells, ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > &block)
 
 ~SendTask ()
 
void prepare ()
 
void send ()
 
void wait ()
 

Detailed Description

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

Wrapper for a non-blocking block propagation send request.

Definition at line 351 of file communicator.hh.

Constructor & Destructor Documentation

◆ SendTask()

template<typename T , typename DESCRIPTOR >
olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::SendTask::SendTask ( MPI_Comm comm,
int tag,
int rank,
const std::vector< std::type_index > & fields,
const std::vector< CellID > & cells,
ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > & block )
inline

Definition at line 366 of file communicator.hh.

369 :
370 _fields(block.getDataRegistry().deviceFieldArrays(fields)),
371 _onlyPopulationField(fields.size() == 1 && fields[0] == typeid(descriptors::POPULATION)),
372 _cells(cells),
373 _source(block),
374 _stream(std::make_unique<gpu::cuda::device::Stream>(cudaStreamNonBlocking))
375 {
376 std::size_t size = 0;
377 for (auto& field : fields) {
378 size += _source.getCommunicatable(field).size(cells);
379 }
380 _buffer = gpu::cuda::device::malloc<std::uint8_t>(size);
381 _request = std::make_unique<MpiSendRequest>(
382 _buffer.get(), size, rank, tag, comm);
383 }
auto & getDataRegistry()
Return reference to Data's FieldTypeRegistry.
Communicatable & getCommunicatable(std::type_index field) override
virtual std::size_t size(ConstSpan< CellID > indices) const =0

References olb::gpu::cuda::device::unique_ptr< T >::get(), olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::getCommunicatable(), and olb::Communicatable::size().

+ Here is the call graph for this function:

◆ ~SendTask()

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

Definition at line 385 of file communicator.hh.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ prepare()

template<typename T , typename DESCRIPTOR >
void olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::SendTask::prepare ( )
inline

Definition at line 391 of file communicator.hh.

392 {
393 if (_onlyPopulationField) {
394 gpu::cuda::DeviceContext<T,DESCRIPTOR> lattice(_source);
395 gpu::cuda::async_gather_field<descriptors::POPULATION>(_stream->get(), lattice, _cells, _buffer.get());
396 } else {
397 gpu::cuda::async_gather_any_fields(_stream->get(), _fields, _cells, _buffer.get());
398 }
399 }
void async_gather_any_fields(cudaStream_t stream, thrust::device_vector< AnyDeviceFieldArrayD > &fields, const thrust::device_vector< CellID > &indices, std::uint8_t *buffer)
Non-blocking gather of fields at given indices into buffer.

References olb::gpu::cuda::async_gather_any_fields(), and olb::gpu::cuda::device::unique_ptr< T >::get().

+ Here is the call graph for this function:

◆ send()

template<typename T , typename DESCRIPTOR >
void olb::ConcreteBlockCommunicator< ConcreteBlockLattice< T, DESCRIPTOR, Platform::GPU_CUDA > >::SendTask::send ( )
inline

Definition at line 401 of file communicator.hh.

402 {
403 _stream->synchronize();
404 _request->start();
405 }

◆ wait()

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

Definition at line 407 of file communicator.hh.

408 {
409 _request->wait();
410 }

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