1 //////////////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2008-2020 The Regents of the University of California 4 // 5 // This file is part of Qbox 6 // 7 // Qbox is distributed under the terms of the GNU General Public License 8 // as published by the Free Software Foundation, either version 2 of 9 // the License, or (at your option) any later version. 10 // See the file COPYING in the root directory of this distribution 11 // or <http://www.gnu.org/licenses/>. 12 // 13 //////////////////////////////////////////////////////////////////////////////// 14 // 15 // MPIdata.h: 16 // 17 //////////////////////////////////////////////////////////////////////////////// 18 19 #ifndef MPIDATA_H 20 #define MPIDATA_H 21 22 #include <mpi.h> 23 class MPIdata 24 { 25 private: 26 static MPI_Comm comm_; 27 static MPI_Comm g_comm_; 28 static MPI_Comm st_comm_; 29 static MPI_Comm kp_comm_; 30 static MPI_Comm sp_comm_; 31 static MPI_Comm sd_comm_; 32 static MPI_Comm kp_sp_comm_; 33 static MPI_Comm st_kp_sp_comm_; 34 static int rank_; 35 static int size_; 36 static bool onpe0_; 37 38 static int ngb_; 39 static int nstb_; 40 static int nkpb_; 41 static int nspb_; 42 43 static int igb_; 44 static int istb_; 45 static int ikpb_; 46 static int ispb_; 47 48 static int sd_rank_; 49 static int sd_size_; 50 static int kp_sp_rank_; 51 static int kp_sp_size_; 52 static int st_kp_sp_rank_; 53 static int st_kp_sp_size_; 54 55 // private ctor 56 MPIdata(void); 57 58 public: comm(void)59 static const MPI_Comm& comm(void) { return comm_; } g_comm(void)60 static const MPI_Comm& g_comm(void) { return g_comm_; } st_comm(void)61 static const MPI_Comm& st_comm(void) { return st_comm_; } kp_comm(void)62 static const MPI_Comm& kp_comm(void) { return kp_comm_; } sp_comm(void)63 static const MPI_Comm& sp_comm(void) { return sp_comm_; } sd_comm(void)64 static const MPI_Comm& sd_comm(void) { return sd_comm_; } kp_sp_comm(void)65 static const MPI_Comm& kp_sp_comm(void) { return kp_sp_comm_; } st_kp_sp_comm(void)66 static const MPI_Comm& st_kp_sp_comm(void) { return st_kp_sp_comm_; } 67 rank(void)68 static int rank(void) { return rank_; } size(void)69 static int size(void) { return size_; } onpe0(void)70 static bool onpe0(void) { return onpe0_; } 71 ngb(void)72 static int ngb(void) { return ngb_; } nstb(void)73 static int nstb(void) { return nstb_; } nkpb(void)74 static int nkpb(void) { return nkpb_; } nspb(void)75 static int nspb(void) { return nspb_; } 76 igb(void)77 static int igb(void) { return igb_; } istb(void)78 static int istb(void) { return istb_; } ikpb(void)79 static int ikpb(void) { return ikpb_; } ispb(void)80 static int ispb(void) { return ispb_; } 81 sd_rank(void)82 static int sd_rank(void) { return sd_rank_; } sd_size(void)83 static int sd_size(void) { return sd_size_; } kp_sp_rank(void)84 static int kp_sp_rank(void) { return kp_sp_rank_; } kp_sp_size(void)85 static int kp_sp_size(void) { return kp_sp_size_; } st_kp_sp_rank(void)86 static int st_kp_sp_rank(void) { return st_kp_sp_rank_; } st_kp_sp_size(void)87 static int st_kp_sp_size(void) { return st_kp_sp_size_; } 88 89 static void set(int ngb, int nstb = 1, int nkpb = 1, int nspb = 1); 90 }; 91 #endif 92