Example #1
0
 /*************************************************************************************************
 ** Function:				runner
 ** Description:			Runs the prime number calculation using /parallelism/ processes
 *************************************************************************************************/
float runner ( unsigned int parallelism , unsigned int upper_bound ) {
	time_t runner_start;
	time_t runner_end;
	int x;
	
	time ( &runner_start );				//begin timing of prime calculation

	x = build_threads( &sync_threads );
	
	time ( &runner_end );				//end timing of prime calculation

	return difftime ( runner_end , runner_start );
}
Example #2
0
void modelchecker_smvt::save(
  abstract_modelt &abstract_model,
  unsigned sequence)
{
  std::string out_file_name="satabs."+i2string(sequence)+".smv";

  get_variable_names(abstract_model);
  get_nondet_symbols(abstract_model);
  
  inlined.build(abstract_model);

  threadst threads;
  build_threads(threads);

  std::ofstream out(out_file_name.c_str());
  build_smv_file(abstract_model, threads, out);
}
Example #3
0
bool modelchecker_smvt::check(
  abstract_modelt &abstract_model,
  abstract_counterexamplet &counterexample)
{
  std::string temp_base="cegar_tmp";

  std::string temp_smv=temp_base+"_abstract.smv";
  std::string temp_smv_out1=temp_base+"_smv_out1";
  std::string temp_smv_out2=temp_base+"_smv_out2";
  std::string temp_smv_out_ce=temp_base+"_abstract.out";
  
  remove(temp_smv_out1.c_str());
  remove(temp_smv_out2.c_str());
  remove(temp_smv_out_ce.c_str());

  get_variable_names(abstract_model);
  get_nondet_symbols(abstract_model);
  
  inlined.build(abstract_model);

  threadst threads;
  build_threads(threads);

  {
    std::ofstream out(temp_smv.c_str());
    build_smv_file(abstract_model, threads, out);
  }

  if(!inlined.has_assertion())
  {
    status("Property holds trivially");
    return true;
  }

  {
    std::string command;

    switch(engine)
    {
    case NUSMV:
      command="NuSMV -f -dynamic";
      status(std::string("Running NuSMV: ")+command);
      break;
      
    case CMU_SMV:
      status(std::string("Running CMU SMV: ")+command);
      command="smv";
      break;

    case CADENCE_SMV:
      command="smv -force -sift";
      status(std::string("Running Cadence SMV: ")+command);
      break;

    case SATMC:
      command="satmc";
      status(std::string("Running SATMC")+command);
      break;
      
    default:
      assert(false);
    }

    command+=" "+temp_smv+" >"+temp_smv_out1+
             " 2>"+temp_smv_out2;

    {
    	print(9, "The full model checker command to be executed is:\n"+command+"\n");
    }

    int return_code = system(command.c_str());
    {
    	std::ostringstream str;
    	str << "Got return code " << return_code << std::endl;
    	print(9, str.str());
    }
  }

  bool result;

  {
    std::ifstream out1(temp_smv_out1.c_str()),
                  out2(temp_smv_out2.c_str()),
                  out_ce(temp_smv_out_ce.c_str());

    result=read_result(
      out1,
      out2,
      out_ce,
      abstract_model, threads,
      counterexample);
  }

  return result;
}