コード例 #1
0
ファイル: s4u_Engine.cpp プロジェクト: simgrid/simgrid
void Engine::run()
{
  /* Clean IO before the run */
  fflush(stdout);
  fflush(stderr);

  if (MC_is_active()) {
    MC_run();
  } else {
    SIMIX_run();
  }
}
コード例 #2
0
ファイル: msg_global.cpp プロジェクト: fabienchaix/simgrid
/** \ingroup msg_simulation
 * \brief Launch the MSG simulation
 */
msg_error_t MSG_main()
{
  /* Clean IO before the run */
  fflush(stdout);
  fflush(stderr);

  if (MC_is_active()) {
    MC_run();
  } else {
    SIMIX_run();
  }
  return MSG_OK;
}
コード例 #3
0
ファイル: smpi_global.cpp プロジェクト: krytarowski/simgrid
int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
{
  srand(SMPI_RAND_SEED);

  if (getenv("SMPI_PRETEND_CC") != NULL) {
    /* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the
     * configuration tools */
    return 0;
  }
  smpi_init_logs();

  TRACE_global_init(&argc, argv);
  TRACE_add_start_function(TRACE_smpi_alloc);
  TRACE_add_end_function(TRACE_smpi_release);

  SIMIX_global_init(&argc, argv);
  MSG_init(&argc,argv);

  SMPI_switch_data_segment = smpi_switch_data_segment;

  smpi_init_options();

  // parse the platform file: get the host list
  SIMIX_create_environment(argv[1]);
  SIMIX_comm_set_copy_data_callback(&smpi_comm_copy_buffer_callback);
  SIMIX_function_register_default(realmain);
  SIMIX_launch_application(argv[2]);

  smpi_global_init();

  smpi_check_options();

  if(smpi_privatize_global_variables)
    smpi_initialize_global_memory_segments();

  /* Clean IO before the run */
  fflush(stdout);
  fflush(stderr);

  if (MC_is_active()) {
    MC_run();
  } else {
  
    SIMIX_run();

    xbt_os_walltimer_stop(global_timer);
    if (xbt_cfg_get_boolean("smpi/display-timing")){
      double global_time = xbt_os_timer_elapsed(global_timer);
      XBT_INFO("Simulated time: %g seconds. \n\n"
          "The simulation took %g seconds (after parsing and platform setup)\n"
          "%g seconds were actual computation of the application",
          SIMIX_get_clock(), global_time , smpi_total_benched_time);
          
      if (smpi_total_benched_time/global_time>=0.75)
      XBT_INFO("More than 75%% of the time was spent inside the application code.\n"
      "You may want to use sampling functions or trace replay to reduce this.");
    }
  }
  int count = smpi_process_count();
  int i, ret=0;
  for (i = 0; i < count; i++) {
    if(process_data[i]->return_value!=0){
      ret=process_data[i]->return_value;//return first non 0 value
      break;
    }
  }
  smpi_global_destroy();

  TRACE_end();

  return ret;
}
コード例 #4
0
ファイル: main_unit.cpp プロジェクト: davidchampredon/tmpGI
int main(int argc, const char * argv[]) {
	
	system("pwd");
	system("date");
	
	// For performance monitoring
	// - do not delete -
	timeval tim;
	gettimeofday(&tim, NULL);
	double t1=tim.tv_sec+(tim.tv_usec/1000000.0);
	// ------------------------------------------
	
	
	// Read the job number
	int jobnum = atoi(argv[1]);
	string fileparam = argv[2];
	
	// Read main simulation parameters from file
	

	
	double horizon			= getParameterFromFile("horizon", fileparam);
	unsigned long popSize	= getParameterFromFile("popSize", fileparam);
	double R0				= getParameterFromFile("R0", fileparam);;
	double latent_mean		= getParameterFromFile("latent_mean", fileparam);;
	double infectious_mean	= getParameterFromFile("infectious_mean", fileparam);;
	int nE					= getParameterFromFile("nE", fileparam);
	int nI					= getParameterFromFile("nI", fileparam);
	unsigned long mc_iter	= getParameterFromFile("mc_iter", fileparam);
	int njobs				= getParameterFromFile("njobs", fileparam);
	
	unsigned long initInfectious	= getParameterFromFile("init_I1", fileparam);
	bool calc_WIW_Re				= getParameterFromFile("calc_WIW_Re", fileparam);
	bool doExact					= getParameterFromFile("doExact", fileparam);
	double timeStepTauLeap			= getParameterFromFile("timeStepTauLeap", fileparam);
	
	int mc_job = int(mc_iter/njobs);
	
	
	// Derive other variables
	double sigma0	= 1/latent_mean;
	double gamma0	= 1/infectious_mean;
	double beta		= R0*gamma0;
	
	
	vector<double> sigma(nE);
	vector<double> gamma(nI);
	for (int i=0; i<nE; i++) sigma[i]=sigma0*nE;
	for (int i=0; i<nI; i++) gamma[i]=gamma0*nI;
	
	// Simulation
	
	simulator SIM(beta, sigma, gamma, popSize, nE, nI);
	
	MC_run(SIM, mc_job, horizon,initInfectious,
		   jobnum,fileparam,calc_WIW_Re,
		   doExact,timeStepTauLeap);
	
	cout<<endl<<"--- Job #"<<jobnum<<" finished!"<<endl;
	
	
	// --------------------------------------------------------------
	// COMPUTER TIME MONITORING - do not delete!
	
	gettimeofday(&tim, NULL);
	double t2=tim.tv_sec+(tim.tv_usec/1000000.0);
	
	int minutes = (int)((t2-t1)/60.0);
	double sec = (t2-t1)-minutes*60.0;
	cout << endl << " - - - Computational time : ";
	cout << minutes<<" min "<<sec<<" sec" << endl;
	
	// --------------------------------------------------------------
	
	
	
	return 0;
}