X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/94af0f788c0a84b3494723adfa3e5ce55edc1b43..7d78a412f4cde48ce35f8f4cbe77c2a333484fa8:/o815/o815.cpp?ds=inline diff --git a/o815/o815.cpp b/o815/o815.cpp index 49b3ed8..630d680 100644 --- a/o815/o815.cpp +++ b/o815/o815.cpp @@ -2,6 +2,11 @@ #include #include +#include + +#ifndef MPI_DISABLED +#include +#endif #include "latlib/progress.h" @@ -23,9 +28,14 @@ o815::o815(int argc, char **argv, const string& _programid, comoption specOps[], comargs.idonly = false; comargs.showjobnum = false; +#ifndef MPI_DISABLED MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); +#else + numprocs = 1; + rank = 0; +#endif addComOption("lsize", required_argument, NULL, 'L', "define lattice size", "xsize:tsize"); addComOption("nmeas", required_argument, NULL, 'N', "set number of measurements", "nmeas"); @@ -87,6 +97,9 @@ o815::o815(int argc, char **argv, const string& _programid, comoption specOps[], } paraQ = new paraq(numprocs, rank); + + hypercache::addPara("lx", comargs.lsize[0]); + hypercache::addPara("lt", comargs.lsize[1]); } void o815::postParaInit() { @@ -97,18 +110,6 @@ void o815::postParaInit() { exit(0); } - if(rank==0) { - timestamp = time(NULL); - for(int idest=1; idest0) - MPI_Recv(×tamp, 1, MPI_LONG, 0, 123, MPI_COMM_WORLD, &mpiStatus); - - out = new writeout(comargs.outdir, programid+headMaster(), rank, numprocs, timestamp); -} - -void o815::mainLoop() { if( comargs.showjobnum ) { for( int i=1; i<=paraQ->getTotalJobs(); i++ ) { if( paraQ->getTotalJobs()%i == 0 ) cout << paraQ->getTotalJobs()/i << "@" << i << " "; @@ -116,7 +117,11 @@ void o815::mainLoop() { cout << endl; exit(0); } + + out = new writeout(comargs.outdir, programid+headMaster(), rank, numprocs); +} +void o815::mainLoop() { *out->log << "OBS: Starting main loop." << endl; for (vector::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) @@ -146,14 +151,14 @@ void o815::mainLoop() { hypercache::readO( (*obsit)->ocid, &readnewObs, &nequileftNewObs ); if ( readnewObs && nequileftNewObs < 0 ) { - (*obsit)->meas(true); + (*obsit)->meas(true, imeas); } else { if (!nextAlready) { Sim->nextConfig(); nextAlready = true; } - (*obsit)->meas(false); + (*obsit)->meas(false, imeas); hypercache::writeO( (*obsit)->ocid ); } @@ -279,13 +284,17 @@ string o815::headMaster() o815::~o815() { if(comargs.outdir=="") { +#ifndef MPI_DISABLED MPI_Barrier(MPI_COMM_WORLD); +#endif if(rank==0) cout << "#end" << endl << flush; } hypercache::finalize(); delete out; +#ifndef MPI_DISABLED MPI_Finalize(); +#endif } int o815::nextParas()