123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /**********************************************************
-
- This software is part of J.-S. Caux's ABACUS library.
-
- Copyright (c) J.-S. Caux.
-
- -----------------------------------------------------------
-
- File: LiebLin_DSF_par_Prepare.cc
-
- Purpose: Parallel version of ABACUS using MPICH.
-
- ***********************************************************/
-
- #include "ABACUS.h"
- //#include "mpi.h" // not needed for Prepare
-
- using namespace std;
- using namespace ABACUS;
-
- int main(int argc, char *argv[])
- {
- char whichDSF;
- DP c_int, L, kBT;
- int N, iKmin, iKmax, paralevel, nr_processors_at_newlevel;
- DP target_sumrule = 1.0e+6; // effectively deactivated here
- bool refine = true; // always true for parallel mode
-
- if (argc < 10) { // provide some info
-
- cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
- cout << endl << "Usage of LiebLin_DSF_par_Prepare executable: " << endl;
- cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting "
- "serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
- cout << endl << "Provide the following arguments:" << endl << endl;
- cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: "
- "d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
- cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
- cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
- cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
- cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: "
- "recommended values: -2*N and 2*N" << endl;
- cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
- cout << "int paralevel" << endl;
- cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
- cout << "int nr_processors_at_new_level \t for this new parallelization level." << endl;
-
- return(0);
- }
-
- else { // correct nr of arguments
- int n = 1;
- whichDSF = *argv[n++];
- c_int = atof(argv[n++]);
- L = atof(argv[n++]);
- N = atoi(argv[n++]);
- iKmin = atoi(argv[n++]);
- iKmax = atoi(argv[n++]);
- kBT = atof(argv[n++]);
- paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
- if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
-
- Vect<int> rank_lower_paralevels(paralevel - 1);
- Vect<int> nr_processors_lower_paralevels(paralevel - 1);
- for (int i = 0; i < paralevel - 1; ++i) {
- rank_lower_paralevels[i] = atoi(argv[n++]);
- nr_processors_lower_paralevels[i] = atoi(argv[n++]);
- }
- nr_processors_at_newlevel = atoi(argv[n++]);
-
- string defaultScanStatename = "";
-
- // Split up thread list into chunks, one per processor
- Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename,
- paralevel, rank_lower_paralevels, nr_processors_lower_paralevels,
- nr_processors_at_newlevel);
-
- }
-
- return(0);
- }
|