Page MenuHomec4science

communicator_world.hh
No OneTemporary

File Metadata

Created
Sun, Jan 26, 16:06

communicator_world.hh

/**
* @file communicator_world.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Sun Sep 08 15:53:01 2013
*
* @brief This is a LM communicator representing the entire set of processors
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef WORLD_H
#define WORLD_H
__BEGIN_LIBMULTISCALE__
class WorldCommunicator : public Communicator {
public:
WorldCommunicator(){
DUMP("creating world communicateur", DBG_INFO);
rank = -1;
size = -1;
};
~WorldCommunicator(){}
UInt addGroup(UInt nb_procs){return 0;};
bool amIinGroup(CommGroup i){return true;}
MPI_Comm getMpiGroup(CommGroup i){return MPI_COMM_WORLD;};
UInt getNBprocsOnGroup(CommGroup i){if (size == -1) MPI_Comm_size(MPI_COMM_WORLD,&size); return size;};
void synchronize(CommGroup group_index){MPI_Barrier(MPI_COMM_WORLD);};
UInt realRank( UInt i, CommGroup group){if (rank == -1) MPI_Comm_rank(MPI_COMM_WORLD,&rank); return rank;};
UInt groupRank( UInt i, CommGroup group){return 0;};
bool isInGroup(UInt i , CommGroup group) {return true;};
UInt getNBGroups() {return 1;};
//Operation de communications
//si un seul proc pas de comm
void sendLocalGeometriesToGroup(Geometry & geom,CommGroup group){};
void receiveLocalGeometriesFromGroup(Geometry ** geom,CommGroup group){};
void sendCommunicationTable(std::vector<UInt> & com_with,CommGroup destgroup){};
void receiveCommunicationTable(std::vector<UInt> & com_with,CommGroup fromgroup){};
void sendUInts(CommBuffer<UInt> & d,UInt nb,UInt dest,CommGroup group,
const std::string & buf){};
void receiveUInts(CommBuffer<UInt> & d,UInt nb,UInt from,CommGroup group,
const std::string & buf){};
void sendReals(CommBuffer<Real> & d,UInt nb,UInt dest,CommGroup group,
const std::string & buf){};
void receiveReals(CommBuffer<Real> & d,UInt nb,UInt from,CommGroup group,
const std::string & buf){};
void reduceUInt(CommBuffer<UInt> & contrib,UInt nb,CommGroup group,
const std::string & buf, Operator op){};
void reduceReal(CommBuffer<Real> & contrib,UInt nb,CommGroup group,
const std::string & buf, Operator op){};
void allReduceUInt(CommBuffer<UInt> & contrib,UInt nb,CommGroup group,
const std::string & buf, Operator op){};
void allReduceReal(CommBuffer<Real> & contrib,UInt nb,CommGroup group,
const std::string & buf, Operator op){};
void waitForPendingComs(){};
protected:
int rank;
int size;
};
__END_LIBMULTISCALE__
#endif //WORLD

Event Timeline