Commit 868a1b9a by Alan Mishchenko

Fixed the overflow timeout problem in bmc/bmc2/bmc3/int/pdr/sim, etc.

parent f08be274
...@@ -611,6 +611,7 @@ int Gia_ManSimSimulate( Gia_Man_t * pAig, Gia_ParSim_t * pPars ) ...@@ -611,6 +611,7 @@ int Gia_ManSimSimulate( Gia_Man_t * pAig, Gia_ParSim_t * pPars )
Gia_ManSim_t * p; Gia_ManSim_t * p;
int i, clkTotal = clock(); int i, clkTotal = clock();
int iOut, iPat, RetValue = 0; int iOut, iPat, RetValue = 0;
int nTimeToStop = pPars->TimeLimit ? pPars->TimeLimit + time(NULL) : 0;
if ( pAig->pReprs && pAig->pNexts ) if ( pAig->pReprs && pAig->pNexts )
return Gia_ManSimSimulateEquiv( pAig, pPars ); return Gia_ManSimSimulateEquiv( pAig, pPars );
ABC_FREE( pAig->pCexSeq ); ABC_FREE( pAig->pCexSeq );
...@@ -647,7 +648,7 @@ int Gia_ManSimSimulate( Gia_Man_t * pAig, Gia_ParSim_t * pPars ) ...@@ -647,7 +648,7 @@ int Gia_ManSimSimulate( Gia_Man_t * pAig, Gia_ParSim_t * pPars )
RetValue = 1; RetValue = 1;
break; break;
} }
if ( (clock() - clkTotal)/CLOCKS_PER_SEC >= pPars->TimeLimit ) if ( time(NULL) > pPars->TimeLimit )
{ {
i++; i++;
break; break;
......
...@@ -641,6 +641,7 @@ int Gia_ManSimSimulateEquiv( Gia_Man_t * pAig, Gia_ParSim_t * pPars ) ...@@ -641,6 +641,7 @@ int Gia_ManSimSimulateEquiv( Gia_Man_t * pAig, Gia_ParSim_t * pPars )
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
int i, clkTotal = clock(); int i, clkTotal = clock();
int RetValue = 0, iOut, iPat; int RetValue = 0, iOut, iPat;
int nTimeToStop = pPars->TimeLimit ? pPars->TimeLimit + time(NULL) : 0;
assert( pAig->pReprs && pAig->pNexts ); assert( pAig->pReprs && pAig->pNexts );
ABC_FREE( pAig->pCexSeq ); ABC_FREE( pAig->pCexSeq );
p = Gia_Sim2Create( pAig, pPars ); p = Gia_Sim2Create( pAig, pPars );
...@@ -681,7 +682,7 @@ int Gia_ManSimSimulateEquiv( Gia_Man_t * pAig, Gia_ParSim_t * pPars ) ...@@ -681,7 +682,7 @@ int Gia_ManSimSimulateEquiv( Gia_Man_t * pAig, Gia_ParSim_t * pPars )
} }
if ( pAig->pReprs && pAig->pNexts ) if ( pAig->pReprs && pAig->pNexts )
Gia_Sim2InfoRefineEquivs( p ); Gia_Sim2InfoRefineEquivs( p );
if ( (clock() - clkTotal)/CLOCKS_PER_SEC >= pPars->TimeLimit ) if ( time(NULL) > nTimeToStop )
{ {
i++; i++;
break; break;
......
...@@ -81,11 +81,7 @@ int Inter_ManPerformInterpolation( Aig_Man_t * pAig, Inter_ManParams_t * pPars, ...@@ -81,11 +81,7 @@ int Inter_ManPerformInterpolation( Aig_Man_t * pAig, Inter_ManParams_t * pPars,
Inter_Check_t * pCheck = NULL; Inter_Check_t * pCheck = NULL;
Aig_Man_t * pAigTemp; Aig_Man_t * pAigTemp;
int s, i, RetValue, Status, clk, clk2, clkTotal = clock(), timeTemp; int s, i, RetValue, Status, clk, clk2, clkTotal = clock(), timeTemp;
int nTimeNewOut = 0; int nTimeNewOut = pPars->nSecLimit ? time(NULL) + pPars->nSecLimit : 0;
// set runtime limit
if ( pPars->nSecLimit )
nTimeNewOut = clock() + pPars->nSecLimit * CLOCKS_PER_SEC;
// sanity checks // sanity checks
assert( Saig_ManRegNum(pAig) > 0 ); assert( Saig_ManRegNum(pAig) > 0 );
...@@ -252,7 +248,7 @@ p->timeCnf += clock() - clk; ...@@ -252,7 +248,7 @@ p->timeCnf += clock() - clk;
} }
else if ( RetValue == -1 ) else if ( RetValue == -1 )
{ {
if ( pPars->nSecLimit && clock() > nTimeNewOut ) // timed out if ( pPars->nSecLimit && time(NULL) > nTimeNewOut ) // timed out
{ {
if ( pPars->fVerbose ) if ( pPars->fVerbose )
printf( "Reached timeout (%d seconds).\n", pPars->nSecLimit ); printf( "Reached timeout (%d seconds).\n", pPars->nSecLimit );
...@@ -331,7 +327,7 @@ p->timeEqu += clock() - clk - timeTemp; ...@@ -331,7 +327,7 @@ p->timeEqu += clock() - clk - timeTemp;
Inter_CheckStop( pCheck ); Inter_CheckStop( pCheck );
return 1; return 1;
} }
if ( pPars->nSecLimit && clock() > nTimeNewOut ) if ( pPars->nSecLimit && time(NULL) > nTimeNewOut )
{ {
printf( "Reached timeout (%d seconds).\n", pPars->nSecLimit ); printf( "Reached timeout (%d seconds).\n", pPars->nSecLimit );
p->timeTotal = clock() - clkTotal; p->timeTotal = clock() - clkTotal;
......
...@@ -586,10 +586,7 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo ...@@ -586,10 +586,7 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
int nThreshold = 10000; int nThreshold = 10000;
// compute time to stop // compute time to stop
if ( p->pPars->TimeLimit ) p->pPars->TimeTarget = p->pPars->TimeLimit ? time(NULL) + p->pPars->TimeLimit : 0;
p->pPars->TimeTarget = clock() + p->pPars->TimeLimit * CLOCKS_PER_SEC;
else
p->pPars->TimeTarget = 0;
// define variable limits // define variable limits
Llb_ManPrepareVarLimits( p ); Llb_ManPrepareVarLimits( p );
...@@ -660,7 +657,7 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo ...@@ -660,7 +657,7 @@ int Llb_ManReachability( Llb_Man_t * p, Vec_Int_t * vHints, DdManager ** pddGlo
{ {
clk2 = clock(); clk2 = clock();
// check the runtime limit // check the runtime limit
if ( p->pPars->TimeLimit && clock() >= p->pPars->TimeTarget ) if ( p->pPars->TimeLimit && time(NULL) > p->pPars->TimeTarget )
{ {
if ( !p->pPars->fSilent ) if ( !p->pPars->fSilent )
printf( "Reached timeout during image computation (%d seconds).\n", p->pPars->TimeLimit ); printf( "Reached timeout during image computation (%d seconds).\n", p->pPars->TimeLimit );
......
...@@ -218,7 +218,7 @@ int Llb_CoreReachability_int( Llb_Img_t * p, Vec_Ptr_t * vQuant0, Vec_Ptr_t * vQ ...@@ -218,7 +218,7 @@ int Llb_CoreReachability_int( Llb_Img_t * p, Vec_Ptr_t * vQuant0, Vec_Ptr_t * vQ
p->pPars->TimeTarget = 0; p->pPars->TimeTarget = 0;
*/ */
if ( p->pPars->TimeLimit && clock() >= p->pPars->TimeTarget ) if ( time(NULL) > p->pPars->TimeTarget )
{ {
if ( !p->pPars->fSilent ) if ( !p->pPars->fSilent )
printf( "Reached timeout (%d seconds) before image computation.\n", p->pPars->TimeLimit ); printf( "Reached timeout (%d seconds) before image computation.\n", p->pPars->TimeLimit );
...@@ -286,7 +286,7 @@ int Llb_CoreReachability_int( Llb_Img_t * p, Vec_Ptr_t * vQuant0, Vec_Ptr_t * vQ ...@@ -286,7 +286,7 @@ int Llb_CoreReachability_int( Llb_Img_t * p, Vec_Ptr_t * vQuant0, Vec_Ptr_t * vQ
{ {
clk2 = clock(); clk2 = clock();
// check the runtime limit // check the runtime limit
if ( p->pPars->TimeLimit && clock() >= p->pPars->TimeTarget ) if ( p->pPars->TimeLimit && time(NULL) > p->pPars->TimeTarget )
{ {
if ( !p->pPars->fSilent ) if ( !p->pPars->fSilent )
printf( "Reached timeout (%d seconds) during image computation.\n", p->pPars->TimeLimit ); printf( "Reached timeout (%d seconds) during image computation.\n", p->pPars->TimeLimit );
...@@ -729,10 +729,7 @@ int Llb_ManReachMinCut( Aig_Man_t * pAig, Gia_ParLlb_t * pPars ) ...@@ -729,10 +729,7 @@ int Llb_ManReachMinCut( Aig_Man_t * pAig, Gia_ParLlb_t * pPars )
int clk = clock(); int clk = clock();
// compute time to stop // compute time to stop
if ( pPars->TimeLimit ) pPars->TimeTarget = pPars->TimeLimit ? time(NULL) + pPars->TimeLimit : 0;
pPars->TimeTarget = clock() + pPars->TimeLimit * CLOCKS_PER_SEC;
else
pPars->TimeTarget = 0;
p = Aig_ManDupFlopsOnly( pAig ); p = Aig_ManDupFlopsOnly( pAig );
//Aig_ManShow( p, 0, NULL ); //Aig_ManShow( p, 0, NULL );
...@@ -744,7 +741,7 @@ int Llb_ManReachMinCut( Aig_Man_t * pAig, Gia_ParLlb_t * pPars ) ...@@ -744,7 +741,7 @@ int Llb_ManReachMinCut( Aig_Man_t * pAig, Gia_ParLlb_t * pPars )
vResult = Llb_ManComputeCuts( p, pPars->nPartValue, pPars->fVerbose, pPars->fVeryVerbose ); vResult = Llb_ManComputeCuts( p, pPars->nPartValue, pPars->fVerbose, pPars->fVeryVerbose );
if ( pPars->TimeLimit && clock() >= pPars->TimeTarget ) if ( pPars->TimeLimit && time(NULL) > pPars->TimeTarget )
{ {
if ( !pPars->fSilent ) if ( !pPars->fSilent )
printf( "Reached timeout (%d seconds) after partitioning.\n", pPars->TimeLimit ); printf( "Reached timeout (%d seconds) after partitioning.\n", pPars->TimeLimit );
......
...@@ -433,10 +433,8 @@ int Llb_NonlinReachability( Llb_Mnn_t * p ) ...@@ -433,10 +433,8 @@ int Llb_NonlinReachability( Llb_Mnn_t * p )
assert( Aig_ManRegNum(p->pAig) > 0 ); assert( Aig_ManRegNum(p->pAig) > 0 );
// compute time to stop // compute time to stop
if ( p->pPars->TimeLimit ) p->pPars->TimeTarget = p->pPars->TimeLimit ? time(NULL) + p->pPars->TimeLimit : 0;
p->pPars->TimeTarget = clock() + p->pPars->TimeLimit * CLOCKS_PER_SEC;
else
p->pPars->TimeTarget = 0;
// set the stop time parameter // set the stop time parameter
p->dd->TimeStop = p->pPars->TimeTarget; p->dd->TimeStop = p->pPars->TimeTarget;
p->ddG->TimeStop = p->pPars->TimeTarget; p->ddG->TimeStop = p->pPars->TimeTarget;
...@@ -474,7 +472,7 @@ int Llb_NonlinReachability( Llb_Mnn_t * p ) ...@@ -474,7 +472,7 @@ int Llb_NonlinReachability( Llb_Mnn_t * p )
{ {
// check the runtime limit // check the runtime limit
clk2 = clock(); clk2 = clock();
if ( p->pPars->TimeLimit && clock() >= p->pPars->TimeTarget ) if ( p->pPars->TimeLimit && time(NULL) > p->pPars->TimeTarget )
{ {
if ( !p->pPars->fSilent ) if ( !p->pPars->fSilent )
printf( "Reached timeout (%d seconds) during image computation.\n", p->pPars->TimeLimit ); printf( "Reached timeout (%d seconds) during image computation.\n", p->pPars->TimeLimit );
......
...@@ -725,7 +725,7 @@ int Llb_Nonlin4Reachability( Llb_Mnx_t * p ) ...@@ -725,7 +725,7 @@ int Llb_Nonlin4Reachability( Llb_Mnx_t * p )
{ {
clkIter = clock(); clkIter = clock();
// check the runtime limit // check the runtime limit
if ( p->pPars->TimeLimit && clock() >= p->pPars->TimeTarget ) if ( p->pPars->TimeLimit && time(NULL) > p->pPars->TimeTarget )
{ {
if ( !p->pPars->fSilent ) if ( !p->pPars->fSilent )
printf( "Reached timeout (%d seconds) during image computation.\n", p->pPars->TimeLimit ); printf( "Reached timeout (%d seconds) during image computation.\n", p->pPars->TimeLimit );
...@@ -929,10 +929,8 @@ Llb_Mnx_t * Llb_MnxStart( Aig_Man_t * pAig, Gia_ParLlb_t * pPars ) ...@@ -929,10 +929,8 @@ Llb_Mnx_t * Llb_MnxStart( Aig_Man_t * pAig, Gia_ParLlb_t * pPars )
p->pPars = pPars; p->pPars = pPars;
// compute time to stop // compute time to stop
if ( p->pPars->TimeLimit ) p->pPars->TimeTarget = p->pPars->TimeLimit ? time(NULL) + p->pPars->TimeLimit : 0;
p->pPars->TimeTarget = clock() + p->pPars->TimeLimit * CLOCKS_PER_SEC;
else
p->pPars->TimeTarget = 0;
if ( pPars->fCluster ) if ( pPars->fCluster )
{ {
// Llb_Nonlin4Cluster( p->pAig, &p->dd, &p->vOrder, &p->vRoots, pPars->nBddMax, pPars->fVerbose ); // Llb_Nonlin4Cluster( p->pAig, &p->dd, &p->vOrder, &p->vRoots, pPars->nBddMax, pPars->fVerbose );
......
...@@ -254,6 +254,7 @@ Vec_Int_t * Saig_ManPbaDerive( Aig_Man_t * pAig, int nInputs, int nStart, int nF ...@@ -254,6 +254,7 @@ Vec_Int_t * Saig_ManPbaDerive( Aig_Man_t * pAig, int nInputs, int nStart, int nF
sat_solver * pSat; sat_solver * pSat;
Cnf_Dat_t * pCnf; Cnf_Dat_t * pCnf;
Aig_Obj_t * pObj; Aig_Obj_t * pObj;
int nTimeToStop = time(NULL) + TimeLimit;
int nCoreLits, * pCoreLits; int nCoreLits, * pCoreLits;
int i, iVar, RetValue, clk; int i, iVar, RetValue, clk;
if ( fVerbose ) if ( fVerbose )
...@@ -295,7 +296,7 @@ Abc_PrintTime( 1, "Preparing", clock() - clk ); ...@@ -295,7 +296,7 @@ Abc_PrintTime( 1, "Preparing", clock() - clk );
// set runtime limit // set runtime limit
if ( TimeLimit ) if ( TimeLimit )
sat_solver_set_runtime_limit( pSat, clock() + TimeLimit * CLOCKS_PER_SEC ); sat_solver_set_runtime_limit( pSat, nTimeToStop );
// run SAT solver // run SAT solver
clk = clock(); clk = clock();
......
...@@ -750,6 +750,7 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax ...@@ -750,6 +750,7 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax
Saig_Bmc_t * p; Saig_Bmc_t * p;
Aig_Man_t * pNew; Aig_Man_t * pNew;
Cnf_Dat_t * pCnf; Cnf_Dat_t * pCnf;
int nTimeToStop = time(NULL) + nTimeOut;
int nOutsSolved = 0; int nOutsSolved = 0;
int Iter, RetValue = -1, clk = clock(), clk2, clkTotal = clock(); int Iter, RetValue = -1, clk = clock(), clk2, clkTotal = clock();
int Status = -1; int Status = -1;
...@@ -769,7 +770,7 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax ...@@ -769,7 +770,7 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax
} }
// set runtime limit // set runtime limit
if ( nTimeOut ) if ( nTimeOut )
sat_solver_set_runtime_limit( p->pSat, clock() + nTimeOut * CLOCKS_PER_SEC ); sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
for ( Iter = 0; ; Iter++ ) for ( Iter = 0; ; Iter++ )
{ {
clk2 = clock(); clk2 = clock();
...@@ -800,7 +801,7 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax ...@@ -800,7 +801,7 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax
if ( RetValue != l_False ) if ( RetValue != l_False )
break; break;
// check the timeout // check the timeout
if ( nTimeOut && ((float)nTimeOut <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( nTimeOut && time(NULL) > nTimeToStop )
{ {
printf( "Reached timeout (%d seconds).\n", nTimeOut ); printf( "Reached timeout (%d seconds).\n", nTimeOut );
if ( piFrames ) if ( piFrames )
...@@ -843,10 +844,10 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax ...@@ -843,10 +844,10 @@ int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax
printf( "Reached limit on the number of timeframes (%d).\n", p->nFramesMax ); printf( "Reached limit on the number of timeframes (%d).\n", p->nFramesMax );
else if ( p->nConfMaxAll && p->pSat->stats.conflicts > p->nConfMaxAll ) else if ( p->nConfMaxAll && p->pSat->stats.conflicts > p->nConfMaxAll )
printf( "Reached global conflict limit (%d).\n", p->nConfMaxAll ); printf( "Reached global conflict limit (%d).\n", p->nConfMaxAll );
else if ( nTimeOut == 0 || nTimeOut > clock() ) else if ( nTimeOut && time(NULL) > nTimeToStop )
printf( "Reached local conflict limit (%d).\n", p->nConfMaxOne ); printf( "Reached timeout (%d seconds).\n", nTimeOut );
else else
printf( "Reached timeout (%d sec).\n", nTimeOut ); printf( "Reached local conflict limit (%d).\n", p->nConfMaxOne );
} }
Saig_BmcManStop( p ); Saig_BmcManStop( p );
return Status; return Status;
......
...@@ -1102,6 +1102,7 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars ) ...@@ -1102,6 +1102,7 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars )
int RetValue = -1, fFirst = 1, nJumpFrame = 0, fUnfinished = 0; int RetValue = -1, fFirst = 1, nJumpFrame = 0, fUnfinished = 0;
int nOutDigits = Aig_Base10Log( Saig_ManPoNum(pAig) - Saig_ManConstrNum(pAig) ); int nOutDigits = Aig_Base10Log( Saig_ManPoNum(pAig) - Saig_ManConstrNum(pAig) );
int i, f, Lit, status, clk, clk2, clkOther = 0, clkTotal = clock(); int i, f, Lit, status, clk, clk2, clkOther = 0, clkTotal = clock();
int nTimeToStop = time(NULL) + pPars->nTimeOut;
if ( pPars->fVerbose && Aig_ManConstrNum(pAig) > 0 ) if ( pPars->fVerbose && Aig_ManConstrNum(pAig) > 0 )
printf( "Performing BMC with constraints...\n" ); printf( "Performing BMC with constraints...\n" );
p = Saig_Bmc3ManStart( pAig ); p = Saig_Bmc3ManStart( pAig );
...@@ -1116,7 +1117,7 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars ) ...@@ -1116,7 +1117,7 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars )
} }
// set runtime limit // set runtime limit
if ( p->pPars->nTimeOut ) if ( p->pPars->nTimeOut )
sat_solver_set_runtime_limit( p->pSat, clock() + p->pPars->nTimeOut * CLOCKS_PER_SEC ); sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
// perform frames // perform frames
Aig_ManRandom( 1 ); Aig_ManRandom( 1 );
Saig_ManBmcMarkPis( pAig, pPars->nPisAbstract ); Saig_ManBmcMarkPis( pAig, pPars->nPisAbstract );
...@@ -1264,7 +1265,7 @@ clkOther += clock() - clk2; ...@@ -1264,7 +1265,7 @@ clkOther += clock() - clk2;
else else
{ {
assert( status == l_Undef ); assert( status == l_Undef );
if ( pPars->nTimeOut && ((float)pPars->nTimeOut <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( pPars->nTimeOut && time(NULL) > nTimeToStop )
{ {
printf( "Reached timeout (%d seconds).\n", pPars->nTimeOut ); printf( "Reached timeout (%d seconds).\n", pPars->nTimeOut );
Saig_Bmc3ManStop( p ); Saig_Bmc3ManStop( p );
...@@ -1280,7 +1281,7 @@ clkOther += clock() - clk2; ...@@ -1280,7 +1281,7 @@ clkOther += clock() - clk2;
Saig_Bmc3ManStop( p ); Saig_Bmc3ManStop( p );
return RetValue; return RetValue;
} }
if ( pPars->nTimeOut && ((float)pPars->nTimeOut <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( pPars->nTimeOut && time(NULL) > nTimeToStop )
{ {
printf( "Reached timeout (%d seconds).\n", pPars->nTimeOut ); printf( "Reached timeout (%d seconds).\n", pPars->nTimeOut );
Saig_Bmc3ManStop( p ); Saig_Bmc3ManStop( p );
......
...@@ -686,6 +686,7 @@ Vec_Int_t * Aig_Gla1ManTest( Aig_Man_t * pAig, Vec_Int_t * vGateClassesOld, int ...@@ -686,6 +686,7 @@ Vec_Int_t * Aig_Gla1ManTest( Aig_Man_t * pAig, Vec_Int_t * vGateClassesOld, int
Vec_Int_t * vPPiRefine; Vec_Int_t * vPPiRefine;
int f, g, r, i, iSatVar, Lit, Entry, RetValue; int f, g, r, i, iSatVar, Lit, Entry, RetValue;
int nConfBef, nConfAft, clk, clkTotal = clock(); int nConfBef, nConfAft, clk, clkTotal = clock();
int nTimeToStop = time(NULL) + TimeLimit;
assert( Saig_ManPoNum(pAig) == 1 ); assert( Saig_ManPoNum(pAig) == 1 );
if ( nFramesMax == 0 ) if ( nFramesMax == 0 )
...@@ -711,7 +712,7 @@ Vec_Int_t * Aig_Gla1ManTest( Aig_Man_t * pAig, Vec_Int_t * vGateClassesOld, int ...@@ -711,7 +712,7 @@ Vec_Int_t * Aig_Gla1ManTest( Aig_Man_t * pAig, Vec_Int_t * vGateClassesOld, int
// set runtime limit // set runtime limit
if ( TimeLimit ) if ( TimeLimit )
sat_solver_set_runtime_limit( p->pSat, clock() + TimeLimit * CLOCKS_PER_SEC ); sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
// iterate over the timeframes // iterate over the timeframes
for ( f = 0; f < nFramesMax; f++ ) for ( f = 0; f < nFramesMax; f++ )
...@@ -750,7 +751,7 @@ Vec_Int_t * Aig_Gla1ManTest( Aig_Man_t * pAig, Vec_Int_t * vGateClassesOld, int ...@@ -750,7 +751,7 @@ Vec_Int_t * Aig_Gla1ManTest( Aig_Man_t * pAig, Vec_Int_t * vGateClassesOld, int
printf( "== %3d ==", f ); printf( "== %3d ==", f );
else else
printf( " " ); printf( " " );
if ( TimeLimit && clock() > clkTotal + TimeLimit * CLOCKS_PER_SEC ) if ( TimeLimit && time(NULL) > nTimeToStop )
printf( " SAT solver timed out after %d seconds.\n", TimeLimit ); printf( " SAT solver timed out after %d seconds.\n", TimeLimit );
else if ( RetValue != l_False ) else if ( RetValue != l_False )
printf( " SAT solver returned UNDECIDED after %5d conflicts.\n", nConfAft - nConfBef ); printf( " SAT solver returned UNDECIDED after %5d conflicts.\n", nConfAft - nConfBef );
......
...@@ -465,13 +465,30 @@ Vec_Int_t * Aig_Gla2ManCollect( Aig_Gla2Man_t * p, Vec_Int_t * vCore ) ...@@ -465,13 +465,30 @@ Vec_Int_t * Aig_Gla2ManCollect( Aig_Gla2Man_t * p, Vec_Int_t * vCore )
continue; continue;
assert( Saig_ObjIsLo(p->pAig, pObj) || Aig_ObjIsNode(pObj) ); assert( Saig_ObjIsLo(p->pAig, pObj) || Aig_ObjIsNode(pObj) );
Vec_IntWriteEntry( vResult, Aig_ObjId(pObj), 1 ); Vec_IntWriteEntry( vResult, Aig_ObjId(pObj), 1 );
/*
// add flop inputs with multiple fanouts
if ( Saig_ObjIsLo(p->pAig, pObj) )
{
Aig_Obj_t * pObjLi = Saig_ObjLoToLi(p->pAig, pObj);
if ( !Saig_ObjIsPi(p->pAig, Aig_ObjFanin0(pObjLi)) )
// if ( Aig_ObjRefs( Aig_ObjFanin0(pObjLi) ) > 1 )
Vec_IntWriteEntry( vResult, Aig_ObjFaninId0(pObjLi), 1 );
}
else
{
if ( !Saig_ObjIsPi(p->pAig, Aig_ObjFanin0(pObj)) )
Vec_IntWriteEntry( vResult, Aig_ObjFaninId0(pObj), 1 );
if ( !Saig_ObjIsPi(p->pAig, Aig_ObjFanin1(pObj)) )
Vec_IntWriteEntry( vResult, Aig_ObjFaninId1(pObj), 1 );
}
*/
if ( p->vVec2Use ) if ( p->vVec2Use )
{ {
iVecId = Vec_IntEntry( p->vObj2Vec, Aig_ObjId(pObj) ); iVecId = Vec_IntEntry( p->vObj2Vec, Aig_ObjId(pObj) );
Vec_IntWriteEntry( p->vVec2Use, iVecId * p->nFramesMax + Vec_IntEntry(p->vCla2Fra, ClaId), 1 ); Vec_IntWriteEntry( p->vVec2Use, iVecId * p->nFramesMax + Vec_IntEntry(p->vCla2Fra, ClaId), 1 );
} }
} }
// printf( "Number of entries %d\n", Vec_IntCountPositive(vResult) );
// count the number of objects in each frame // count the number of objects in each frame
if ( p->vVec2Use ) if ( p->vVec2Use )
...@@ -508,6 +525,7 @@ Vec_Int_t * Aig_Gla2ManTest( Aig_Man_t * pAig, int nStart, int nFramesMax, int n ...@@ -508,6 +525,7 @@ Vec_Int_t * Aig_Gla2ManTest( Aig_Man_t * pAig, int nStart, int nFramesMax, int n
Aig_Gla2Man_t * p; Aig_Gla2Man_t * p;
Vec_Int_t * vCore, * vResult; Vec_Int_t * vCore, * vResult;
int clk, clkTotal = clock(); int clk, clkTotal = clock();
int nTimeToStop = time(NULL) + TimeLimit;
assert( Saig_ManPoNum(pAig) == 1 ); assert( Saig_ManPoNum(pAig) == 1 );
if ( fVerbose ) if ( fVerbose )
...@@ -531,7 +549,7 @@ Vec_Int_t * Aig_Gla2ManTest( Aig_Man_t * pAig, int nStart, int nFramesMax, int n ...@@ -531,7 +549,7 @@ Vec_Int_t * Aig_Gla2ManTest( Aig_Man_t * pAig, int nStart, int nFramesMax, int n
// set runtime limit // set runtime limit
if ( TimeLimit ) if ( TimeLimit )
sat_solver_set_runtime_limit( p->pSat, clock() + TimeLimit * CLOCKS_PER_SEC ); sat_solver_set_runtime_limit( p->pSat, nTimeToStop );
// compute UNSAT core // compute UNSAT core
clk = clock(); clk = clock();
......
...@@ -383,6 +383,7 @@ void Ssw_SignalFilter( Aig_Man_t * pAig, int nFramesMax, int nConfMax, int nRoun ...@@ -383,6 +383,7 @@ void Ssw_SignalFilter( Aig_Man_t * pAig, int nFramesMax, int nConfMax, int nRoun
Ssw_Pars_t Pars, * pPars = &Pars; Ssw_Pars_t Pars, * pPars = &Pars;
Ssw_Man_t * p; Ssw_Man_t * p;
int r, TimeLimitPart, clkTotal = clock(); int r, TimeLimitPart, clkTotal = clock();
int nTimeToStop = TimeLimit ? TimeLimit + time(NULL) : 0;
assert( Aig_ManRegNum(pAig) > 0 ); assert( Aig_ManRegNum(pAig) > 0 );
assert( Aig_ManConstrNum(pAig) == 0 ); assert( Aig_ManConstrNum(pAig) == 0 );
// consider the case of empty AIG // consider the case of empty AIG
...@@ -428,7 +429,7 @@ void Ssw_SignalFilter( Aig_Man_t * pAig, int nFramesMax, int nConfMax, int nRoun ...@@ -428,7 +429,7 @@ void Ssw_SignalFilter( Aig_Man_t * pAig, int nFramesMax, int nConfMax, int nRoun
Ssw_ClassesPrint( p->ppClasses, 0 ); Ssw_ClassesPrint( p->ppClasses, 0 );
} }
p->pMSat = Ssw_SatStart( 0 ); p->pMSat = Ssw_SatStart( 0 );
TimeLimitPart = TimeLimit ? TimeLimit - (int)((float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) : 0; TimeLimitPart = TimeLimit ? nTimeToStop - time(NULL) : 0;
if ( TimeLimit2 ) if ( TimeLimit2 )
{ {
if ( TimeLimitPart ) if ( TimeLimitPart )
...@@ -443,7 +444,7 @@ void Ssw_SignalFilter( Aig_Man_t * pAig, int nFramesMax, int nConfMax, int nRoun ...@@ -443,7 +444,7 @@ void Ssw_SignalFilter( Aig_Man_t * pAig, int nFramesMax, int nConfMax, int nRoun
// simulate pattern forward // simulate pattern forward
Ssw_ManRollForward( p, p->pPars->nFramesK ); Ssw_ManRollForward( p, p->pPars->nFramesK );
// check timeout // check timeout
if ( TimeLimit && ((float)TimeLimit <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( TimeLimit && time(NULL) > nTimeToStop )
{ {
printf( "Reached timeout (%d seconds).\n", TimeLimit ); printf( "Reached timeout (%d seconds).\n", TimeLimit );
break; break;
......
...@@ -895,6 +895,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in ...@@ -895,6 +895,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in
int fMiter = 1; int fMiter = 1;
Ssw_RarMan_t * p; Ssw_RarMan_t * p;
int r, f, clk, clkTotal = clock(); int r, f, clk, clkTotal = clock();
int nTimeToStop = time(NULL) + TimeOut;
int RetValue = -1; int RetValue = -1;
assert( Aig_ManRegNum(pAig) > 0 ); assert( Aig_ManRegNum(pAig) > 0 );
assert( Aig_ManConstrNum(pAig) == 0 ); assert( Aig_ManConstrNum(pAig) == 0 );
...@@ -933,7 +934,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in ...@@ -933,7 +934,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in
goto finish; goto finish;
} }
// check timeout // check timeout
if ( TimeOut && ((float)TimeOut <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( TimeOut && time(NULL) > nTimeToStop )
{ {
if ( fVerbose ) printf( "\n" ); if ( fVerbose ) printf( "\n" );
printf( "Reached timeout (%d seconds).\n", TimeOut ); printf( "Reached timeout (%d seconds).\n", TimeOut );
...@@ -1002,6 +1003,7 @@ int Ssw_RarSignalFilter( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize ...@@ -1002,6 +1003,7 @@ int Ssw_RarSignalFilter( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize
{ {
Ssw_RarMan_t * p; Ssw_RarMan_t * p;
int r, f, i, k, clkTotal = clock(); int r, f, i, k, clkTotal = clock();
int nTimeToStop = time(NULL) + TimeOut;
int RetValue = -1; int RetValue = -1;
assert( Aig_ManRegNum(pAig) > 0 ); assert( Aig_ManRegNum(pAig) > 0 );
assert( Aig_ManConstrNum(pAig) == 0 ); assert( Aig_ManConstrNum(pAig) == 0 );
...@@ -1071,7 +1073,7 @@ int Ssw_RarSignalFilter( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize ...@@ -1071,7 +1073,7 @@ int Ssw_RarSignalFilter( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize
goto finish; goto finish;
} }
// check timeout // check timeout
if ( TimeOut && ((float)TimeOut <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( TimeOut && time(NULL) > nTimeToStop )
{ {
if ( fVerbose ) printf( "\n" ); if ( fVerbose ) printf( "\n" );
printf( "Reached timeout (%d seconds).\n", TimeOut ); printf( "Reached timeout (%d seconds).\n", TimeOut );
......
...@@ -309,6 +309,7 @@ int Ssw_RarSimulate2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, i ...@@ -309,6 +309,7 @@ int Ssw_RarSimulate2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, i
int fMiter = 1; int fMiter = 1;
Ssw_RarMan_t * p; Ssw_RarMan_t * p;
int r, clk, clkTotal = clock(); int r, clk, clkTotal = clock();
int nTimeToStop = time(NULL) + TimeOut;
int RetValue = -1; int RetValue = -1;
assert( Aig_ManRegNum(pAig) > 0 ); assert( Aig_ManRegNum(pAig) > 0 );
assert( Aig_ManConstrNum(pAig) == 0 ); assert( Aig_ManConstrNum(pAig) == 0 );
...@@ -351,7 +352,7 @@ int Ssw_RarSimulate2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, i ...@@ -351,7 +352,7 @@ int Ssw_RarSimulate2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, i
printf( "." ); printf( "." );
} }
// check timeout // check timeout
if ( TimeOut && ((float)TimeOut <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( TimeOut && time(NULL) > nTimeToStop )
{ {
if ( fVerbose ) printf( "\n" ); if ( fVerbose ) printf( "\n" );
printf( "Reached timeout (%d seconds).\n", TimeOut ); printf( "Reached timeout (%d seconds).\n", TimeOut );
...@@ -386,6 +387,7 @@ int Ssw_RarSignalFilter2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSiz ...@@ -386,6 +387,7 @@ int Ssw_RarSignalFilter2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSiz
int fMiter = 0; int fMiter = 0;
Ssw_RarMan_t * p; Ssw_RarMan_t * p;
int r, i, k, clkTotal = clock(); int r, i, k, clkTotal = clock();
int nTimeToStop = time(NULL) + TimeOut;
int RetValue = -1; int RetValue = -1;
assert( Aig_ManRegNum(pAig) > 0 ); assert( Aig_ManRegNum(pAig) > 0 );
assert( Aig_ManConstrNum(pAig) == 0 ); assert( Aig_ManConstrNum(pAig) == 0 );
...@@ -458,7 +460,7 @@ int Ssw_RarSignalFilter2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSiz ...@@ -458,7 +460,7 @@ int Ssw_RarSignalFilter2( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSiz
Ssw_RarTransferPatterns( p, p->vInits ); Ssw_RarTransferPatterns( p, p->vInits );
Ssw_SmlInitializeSpecial( p->pSml, p->vInits ); Ssw_SmlInitializeSpecial( p->pSml, p->vInits );
// check timeout // check timeout
if ( TimeOut && ((float)TimeOut <= (float)(clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) ) if ( TimeOut && time(NULL) > nTimeToStop )
{ {
if ( fVerbose ) printf( "\n" ); if ( fVerbose ) printf( "\n" );
printf( "Reached timeout (%d seconds).\n", TimeOut ); printf( "Reached timeout (%d seconds).\n", TimeOut );
......
...@@ -259,7 +259,7 @@ cuddBddAndAbstractRecur( ...@@ -259,7 +259,7 @@ cuddBddAndAbstractRecur(
} }
} }
if ( manager->TimeStop && manager->TimeStop < clock() ) if ( manager->TimeStop && manager->TimeStop < time(NULL) )
return NULL; return NULL;
if (topf == top) { if (topf == top) {
......
...@@ -926,7 +926,7 @@ cuddBddAndRecur( ...@@ -926,7 +926,7 @@ cuddBddAndRecur(
if (r != NULL) return(r); if (r != NULL) return(r);
} }
if ( manager->TimeStop && manager->TimeStop < clock() ) if ( manager->TimeStop && manager->TimeStop < time(NULL) )
return NULL; return NULL;
/* Here we can skip the use of cuddI, because the operands are known /* Here we can skip the use of cuddI, because the operands are known
......
...@@ -976,9 +976,9 @@ cuddBddTransferRecur( ...@@ -976,9 +976,9 @@ cuddBddTransferRecur(
if (st_lookup(table, (const char *)f, (char **)&res)) if (st_lookup(table, (const char *)f, (char **)&res))
return(Cudd_NotCond(res,comple)); return(Cudd_NotCond(res,comple));
if ( ddS->TimeStop && ddS->TimeStop < clock() ) if ( ddS->TimeStop && ddS->TimeStop < time(NULL) )
return NULL; return NULL;
if ( ddD->TimeStop && ddD->TimeStop < clock() ) if ( ddD->TimeStop && ddD->TimeStop < time(NULL) )
return NULL; return NULL;
/* Recursive step. */ /* Recursive step. */
......
...@@ -1251,7 +1251,7 @@ cuddBddVarMapRecur( ...@@ -1251,7 +1251,7 @@ cuddBddVarMapRecur(
return(Cudd_NotCond(res,F != f)); return(Cudd_NotCond(res,F != f));
} }
if ( manager->TimeStop && manager->TimeStop < clock() ) if ( manager->TimeStop && manager->TimeStop < time(NULL) )
return NULL; return NULL;
/* Split and recur on children of this node. */ /* Split and recur on children of this node. */
......
...@@ -367,7 +367,7 @@ cuddSymmSifting( ...@@ -367,7 +367,7 @@ cuddSymmSifting(
if (ddTotalNumberSwapping >= table->siftMaxSwap) if (ddTotalNumberSwapping >= table->siftMaxSwap)
break; break;
// enable timeout during variable reodering - alanmi 2/13/11 // enable timeout during variable reodering - alanmi 2/13/11
if ( table->TimeStop && table->TimeStop < clock() ) if ( table->TimeStop && table->TimeStop < time(NULL) )
break; break;
x = table->perm[var[i]]; x = table->perm[var[i]];
#ifdef DD_STATS #ifdef DD_STATS
......
...@@ -1485,7 +1485,7 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit ...@@ -1485,7 +1485,7 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit
// int nConfs = 0; // int nConfs = 0;
double Ratio = (s->stats.learnts == 0)? 0.0 : double Ratio = (s->stats.learnts == 0)? 0.0 :
s->stats.learnts_literals / (double)s->stats.learnts; s->stats.learnts_literals / (double)s->stats.learnts;
if ( s->nRuntimeLimit && clock() > s->nRuntimeLimit ) if ( s->nRuntimeLimit && time(NULL) > s->nRuntimeLimit )
break; break;
if (s->verbosity >= 1) if (s->verbosity >= 1)
...@@ -1510,7 +1510,7 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit ...@@ -1510,7 +1510,7 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit
// nof_conflicts = nof_conflicts * 3 / 2; //*= 1.5; // nof_conflicts = nof_conflicts * 3 / 2; //*= 1.5;
nof_learnts = nof_learnts * 11 / 10; //*= 1.1; nof_learnts = nof_learnts * 11 / 10; //*= 1.1;
//printf( "%d ", s->stats.conflicts );
// quit the loop if reached an external limit // quit the loop if reached an external limit
if ( s->nConfLimit && s->stats.conflicts > s->nConfLimit ) if ( s->nConfLimit && s->stats.conflicts > s->nConfLimit )
{ {
...@@ -1523,9 +1523,10 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit ...@@ -1523,9 +1523,10 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit
// printf( "Reached the limit on the number of implications (%d).\n", s->nInsLimit ); // printf( "Reached the limit on the number of implications (%d).\n", s->nInsLimit );
break; break;
} }
if ( s->nRuntimeLimit && clock() > s->nRuntimeLimit ) if ( s->nRuntimeLimit && time(NULL) > s->nRuntimeLimit )
break; break;
} }
//printf( "\n" );
if (s->verbosity >= 1) if (s->verbosity >= 1)
printf("==============================================================================\n"); printf("==============================================================================\n");
......
...@@ -514,7 +514,7 @@ int Pdr_ManBlockCube( Pdr_Man_t * p, Pdr_Set_t * pCube ) ...@@ -514,7 +514,7 @@ int Pdr_ManBlockCube( Pdr_Man_t * p, Pdr_Set_t * pCube )
} }
// check the timeout // check the timeout
if ( p->timeToStop && clock() >= p->timeToStop ) if ( p->timeToStop && time(NULL) > p->timeToStop )
return -1; return -1;
} }
return 1; return 1;
...@@ -538,7 +538,7 @@ int Pdr_ManSolveInt( Pdr_Man_t * p ) ...@@ -538,7 +538,7 @@ int Pdr_ManSolveInt( Pdr_Man_t * p )
int k, RetValue = -1; int k, RetValue = -1;
int clkTotal = clock(); int clkTotal = clock();
int clkStart = clock(); int clkStart = clock();
p->timeToStop = (p->pPars->nTimeOut == 0) ? 0 : clock() + (CLOCKS_PER_SEC * p->pPars->nTimeOut); p->timeToStop = p->pPars->nTimeOut ? time(NULL) + p->pPars->nTimeOut : 0;
assert( Vec_PtrSize(p->vSolvers) == 0 ); assert( Vec_PtrSize(p->vSolvers) == 0 );
// create the first timeframe // create the first timeframe
Pdr_ManCreateSolver( p, (k = 0) ); Pdr_ManCreateSolver( p, (k = 0) );
...@@ -619,7 +619,7 @@ int Pdr_ManSolveInt( Pdr_Man_t * p ) ...@@ -619,7 +619,7 @@ int Pdr_ManSolveInt( Pdr_Man_t * p )
} }
// check the timeout // check the timeout
if ( p->timeToStop && clock() >= p->timeToStop ) if ( p->timeToStop && time(NULL) > p->timeToStop )
{ {
if ( fPrintClauses ) if ( fPrintClauses )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment