VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
NullCommunicator.cpp
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#include "NullCommunicator.h"
35
36#include <memory>
37
38namespace vf::parallel
39{
40
41std::shared_ptr<Communicator> NullCommunicator::getInstance()
42{
43 std::lock_guard<std::mutex> myLock(instantiation_mutex);
44 if (!instance) {
45 instance = std::make_shared<NullCommunicator>();
46 }
47 return instance;
48}
50double NullCommunicator::Wtime() { return 0; }
52int NullCommunicator::getBundleID() const { return 0; }
54int NullCommunicator::getNumberOfBundles() const { return 0; }
56int NullCommunicator::getProcessID() const { return 0; }
62int NullCommunicator::getRoot() const { return 0; }
64int NullCommunicator::getBundleRoot() const { return 0; }
66int NullCommunicator::getProcessRoot() const { return 0; }
68std::vector<std::string> NullCommunicator::gather(const std::string & /*str*/) { return {}; }
70
74
75int NullCommunicator::getProcessID(int bundle, int rank) const { return 0; }
76bool NullCommunicator::isRoot() const { return true; }
77
78int NullCommunicator::getNumberOfProcessesInBundle(int bundle) const {return 0; }
81
82std::vector<int> NullCommunicator::gather(std::vector<int> &values) { return {}; }
83std::vector<float> NullCommunicator::gather(std::vector<float> &values) { return {}; }
84std::vector<double> NullCommunicator::gather(std::vector<double> &values) { return {}; }
85std::vector<unsigned long long> NullCommunicator::gather(std::vector<unsigned long long> &values) { return {}; }
86
87void NullCommunicator::allGather(std::vector<int> &svalues, std::vector<int> &rvalues){}
88void NullCommunicator::allGather(std::vector<float> &svalues, std::vector<float> &rvalues){}
89void NullCommunicator::allGather(std::vector<double> &svalues, std::vector<double> &rvalues){}
90void NullCommunicator::allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues){}
91void NullCommunicator::allGather(std::vector<uint> &svalues, std::vector<uint> &rvalues){}
92void NullCommunicator::allReduceSum(std::vector<float>& svalues) {}
93void NullCommunicator::allReduceSum(std::vector<double>& svalues) {}
94void NullCommunicator::allReduceSum(std::vector<uint>& svalues) {}
96void NullCommunicator::broadcast(float &value){}
97void NullCommunicator::broadcast(double &value){}
98void NullCommunicator::broadcast(long int &value){}
99void NullCommunicator::broadcast(std::vector<int> &values){}
100void NullCommunicator::broadcast(std::vector<float> &values){}
101void NullCommunicator::broadcast(std::vector<double> &values){}
102void NullCommunicator::broadcast(std::vector<long int> &values){}
103
106
108double NullCommunicator::reduceSum(double /*quantityPerProcess*/) const { return 0.0; };
109int NullCommunicator::mapCudaDevicesOnHosts(const std::vector<unsigned int> &devices, int numberOfDevices) const{ return 0; }
110
113
116
118
120
122} // namespace vf::parallel
123
static std::shared_ptr< Communicator > instance
static std::mutex instantiation_mutex
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