VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
NullCommunicator.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32//=======================================================================================
33
34#ifndef MPI_NullCommunicator_H
35#define MPI_NullCommunicator_H
36
37#include "Communicator.h"
38
39namespace vf::parallel
40{
41
45{
46public:
47 static std::shared_ptr<Communicator> getInstance();
48
49 double Wtime() override;
50 int getBundleID() const override;
51 int getNumberOfBundles() const override;
52 int getProcessID() const override;
53 int getProcessID(int bundle, int rank) const override;
54 int getNumberOfProcesses() const override;
55 bool isRoot() const override;
56 void *getNativeCommunicator() override;
57
58 void sendSerializedObject(std::stringstream &stream, int target) override;
59 void receiveSerializedObject(std::stringstream &stream, int source) override;
60
61 int getRoot() const override;
62 int getBundleRoot() const override;
63 int getProcessRoot() const override;
64 int getNumberOfProcessesInBundle(int bundle) const override;
65 void barrier() override;
66 void abort(int errorcode) override;
67
68 std::vector<std::string> gather(const std::string &str) override;
69 std::vector<int> gather(std::vector<int> &values) override;
70 std::vector<float> gather(std::vector<float> &values) override;
71 std::vector<double> gather(std::vector<double> &values) override;
72 std::vector<unsigned long long> gather(std::vector<unsigned long long> &values) override;
73
74 void allGather(std::vector<int> &svalues, std::vector<int> &rvalues) override;
75 void allGather(std::vector<float> &svalues, std::vector<float> &rvalues) override;
76 void allGather(std::vector<double> &svalues, std::vector<double> &rvalues) override;
77 void allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues) override;
78 void allGather(std::vector<uint> &svalues, std::vector<uint> &rvalues) override;
79
80 void allReduceSum(std::vector<float>& values) override;
81 void allReduceSum(std::vector<double>& values) override;
82 void allReduceSum(std::vector<uint>& values) override;
83
84 void broadcast(int &value) override;
85 void broadcast(float &value) override;
86 void broadcast(double &value) override;
87 void broadcast(long int &value) override;
88 void broadcast(std::vector<int> &values) override;
89 void broadcast(std::vector<float> &values) override;
90 void broadcast(std::vector<double> &values) override;
91 void broadcast(std::vector<long int> &values) override;
92
94 int size_buffer_send, int neighbor_rank_send) const override;
95
96 void send(real *sbuf, int count_s, int nb_rank) const override;
97
98 double reduceSum(double quantityPerProcess) const override;
99 int mapCudaDevicesOnHosts(const std::vector<unsigned int> &devices, int numberOfDevices) const override;
100
102 int neighbor_rank) const override;
103
104 void receiveNonBlocking(real *rbuf, int count_r, int sourceRank) override;
105 void sendNonBlocking(real *sbuf, int count_s, int destinationRank) override;
106 void send(real *sbuf, int count_s, int destinationRank) override;
107 void waitAll() override;
108 void resetRequests() override;
109};
110
111} // namespace vf::parallel
112
113#endif
114
An abstract class for communication between processes in parallel computation.
A class implements Communicator for shared memory.
double reduceSum(double quantityPerProcess) const override
int getProcessRoot() const override
void allGather(std::vector< int > &svalues, std::vector< int > &rvalues) override
void broadcast(int &value) override
void sendSerializedObject(std::stringstream &stream, int target) override
static std::shared_ptr< Communicator > getInstance()
std::vector< std::string > gather(const std::string &str) override
int mapCudaDevicesOnHosts(const std::vector< unsigned int > &devices, int numberOfDevices) const override
void receiveSerializedObject(std::stringstream &stream, int source) override
void receiveNonBlocking(real *rbuf, int count_r, int sourceRank) override
void abort(int errorcode) override
int getNumberOfBundles() const override
int getNumberOfProcesses() const override
void allReduceSum(std::vector< float > &values) override
int getNumberOfProcessesInBundle(int bundle) const override
void receiveSend(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, const uint *buffer_send, int size_buffer_send, int neighbor_rank_send) const override
void sendNonBlocking(real *sbuf, int count_s, int destinationRank) override
void send(real *sbuf, int count_s, int nb_rank) const override
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
unsigned int uint
Definition DataTypes.h:47