- Timestamp:
- 05/25/16 12:21:03 (8 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/policy.cpp
r833 r855 13 13 namespace xios 14 14 { 15 / *!16 Calculate MPI communicator for each level of hierarchy.17 \param[in] mpiCommRoot MPI communicator of the level 0 (usually communicator of all clients)18 \param[in] levels number of level in hierarchy19 */20 void DivideCommByTwo::computeMPICommLevel(const MPI_Comm& mpiCommRoot, int levels)21 {22 int nbProc;23 MPI_Comm_size(mpiCommRoot,&nbProc);24 if (levels > nbProc) levels = std::log10(nbProc) * 3.3219; // log2(x) = log2(10) * log10(x); stupid C++9825 else if (1 > levels) levels = 1;26 27 commLevel_.push_back(mpiCommRoot);28 divideMPICommLevel(mpiCommRoot, levels);29 }30 31 / *!32 Divide each MPI communicator into sub-communicator. Recursive function33 \param [in] mpiCommLevel MPI communicator of current level34 \param [in] level current level35 */36 void DivideCommByTwo::divideMPICommLevel(const MPI_Comm& mpiCommLevel, int level)37 {38 int clientRank;39 MPI_Comm_rank(mpiCommLevel,&clientRank);40 41 --level;42 if (0 < level)43 {44 int color = clientRank % 2;45 commLevel_.push_back(MPI_Comm());46 MPI_Comm_split(mpiCommLevel, color, 0, &(commLevel_.back()));47 divideMPICommLevel(commLevel_.back(), level);48 }49 }15 ///*! 16 // Calculate MPI communicator for each level of hierarchy. 17 // \param[in] mpiCommRoot MPI communicator of the level 0 (usually communicator of all clients) 18 // \param[in] levels number of level in hierarchy 19 //*/ 20 //void DivideCommByTwo::computeMPICommLevel(const MPI_Comm& mpiCommRoot, int levels) 21 //{ 22 // int nbProc; 23 // MPI_Comm_size(mpiCommRoot,&nbProc); 24 // if (levels > nbProc) levels = std::log10(nbProc) * 3.3219; // log2(x) = log2(10) * log10(x); stupid C++98 25 // else if (1 > levels) levels = 1; 26 // 27 // commLevel_.push_back(mpiCommRoot); 28 // divideMPICommLevel(mpiCommRoot, levels); 29 //} 30 // 31 ///*! 32 // Divide each MPI communicator into sub-communicator. Recursive function 33 // \param [in] mpiCommLevel MPI communicator of current level 34 // \param [in] level current level 35 //*/ 36 //void DivideCommByTwo::divideMPICommLevel(const MPI_Comm& mpiCommLevel, int level) 37 //{ 38 // int clientRank; 39 // MPI_Comm_rank(mpiCommLevel,&clientRank); 40 // 41 // --level; 42 // if (0 < level) 43 // { 44 // int color = clientRank % 2; 45 // commLevel_.push_back(MPI_Comm()); 46 // MPI_Comm_split(mpiCommLevel, color, 0, &(commLevel_.back())); 47 // divideMPICommLevel(commLevel_.back(), level); 48 // } 49 //} 50 50 51 51 DivideAdaptiveComm::DivideAdaptiveComm(const MPI_Comm& mpiComm) -
XIOS/trunk/src/policy.hpp
r833 r855 16 16 namespace xios 17 17 { 18 class DivideCommByTwo19 {20 protected:21 void computeMPICommLevel(const MPI_Comm& mpiCommRoot, int levels);22 23 protected:24 std::vector<MPI_Comm> commLevel_;25 private:26 // Divide MPI communicator on each level recursively27 void divideMPICommLevel(const MPI_Comm& mpiCommLevel, int level);28 };18 //class DivideCommByTwo 19 //{ 20 //protected: 21 // void computeMPICommLevel(const MPI_Comm& mpiCommRoot, int levels); 22 // 23 //protected: 24 // std::vector<MPI_Comm> commLevel_; 25 //private: 26 // // Divide MPI communicator on each level recursively 27 // void divideMPICommLevel(const MPI_Comm& mpiCommLevel, int level); 28 //}; 29 29 30 30 class DivideAdaptiveComm
Note: See TracChangeset
for help on using the changeset viewer.