Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
8826ed6d
Commit
8826ed6d
authored
Mar 14, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with simulation.
parent
c7c3aa3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
src/map/if/ifTest.c
+9
-15
No files found.
src/map/if/ifTest.c
View file @
8826ed6d
...
...
@@ -206,19 +206,16 @@ typedef struct Par_ThData_t_
int
Id
;
int
Status
;
}
Par_ThData_t
;
//pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
void
*
Gia_ParWorkerThread
(
void
*
pArg
)
{
Par_ThData_t
*
pThData
=
(
Par_ThData_t
*
)
pArg
;
unsigned
Counter
=
0
;
volatile
int
*
pPlace
=
&
pThData
->
Status
;
while
(
1
)
{
while
(
pThData
->
Status
==
0
)
printf
(
""
);
while
(
*
pPlace
==
0
);
assert
(
pThData
->
Status
==
1
);
if
(
pThData
->
Id
==
-
1
)
{
// printf( "Stopped\n" ); fflush( stdout );
pthread_exit
(
NULL
);
assert
(
0
);
return
NULL
;
...
...
@@ -227,7 +224,6 @@ void * Gia_ParWorkerThread( void * pArg )
Gia_ParTestSimulateObj
(
pThData
->
p
,
pThData
->
Id
);
pThData
->
Status
=
0
;
}
assert
(
Counter
!=
0
);
assert
(
0
);
return
NULL
;
}
...
...
@@ -256,9 +252,8 @@ void Gia_ParTestSimulate2( Gia_Man_t * p, int nWords, int nProcs )
ThData
[
i
].
Id
=
-
1
;
ThData
[
i
].
Status
=
0
;
status
=
pthread_create
(
WorkerThread
+
i
,
NULL
,
Gia_ParWorkerThread
,
(
void
*
)(
ThData
+
i
)
);
assert
(
status
==
0
);
// printf( "Started %d\n", i ); fflush( stdout );
}
while
(
nCountFanins
>
0
)
while
(
nCountFanins
>
0
||
Vec_IntSize
(
vStack
)
>
0
)
{
for
(
i
=
0
;
i
<
nProcs
;
i
++
)
{
...
...
@@ -303,7 +298,6 @@ void Gia_ParTestSimulate2( Gia_Man_t * p, int nWords, int nProcs )
for
(
i
=
0
;
i
<
nProcs
;
i
++
)
{
assert
(
ThData
[
i
].
Status
==
0
);
// printf( "Stopping %d\n", i ); fflush( stdout );
ThData
[
i
].
Id
=
-
1
;
ThData
[
i
].
Status
=
1
;
}
...
...
@@ -329,16 +323,16 @@ void Gia_ParTestSimulate2( Gia_Man_t * p, int nWords, int nProcs )
void
Gia_ParTest
(
Gia_Man_t
*
p
,
int
nWords
,
int
nProcs
)
{
abctime
clk
;
printf
(
"Trying with %d words and %d threads.
\n
"
,
nWords
,
nProcs
);
printf
(
"Trying with %d words and %d threads.
"
,
nWords
,
nProcs
);
printf
(
"Memory usage = %.2f MB
\n
"
,
(
8
.
0
*
nWords
*
Gia_ManObjNum
(
p
))
/
(
1
<<
20
)
);
clk
=
Abc_Clock
();
Gia_ParTestSimulate2
(
p
,
nWords
,
nProcs
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
clk
=
Abc_Clock
();
Gia_ParTestSimulate
(
p
,
nWords
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
Abc_PrintTime
(
1
,
"Regular time"
,
Abc_Clock
()
-
clk
);
clk
=
Abc_Clock
();
Gia_ParTestSimulate2
(
p
,
nWords
,
nProcs
);
Abc_PrintTime
(
1
,
"Special time"
,
Abc_Clock
()
-
clk
);
}
////////////////////////////////////////////////////////////////////////
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment