From: secher Date: Tue, 2 Dec 2008 11:26:09 +0000 (+0000) Subject: improvement for parallel Salome component X-Git-Tag: EndIntegAG1302~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00351039bc7d3ba4cc3a0421c11e8bf1093722fd;p=tools%2Fmedcoupling.git improvement for parallel Salome component --- diff --git a/src/ParaMEDMEM/MPIProcessorGroup.cxx b/src/ParaMEDMEM/MPIProcessorGroup.cxx index 226c301d7..5eab47e12 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.cxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.cxx @@ -47,12 +47,12 @@ MPI_COMM_WORLD processor.This routine must be called by all processors in MPI_CO communication layer */ MPIProcessorGroup::MPIProcessorGroup(const CommInterface& interface): -ProcessorGroup(interface) +ProcessorGroup(interface),_world_comm(MPI_COMM_WORLD) { - _comm=MPI_COMM_WORLD; - _comm_interface.commGroup(MPI_COMM_WORLD, &_group); + _comm=_world_comm; + _comm_interface.commGroup(_world_comm, &_group); int size; - _comm_interface.commSize(MPI_COMM_WORLD,&size); + _comm_interface.commSize(_world_comm,&size); for (int i=0; i proc_ids): -ProcessorGroup(interface, proc_ids) +MPIProcessorGroup::MPIProcessorGroup(const CommInterface& interface, set proc_ids, const MPI_Comm& world_comm): + ProcessorGroup(interface, proc_ids),_world_comm(world_comm) { //Creation of a communicator MPI_Group group_world; int size_world; - _comm_interface.commSize(MPI_COMM_WORLD,&size_world); + _comm_interface.commSize(_world_comm,&size_world); int rank_world; - _comm_interface.commRank(MPI_COMM_WORLD,&rank_world); - _comm_interface.commGroup(MPI_COMM_WORLD, &group_world); + _comm_interface.commRank(_world_comm,&rank_world); + _comm_interface.commGroup(_world_comm, &group_world); int* ranks=new int[proc_ids.size()]; @@ -89,9 +89,10 @@ ProcessorGroup(interface, proc_ids) _comm_interface.groupIncl(group_world, proc_ids.size(), ranks, &_group); - _comm_interface.commCreate(MPI_COMM_WORLD, _group, &_comm); + _comm_interface.commCreate(_world_comm, _group, &_comm); delete[] ranks; } + /*! Creates a processor group that is based on the processors between \a pstart and \a pend. This routine must be called by all processors in MPI_COMM_WORLD. @@ -100,16 +101,16 @@ communication layer \param pstart id in MPI_COMM_WORLD of the first processor in the group \param pend id in MPI_COMM_WORLD of the last processor in the group */ -MPIProcessorGroup::MPIProcessorGroup (const CommInterface& comm_interface, int pstart, int pend): ProcessorGroup(comm_interface,pstart,pend) +MPIProcessorGroup::MPIProcessorGroup (const CommInterface& comm_interface, int pstart, int pend): ProcessorGroup(comm_interface,pstart,pend),_world_comm(MPI_COMM_WORLD) { //Creation of a communicator MPI_Group group_world; int size_world; - _comm_interface.commSize(MPI_COMM_WORLD,&size_world); + _comm_interface.commSize(_world_comm,&size_world); int rank_world; - _comm_interface.commRank(MPI_COMM_WORLD,&rank_world); - _comm_interface.commGroup(MPI_COMM_WORLD, &group_world); + _comm_interface.commRank(_world_comm,&rank_world); + _comm_interface.commGroup(_world_comm, &group_world); if (pend>size_world-1 || pend proc_ids) : -ProcessorGroup(proc_group.getCommInterface()) +ProcessorGroup(proc_group.getCommInterface()),_world_comm(MPI_COMM_WORLD) { cout << "MPIProcessorGroup (const ProcessorGroup& proc_group, set proc_ids)" < proc_ids); + MPIProcessorGroup(const CommInterface& interface, set proc_ids, const MPI_Comm& world_comm=MPI_COMM_WORLD); MPIProcessorGroup (const ProcessorGroup& proc_group, set proc_ids); MPIProcessorGroup(const CommInterface& interface,int pstart, int pend); virtual ~MPIProcessorGroup(); @@ -26,9 +26,11 @@ public: const MPI_Comm* getComm() const {return &_comm;} ProcessorGroup* createComplementProcGroup() const; ProcessorGroup* createProcGroup() const; + MPI_Comm getWorldComm() { return _world_comm;} private: MPI_Group _group; + const MPI_Comm _world_comm; MPI_Comm _comm; }; diff --git a/src/ParaMEDMEM/MPI_AccessDEC.cxx b/src/ParaMEDMEM/MPI_AccessDEC.cxx index c32fc310a..d725e33e6 100644 --- a/src/ParaMEDMEM/MPI_AccessDEC.cxx +++ b/src/ParaMEDMEM/MPI_AccessDEC.cxx @@ -32,8 +32,9 @@ MPI_AccessDEC::MPI_AccessDEC( const ProcessorGroup& local_group, for ( i = 0 ; i < union_group->size() ; i++ ) { procs.insert(i) ; } - _MPI_union_group = new ParaMEDMEM::MPIProcessorGroup( - union_group->getCommInterface() , procs); + MPIProcessorGroup *mpilg = (MPIProcessorGroup *)_local_group; + _MPI_union_group = new ParaMEDMEM::MPIProcessorGroup( union_group->getCommInterface() , procs, + mpilg->getWorldComm()); delete union_group ; _MyRank = _MPI_union_group->myRank() ; _GroupSize = _MPI_union_group->size() ; diff --git a/src/ParaMEDMEM/Makefile.am b/src/ParaMEDMEM/Makefile.am index 8bcb9dfc8..c990f6f75 100644 --- a/src/ParaMEDMEM/Makefile.am +++ b/src/ParaMEDMEM/Makefile.am @@ -126,6 +126,7 @@ EXTRA_DIST += \ CommInterface.cxx \ NonCoincidentDEC.cxx \ NonCoincidentDEC.hxx \ + DECOptions.hxx \ README_JR \ TODO_JR \ Topology.cxx \ No newline at end of file