Beispiel #1
0
int main(int argc, char* argv[]){

	setvbuf(stdout, NULL, _IONBF, 0);
	setvbuf(stderr, NULL, _IONBF, 0);

	#ifdef SITERUN 
		time_t stime;
		time_t etime;
		stime=time(0);
		cout<<"run TEM stand-alone - start @"<<ctime(&stime)<<"\n";

		string controlfile="";
		string chtid = "1";    /* default chtid 1 for siter-runmode  */
		if(argc == 1){   //if there is no control file specified
			controlfile ="config/controlfile_site.txt";
		} else if(argc == 2) { // if only control file specified
			controlfile = argv[1];
		} else if(argc == 3) { // both control file and chtid specified in the order
			controlfile = argv[1];
			chtid = argv[2];
		}

		Runner siter;

		siter.chtid = atoi(chtid.c_str());

		siter.initInput(controlfile, "siter");

		siter.initOutput();

 		siter.setupData();

 		siter.setupIDs();

 		siter.runmode1();
 
 		etime=time(0);
		cout <<"run TEM stand-alone - done @"<<ctime(&etime)<<"\n";
		cout <<"total seconds: "<<difftime(etime, stime)<<"\n";
	#endif

	#ifdef REGNRUN

		MPI::Init();
		int noprocs = MPI::COMM_WORLD.Get_size();
		int nthproc = MPI::COMM_WORLD.Get_rank();

		time_t stime;
		time_t etime;
		stime=time(0);

		if (nthproc == 0)
		cout <<"run TEM regionally - start @"<<ctime(&stime)<<"\n";

		string controlfile="";
		string runmode = "regner1";
		if(argc == 1){ //if there is no control file specified
			controlfile ="config/controlfile_regn.txt";
		} else if(argc == 2) {
			controlfile = argv[1];
		} else if (argc == 3) {   // both control file and runmode specified in order
			controlfile = argv[1];
			runmode     = argv[2];
		}

		Runner regner;

		regner.initInput(controlfile, runmode, nthproc);

		regner.initOutput(nthproc);

		regner.setupData();

		regner.setupIDs(noprocs);

 		if (runmode.compare("regner1")==0) {
 			regner.runmode2(nthproc);
 		} else if (runmode.compare("regner2")==0){
 			regner.runmode3(nthproc);
		} else {
			cout <<"run-mode for TEM regional run on Process: "<<nthproc <<", must be: \n";
			cout <<" EITHER 'regner1' OR 'regner2' \n";
			exit(-1);
		}

 		if (nthproc == 0) {
 			etime=time(0);
 			cout <<"run TEM regionally - done @"<<ctime(&etime)<<"\n";
 			cout <<"total seconds: "<<difftime(etime, stime)<<"\n";
 		}

		MPI::Finalize();

	#endif

	return 0;

};
Beispiel #2
0
int main(int argc, char* argv[]) {
    args->parse(argc, argv);
    if (args->getHelp()) {
        args->showHelp();
        return 0;
    }

    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);

    if (args->getMode() == "siterun") {
        time_t stime;
        time_t etime;
        stime=time(0);
        cout<<"run TEM stand-alone - start @"<<ctime(&stime)<<"\n";

        string controlfile = args->getCtrlfile();
        string chtid = args->getChtid();

        Runner siter;

        siter.chtid = atoi(chtid.c_str());

        siter.initInput(controlfile, "siter");

        siter.initOutput();

        siter.setupData();

        siter.setupIDs();

        siter.runmode1();

        etime=time(0);
        cout <<"run TEM stand-alone - done @"<<ctime(&etime)<<"\n";
        cout <<"total seconds: "<<difftime(etime, stime)<<"\n";

    } else if (args->getMode() == "regnrun") {

        time_t stime;
        time_t etime;
        stime=time(0);
        cout <<"run TEM regionally - start @"<<ctime(&stime)<<"\n";

        string controlfile = args->getCtrlfile();
        string runmode = args->getRegrunmode();

        Runner regner;

        regner.initInput(controlfile, runmode);

        regner.initOutput();

        regner.setupData();

        regner.setupIDs();

        if (runmode.compare("regner1")==0) {
            regner.runmode2();
        } else if (runmode.compare("regner2")==0) {
            regner.runmode3();
        } else {

            // Should move this to the ArgHandler class.
            cout <<"run-mode for TEM regional run must be: \n";
            cout <<" EITHER 'regner1' OR 'regner2' \n";
            exit(-1);
        }

        etime=time(0);
        cout <<"run TEM regionally - done @"<<ctime(&etime)<<"\n";
        cout <<"total seconds: "<<difftime(etime, stime)<<"\n";

    }

    return 0;

};