修改block划分,对负载高的rank所在block进行划分,添加到空rank,空rank是平移得到的
This commit is contained in:
@@ -1,92 +1,107 @@
|
||||
|
||||
#ifndef CGH_H
|
||||
#define CGH_H
|
||||
|
||||
#include <mpi.h>
|
||||
#include "MyList.h"
|
||||
#include "MPatch.h"
|
||||
#include "macrodef.h"
|
||||
#include "monitor.h"
|
||||
#include "Parallel.h"
|
||||
|
||||
class cgh
|
||||
{
|
||||
|
||||
public:
|
||||
int levels, movls, BH_num_in;
|
||||
// information of boxes
|
||||
int *grids;
|
||||
double ***bbox;
|
||||
int ***shape;
|
||||
double ***handle;
|
||||
double ***Porgls;
|
||||
double *Lt;
|
||||
|
||||
// information of Patch list
|
||||
MyList<Patch> **PatL;
|
||||
|
||||
// information of OutBdLow2Hi point list and Restrict point list
|
||||
#if (RPB == 1)
|
||||
MyList<Parallel::pointstru_bam> **bdsul, **rsul;
|
||||
#endif
|
||||
|
||||
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
||||
int mylev;
|
||||
int *start_rank, *end_rank;
|
||||
MPI_Comm *Commlev;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
int ingfs, fngfs;
|
||||
static constexpr double ratio = 0.75;
|
||||
int trfls;
|
||||
|
||||
public:
|
||||
cgh(int ingfsi, int fngfsi, int Symmetry, char *filename, int checkrun, monitor *ErrorMonitor);
|
||||
|
||||
~cgh();
|
||||
|
||||
void compose_cgh(int nprocs);
|
||||
void sethandle(monitor *ErrorMonitor);
|
||||
void checkPatchList(MyList<Patch> *PatL, bool buflog);
|
||||
void Regrid(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void Regrid_fake(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void recompose_cgh(int nprocs, bool *lev_flag,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList,
|
||||
int Symmetry, bool BB);
|
||||
void recompose_cgh_fake(int nprocs, bool *lev_flag,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList,
|
||||
int Symmetry, bool BB);
|
||||
void read_bbox(int Symmetry, char *filename);
|
||||
MyList<Patch> *construct_patchlist(int lev, int Symmetry);
|
||||
bool Interp_One_Point(MyList<var> *VarList,
|
||||
double *XX, /*input global Cartesian coordinate*/
|
||||
double *Shellf, int Symmetry);
|
||||
void recompose_cgh_Onelevel(int nprocs, int lev,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList,
|
||||
int Symmetry, bool BB);
|
||||
void Regrid_Onelevel(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void Regrid_Onelevel_aux(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void settrfls(const int lev);
|
||||
|
||||
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
||||
void construct_mylev(int nprocs);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* CGH_H */
|
||||
|
||||
#ifndef CGH_H
|
||||
#define CGH_H
|
||||
|
||||
#include <mpi.h>
|
||||
#include "MyList.h"
|
||||
#include "MPatch.h"
|
||||
#include "macrodef.h"
|
||||
#include "monitor.h"
|
||||
#include "Parallel.h"
|
||||
|
||||
class cgh
|
||||
{
|
||||
|
||||
public:
|
||||
int levels, movls, BH_num_in;
|
||||
// information of boxes
|
||||
int *grids;
|
||||
double ***bbox;
|
||||
int ***shape;
|
||||
double ***handle;
|
||||
double ***Porgls;
|
||||
double *Lt;
|
||||
|
||||
// information of Patch list
|
||||
MyList<Patch> **PatL;
|
||||
|
||||
// information of OutBdLow2Hi point list and Restrict point list
|
||||
#if (RPB == 1)
|
||||
MyList<Parallel::pointstru_bam> **bdsul, **rsul;
|
||||
#endif
|
||||
|
||||
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
||||
int mylev;
|
||||
int *start_rank, *end_rank;
|
||||
MPI_Comm *Commlev;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
int ingfs, fngfs;
|
||||
static constexpr double ratio = 0.75;
|
||||
int trfls;
|
||||
|
||||
public:
|
||||
cgh(int ingfsi, int fngfsi, int Symmetry, char *filename, int checkrun, monitor *ErrorMonitor);
|
||||
|
||||
~cgh();
|
||||
|
||||
void compose_cgh(int nprocs);
|
||||
void sethandle(monitor *ErrorMonitor);
|
||||
void checkPatchList(MyList<Patch> *PatL, bool buflog);
|
||||
void Regrid(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void Regrid_fake(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void recompose_cgh(int nprocs, bool *lev_flag,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList,
|
||||
int Symmetry, bool BB);
|
||||
void recompose_cgh_fake(int nprocs, bool *lev_flag,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList,
|
||||
int Symmetry, bool BB);
|
||||
void read_bbox(int Symmetry, char *filename);
|
||||
MyList<Patch> *construct_patchlist(int lev, int Symmetry);
|
||||
bool Interp_One_Point(MyList<var> *VarList,
|
||||
double *XX, /*input global Cartesian coordinate*/
|
||||
double *Shellf, int Symmetry);
|
||||
void recompose_cgh_Onelevel(int nprocs, int lev,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList,
|
||||
int Symmetry, bool BB);
|
||||
void Regrid_Onelevel(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void Regrid_Onelevel_aux(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
|
||||
monitor *ErrorMonitor);
|
||||
void settrfls(const int lev);
|
||||
|
||||
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
||||
void construct_mylev(int nprocs);
|
||||
#endif
|
||||
|
||||
// Load balancing support
|
||||
bool enable_load_balance; // Enable load balancing
|
||||
int load_balance_check_interval; // Check interval (in time steps)
|
||||
int current_time_step; // Current time step counter
|
||||
double *rank_interp_times; // Store interpolation times for each rank
|
||||
int *heavy_ranks; // Store heavy rank numbers
|
||||
int num_heavy_ranks; // Number of heavy ranks
|
||||
|
||||
void init_load_balance(int nprocs);
|
||||
void update_interp_time(int rank, double time);
|
||||
bool check_and_rebalance(int nprocs, int lev,
|
||||
MyList<var> *OldList, MyList<var> *StateList,
|
||||
MyList<var> *FutureList, MyList<var> *tmList,
|
||||
int Symmetry, bool BB);
|
||||
};
|
||||
|
||||
#endif /* CGH_H */
|
||||
|
||||
Reference in New Issue
Block a user