X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/1a6e4ad36f2b712a042007efb5184e2f34958595..f6dad6a4230bed002b51de0ec8ff34410bac27ec:/o815/o815.cpp diff --git a/o815/o815.cpp b/o815/o815.cpp index cc72a14..b68a38b 100644 --- a/o815/o815.cpp +++ b/o815/o815.cpp @@ -2,8 +2,11 @@ #include #include +#include +#ifndef MPI_DISABLED #include +#endif #include "latlib/progress.h" @@ -25,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"); @@ -112,12 +120,16 @@ void o815::postParaInit() { if(rank==0) { timestamp = time(NULL); +#ifndef MPI_DISABLED for(int idest=1; idest0) MPI_Recv(×tamp, 1, MPI_LONG, 0, 123, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - +#endif + out = new writeout(comargs.outdir, programid+headMaster(), rank, numprocs, timestamp); } @@ -284,13 +296,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()