ABACUS/src/EXECS/Heis_DSF_par_Wrapup.cc

77 rivejä
2.9 KiB
C++

/**********************************************************
This software is part of J.-S. Caux's C++ library.
Copyright (c) J.-S. Caux.
-----------------------------------------------------------
File: Heis_DSF_par_Prepare.cc
Purpose: Parallel version of ABACUS using MPICH.
***********************************************************/
#include "ABACUS.h"
using namespace std;
using namespace ABACUS;
int main(int argc, char *argv[])
{
char whichDSF;
DP Delta;
int N, M, 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 < 9) { // provide some info
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
cout << endl << "Usage of Heis_DSF_par_Wrapup executable: " << endl;
cout << endl << "This function wraps up an ABACUSG parallel mode run." << endl;
cout << endl << "Provide the following arguments:" << endl << endl;
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: "
"m for S- S+, z for Sz Sz, p for S+ S-." << endl;
cout << "DP Delta \t\t Value of the anisotropy: use positive real values only" << endl;
cout << "int N \t\t\t Length (number of sites) of the system: use positive even integer values only" << endl;
cout << "int M \t\t\t Number of down spins: use positive integer values between 1 and N/2" << endl;
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: "
"recommended values: 0 and N" << 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 latest parallelization level." << endl;
return(0);
}
else { // correct nr of arguments
int n = 1;
whichDSF = *argv[n++];
Delta = atof(argv[n++]);
N = atoi(argv[n++]);
M = atoi(argv[n++]);
iKmin = atoi(argv[n++]);
iKmax = atoi(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 != 9 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Wrapup.");
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
Wrapup_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, paralevel, rank_lower_paralevels,
nr_processors_lower_paralevels, nr_processors_at_newlevel);
}
return(0);
}