Commit 3c7842be by Alan Mishchenko

Improvements to timeout.

parent bacf2386
...@@ -2027,6 +2027,10 @@ SOURCE=.\src\map\if\ifCut.c ...@@ -2027,6 +2027,10 @@ SOURCE=.\src\map\if\ifCut.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\map\if\ifDec.c
# End Source File
# Begin Source File
SOURCE=.\src\map\if\ifLib.c SOURCE=.\src\map\if\ifLib.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -659,14 +659,6 @@ int Llb_Nonlin4Reachability( Llb_Mnx_t * p ) ...@@ -659,14 +659,6 @@ int Llb_Nonlin4Reachability( Llb_Mnx_t * p )
int clkTemp, clkIter, clk = clock(); int clkTemp, clkIter, clk = clock();
assert( Aig_ManRegNum(p->pAig) > 0 ); assert( Aig_ManRegNum(p->pAig) > 0 );
// compute time to stop
if ( p->pPars->TimeLimit )
p->pPars->TimeTarget = clock() + p->pPars->TimeLimit * CLOCKS_PER_SEC;
else
p->pPars->TimeTarget = 0;
// set the stop time parameter
p->dd->TimeStop = p->pPars->TimeTarget;
if ( p->pPars->fBackward ) if ( p->pPars->fBackward )
{ {
// create bad state in the ring manager // create bad state in the ring manager
...@@ -935,11 +927,18 @@ Llb_Mnx_t * Llb_MnxStart( Aig_Man_t * pAig, Gia_ParLlb_t * pPars ) ...@@ -935,11 +927,18 @@ Llb_Mnx_t * Llb_MnxStart( Aig_Man_t * pAig, Gia_ParLlb_t * pPars )
p->pAig = pAig; p->pAig = pAig;
p->pPars = pPars; p->pPars = pPars;
// compute time to stop
if ( p->pPars->TimeLimit )
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 );
// Cudd_AutodynEnable( p->dd, CUDD_REORDER_SYMM_SIFT ); // Cudd_AutodynEnable( p->dd, CUDD_REORDER_SYMM_SIFT );
Llb4_Nonlin4Sweep( p->pAig, pPars->nBddMax, pPars->nClusterMax, &p->dd, &p->vOrder, &p->vRoots, pPars->fVerbose ); Llb4_Nonlin4Sweep( p->pAig, pPars->nBddMax, pPars->nClusterMax, &p->dd, &p->vOrder, &p->vRoots, pPars->fVerbose );
// set the stop time parameter
p->dd->TimeStop = p->pPars->TimeTarget;
} }
else else
{ {
...@@ -948,6 +947,8 @@ Llb_Mnx_t * Llb_MnxStart( Aig_Man_t * pAig, Gia_ParLlb_t * pPars ) ...@@ -948,6 +947,8 @@ Llb_Mnx_t * Llb_MnxStart( Aig_Man_t * pAig, Gia_ParLlb_t * pPars )
p->dd = Cudd_Init( Vec_IntSize(p->vOrder), 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); p->dd = Cudd_Init( Vec_IntSize(p->vOrder), 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
Cudd_AutodynEnable( p->dd, CUDD_REORDER_SYMM_SIFT ); Cudd_AutodynEnable( p->dd, CUDD_REORDER_SYMM_SIFT );
Cudd_SetMaxGrowth( p->dd, 1.05 ); Cudd_SetMaxGrowth( p->dd, 1.05 );
// set the stop time parameter
p->dd->TimeStop = p->pPars->TimeTarget;
p->vRoots = Llb_Nonlin4DerivePartitions( p->dd, pAig, p->vOrder ); p->vRoots = Llb_Nonlin4DerivePartitions( p->dd, pAig, p->vOrder );
} }
...@@ -994,13 +995,15 @@ void Llb_MnxStop( Llb_Mnx_t * p ) ...@@ -994,13 +995,15 @@ void Llb_MnxStop( Llb_Mnx_t * p )
Cudd_RecursiveDeref( p->dd, p->bCurrent ); Cudd_RecursiveDeref( p->dd, p->bCurrent );
if ( p->bNext ) if ( p->bNext )
Cudd_RecursiveDeref( p->dd, p->bNext ); Cudd_RecursiveDeref( p->dd, p->bNext );
if ( p->vRings );
Vec_PtrForEachEntry( DdNode *, p->vRings, bTemp, i ) Vec_PtrForEachEntry( DdNode *, p->vRings, bTemp, i )
Cudd_RecursiveDeref( p->dd, bTemp ); Cudd_RecursiveDeref( p->dd, bTemp );
if ( p->vRoots )
Vec_PtrForEachEntry( DdNode *, p->vRoots, bTemp, i ) Vec_PtrForEachEntry( DdNode *, p->vRoots, bTemp, i )
Cudd_RecursiveDeref( p->dd, bTemp ); Cudd_RecursiveDeref( p->dd, bTemp );
// remove arrays // remove arrays
Vec_PtrFree( p->vRings ); Vec_PtrFreeP( &p->vRings );
Vec_PtrFree( p->vRoots ); Vec_PtrFreeP( &p->vRoots );
//Cudd_PrintInfo( p->dd, stdout ); //Cudd_PrintInfo( p->dd, stdout );
Extra_StopManager( p->dd ); Extra_StopManager( p->dd );
Vec_IntFreeP( &p->vOrder ); Vec_IntFreeP( &p->vOrder );
......
...@@ -64,8 +64,10 @@ int Abc_RealMain( int argc, char * argv[] ) ...@@ -64,8 +64,10 @@ int Abc_RealMain( int argc, char * argv[] )
char * sCommand; char * sCommand;
int fStatus = 0; int fStatus = 0;
int c, fBatch, fInitSource, fInitRead, fFinalWrite; int c, fBatch, fInitSource, fInitRead, fFinalWrite;
// added to detect memory leaks: // added to detect memory leaks
// watch for {,,msvcrtd.dll}*__p__crtBreakAlloc()
// (http://support.microsoft.com/kb/151585)
#if defined(_DEBUG) && defined(_MSC_VER) #if defined(_DEBUG) && defined(_MSC_VER)
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif #endif
......
...@@ -278,6 +278,7 @@ static inline sat_solver * Pdr_ManNewSolver1( Pdr_Man_t * p, int k, int fInit ) ...@@ -278,6 +278,7 @@ static inline sat_solver * Pdr_ManNewSolver1( Pdr_Man_t * p, int k, int fInit )
Vec_IntWriteEntry( p->vVar2Reg, Pdr_ObjSatVar(p, k, pObj), i ); Vec_IntWriteEntry( p->vVar2Reg, Pdr_ObjSatVar(p, k, pObj), i );
} }
pSat = (sat_solver *)Cnf_DataWriteIntoSolver( p->pCnf1, 1, fInit ); pSat = (sat_solver *)Cnf_DataWriteIntoSolver( p->pCnf1, 1, fInit );
sat_solver_set_runtime_limit( pSat, p->timeToStop );
return pSat; return pSat;
} }
...@@ -322,6 +323,7 @@ static inline sat_solver * Pdr_ManNewSolver2( Pdr_Man_t * p, int k, int fInit ) ...@@ -322,6 +323,7 @@ static inline sat_solver * Pdr_ManNewSolver2( Pdr_Man_t * p, int k, int fInit )
// start the SAT solver // start the SAT solver
pSat = sat_solver_new(); pSat = sat_solver_new();
sat_solver_setnvars( pSat, 500 ); sat_solver_setnvars( pSat, 500 );
sat_solver_set_runtime_limit( pSat, p->timeToStop );
return pSat; return pSat;
} }
......
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