26#ifdef ABC_USE_PTHREADS
29#include "../lib/pthread.h"
72 pCorPars->
nBTLimit = pPars->nBTLimit;
73 pCorPars->
fVerbose = pPars->fVerbose;
76 if ( Gia_ManPiNum(pGia) > 0 )
91#ifndef ABC_USE_PTHREADS
101#define PAR_THR_MAX 100
102typedef struct Par_ScorrThData_t_
109 atomic_bool fWorking;
112void * Ssw_GiaWorkerThread(
void * pArg )
114 struct timespec pause_duration;
115 pause_duration.tv_sec = 0;
116 pause_duration.tv_nsec = 10000000L;
118 Par_ScorrThData_t * pThData = (Par_ScorrThData_t *)pArg;
121 while ( !atomic_load_explicit((atomic_bool *)&pThData->fWorking, memory_order_acquire) )
122 nanosleep(&pause_duration, NULL);
123 if ( pThData->p == NULL )
125 pthread_exit( NULL );
130 atomic_store_explicit(&pThData->fWorking,
false, memory_order_release);
141 int i, status, nProcs = pPars->nProcs;
145 if ( pPars->fVerbose )
146 printf(
"Running concurrent &scorr with %d processes.\n", nProcs );
148 if ( pPars->nProcs < 2 )
154 for ( i = 0; i < nProcs; i++ )
156 ThData[i].CorPars = *pCorPars;
157 ThData[i].iThread = i;
158 atomic_store_explicit(&ThData[i].fWorking,
false, memory_order_release);
159 status = pthread_create( WorkerThread + i, NULL, Ssw_GiaWorkerThread, (
void *)(ThData + i) );
assert( status == 0 );
162 struct timespec pause_duration;
163 pause_duration.tv_sec = 0;
164 pause_duration.tv_nsec = 10000000L;
167 vStack = Vec_PtrDup( vGias );
168 while ( Vec_PtrSize(vStack) > 0 )
170 for ( i = 0; i < nProcs; i++ )
172 if ( atomic_load_explicit(&ThData[i].fWorking, memory_order_acquire) )
174 ThData[i].p = (
Gia_Man_t*)Vec_PtrPop( vStack );
175 atomic_store_explicit(&ThData[i].fWorking,
true, memory_order_release);
179 Vec_PtrFree( vStack );
181 for ( i = 0; i < nProcs; i++ )
183 if ( atomic_load_explicit(&ThData[i].fWorking, memory_order_acquire) )
185 nanosleep(&pause_duration, NULL);
189 for ( i = 0; i < nProcs; i++ )
192 atomic_store_explicit(&ThData[i].fWorking,
true, memory_order_release);
196 for ( i = 0; i < nProcs; i++ )
197 pthread_join( WorkerThread[i], NULL );
222 int i, nCountPis, nCountRegs;
223 int nClasses, nPartSize, fVerbose;
225 if ( pPars->fConstrs )
227 Abc_Print( 1,
"Cannot use partitioned computation with constraints.\n" );
231 nPartSize = pPars->nPartSize; pPars->nPartSize = 0;
232 fVerbose = pPars->fVerbose; pPars->fVerbose = 0;
234 if ( pAig->vClockDoms )
237 vResult = Vec_PtrAlloc( 100 );
240 if ( nPartSize && Vec_IntSize(vPart) > nPartSize )
243 Vec_PtrPush( vResult, Vec_IntDup(vPart) );
253 Abc_Print( 1,
"Simple partitioning. %d partitions are saved:\n", Vec_PtrSize(vResult) );
257 sprintf( Buffer,
"part%03d.aig", i );
260 Abc_Print( 1,
"part%03d.aig : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d.\n",
261 i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Aig_ManNodeNum(pTemp) );
273 if ( pAig->vOnehots )
280 Abc_Print( 1,
"%3d : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d. It = %3d. Cl = %5d.\n",
281 i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Aig_ManNodeNum(pTemp), pPars->nIters, nClasses );
293 pPars->nPartSize = nPartSize;
294 pPars->fVerbose = fVerbose;
297 ABC_PRT(
"Total time", Abc_Clock() - clk );
324 int * pMapBack = NULL;
325 int i, nCountPis, nCountRegs;
326 int nClasses, nPartSize, fVerbose;
328 if ( pPars->fConstrs )
330 Abc_Print( 1,
"Cannot use partitioned computation with constraints.\n" );
334 nPartSize = pPars->nPartSize; pPars->nPartSize = 0;
335 fVerbose = pPars->fVerbose; pPars->fVerbose = 0;
337 if ( pAig->vClockDoms )
340 vResult = Vec_PtrAlloc( 100 );
343 if ( nPartSize && Vec_IntSize(vPart) > nPartSize )
346 Vec_PtrPush( vResult, Vec_IntDup(vPart) );
354 vAigs = Vec_PtrAlloc( 100 );
355 vGias = Vec_PtrAlloc( 100 );
356 vMaps = Vec_PtrAlloc( 100 );
358 Abc_Print( 1,
"Simple partitioning. %d partitions are saved:\n", Vec_PtrSize(vResult) );
363 Vec_PtrPush( vAigs, pTemp );
365 Vec_PtrPush( vMaps, pMapBack );
369 Abc_Print( 1,
"part%03d.aig : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d.\n",
370 i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Aig_ManNodeNum(pTemp) );
378 int * pMapBack = (
int *)Vec_PtrEntry( vMaps, i );
381 pTemp = (
Aig_Man_t *)Vec_PtrEntry( vAigs, i );
386 Abc_Print( 1,
"%3d : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d. It = %3d. Cl = %5d.\n",
387 i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), 0, 0, Aig_ManNodeNum(pTemp), 0, nClasses );
393 Vec_PtrFree( vAigs );
394 Vec_PtrFree( vGias );
395 Vec_PtrFree( vMaps );
403 pPars->nPartSize = nPartSize;
404 pPars->fVerbose = fVerbose;
407 ABC_PRT(
"Total time", Abc_Clock() - clk );
414 assert( Gia_ManObjNum(pGia) == Aig_ManObjNum(pAig) );
416 pObjAig->
iData = Abc_Var2Lit(i, 0);
427 pSswPars->nBTLimit = pPars->
nBTLimit;
428 pSswPars->nProcs = pPars->
nProcs;
430 pSswPars->fVerbose = pPars->
fVerbose;
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
int Aig_ManSeqCleanup(Aig_Man_t *p)
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
#define Aig_ManForEachObj(p, pObj, i)
void Aig_ManStop(Aig_Man_t *p)
struct Aig_Obj_t_ Aig_Obj_t
void Aig_ManPartDivide(Vec_Ptr_t *vResult, Vec_Int_t *vDomain, int nPartSize, int nOverSize)
Aig_Man_t * Aig_ManRegCreatePart(Aig_Man_t *pAig, Vec_Int_t *vPart, int *pnCountPis, int *pnCountRegs, int **ppMapBack)
Vec_Ptr_t * Aig_ManRegPartitionSimple(Aig_Man_t *pAig, int nPartSize, int nOverSize)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
int Aig_TransferMappedClasses(Aig_Man_t *pAig, Aig_Man_t *pPart, int *pMapBack)
Vec_Ptr_t * Aig_ManRegProjectOnehots(Aig_Man_t *pAig, Aig_Man_t *pPart, Vec_Ptr_t *vOnehots, int fVerbose)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define PAR_THR_MAX
DECLARATIONS ///.
void Cec_ManCorSetDefaultParams(Cec_ParCor_t *p)
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
struct Cec_ParCor_t_ Cec_ParCor_t
void Gia_ManReprFromAigRepr2(Aig_Man_t *pAig, Gia_Man_t *pGia)
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
void Gia_ManReprToAigRepr2(Aig_Man_t *pAig, Gia_Man_t *pGia)
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
void Gia_ManStop(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
ABC_NAMESPACE_IMPL_START void Ssw_SignalCorrespondenceArray1(Vec_Ptr_t *vGias, Ssw_Pars_t *pPars)
DECLARATIONS ///.
Gia_Man_t * Gia_SignalCorrespondencePart(Gia_Man_t *p, Cec_ParCor_t *pPars)
void Ssw_SignalCorrespondenceArray(Vec_Ptr_t *vGias, Ssw_Pars_t *pPars)
void Gia_ManRestoreNodeMapping(Aig_Man_t *pAig, Gia_Man_t *pGia)
Aig_Man_t * Ssw_SignalCorrespondencePart2(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Aig_Man_t * Ssw_SignalCorrespondencePart(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.