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
77e2b1ff
Commit
77e2b1ff
authored
Feb 08, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Autotuner for 'satoko'.
parent
cf24a0eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
180 additions
and
28 deletions
+180
-28
abclib.dsp
+4
-0
src/aig/gia/giaSatoko.c
+6
-2
src/base/abci/abc.c
+23
-4
src/base/cmd/cmd.c
+114
-0
src/base/cmd/cmdAuto.c
+0
-0
src/base/cmd/module.make
+1
-0
src/misc/extra/extraUtilUtil.c
+32
-22
No files found.
abclib.dsp
View file @
77e2b1ff
...
...
@@ -523,6 +523,10 @@ SOURCE=.\src\base\cmd\cmdApi.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cmd\cmdAuto.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cmd\cmdFlag.c
# End Source File
# Begin Source File
...
...
src/aig/gia/giaSatoko.c
View file @
77e2b1ff
...
...
@@ -21,6 +21,7 @@
#include "gia.h"
#include "sat/cnf/cnf.h"
#include "sat/satoko/satoko.h"
#include "sat/satoko/solver.h"
ABC_NAMESPACE_IMPL_START
...
...
@@ -68,17 +69,19 @@ satoko_t * Gia_ManCreateSatoko( Gia_Man_t * p )
satoko_destroy
(
pSat
);
return
NULL
;
}
void
Gia_ManCallSatokoOne
(
Gia_Man_t
*
p
,
satoko_opts_t
*
opts
,
int
iOutput
)
int
Gia_ManCallSatokoOne
(
Gia_Man_t
*
p
,
satoko_opts_t
*
opts
,
int
iOutput
)
{
abctime
clk
=
Abc_Clock
();
satoko_t
*
pSat
;
int
status
;
int
status
,
Cost
=
0
;
pSat
=
Gia_ManCreateSatoko
(
p
);
if
(
pSat
)
{
satoko_configure
(
pSat
,
opts
);
status
=
satoko_solve
(
pSat
);
Cost
=
(
unsigned
)
pSat
->
stats
.
n_conflicts
;
satoko_destroy
(
pSat
);
}
else
...
...
@@ -97,6 +100,7 @@ void Gia_ManCallSatokoOne( Gia_Man_t * p, satoko_opts_t * opts, int iOutput )
Abc_Print
(
1
,
"UNSATISFIABLE "
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
return
Cost
;
}
void
Gia_ManCallSatoko
(
Gia_Man_t
*
p
,
satoko_opts_t
*
opts
,
int
fSplit
)
{
...
...
src/base/abci/abc.c
View file @
77e2b1ff
...
...
@@ -16782,7 +16782,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
If_ManSetDefaultPars
(
pPars
);
pPars
->
pLutLib
=
(
If_LibLut_t
*
)
Abc_FrameReadLibLut
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KCFAGRNTXYDEWSqaflepmrsdbgxyuojiktncvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"K
:
CFAGRNTXYDEWSqaflepmrsdbgxyuojiktncvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -38135,9 +38135,9 @@ int Abc_CommandAbc9Cone( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Gia_Man_t
*
pTemp
;
Vec_Int_t
*
vPos
;
int
c
,
iOutNum
=
-
1
,
nOutRange
=
1
,
iPartNum
=
-
1
,
nLevelMax
=
0
,
nTimeWindow
=
0
,
fUseAllCis
=
0
,
fVerbose
=
0
;
int
c
,
iOutNum
=
-
1
,
nOutRange
=
1
,
iPartNum
=
-
1
,
nLevelMax
=
0
,
nTimeWindow
=
0
,
fUseAllCis
=
0
,
f
ExtractAll
=
0
,
f
Verbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"ORPLWavh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"ORPLWa
e
vh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -38199,6 +38199,9 @@ int Abc_CommandAbc9Cone( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'a'
:
fUseAllCis
^=
1
;
break
;
case
'e'
:
fExtractAll
^=
1
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
...
...
@@ -38213,6 +38216,21 @@ int Abc_CommandAbc9Cone( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9Cone(): There is no AIG.
\n
"
);
return
1
;
}
if
(
fExtractAll
)
{
char
Buffer
[
1000
];
Gia_Obj_t
*
pObj
;
int
i
,
nDigits
=
Abc_Base10Log
(
Gia_ManPoNum
(
pAbc
->
pGia
));
Gia_ManForEachPo
(
pAbc
->
pGia
,
pObj
,
i
)
{
Gia_Man_t
*
pOne
=
Gia_ManDupDfsCone
(
pAbc
->
pGia
,
pObj
);
sprintf
(
Buffer
,
"%s_%0*d.aig"
,
Extra_FileNameGeneric
(
pAbc
->
pGia
->
pSpec
),
nDigits
,
i
);
Gia_AigerWrite
(
pOne
,
Buffer
,
0
,
0
);
Gia_ManStop
(
pOne
);
}
printf
(
"Dumped all outputs into individual AIGER files.
\n
"
);
return
0
;
}
if
(
nLevelMax
||
nTimeWindow
)
{
if
(
nLevelMax
&&
nTimeWindow
)
...
...
@@ -38260,7 +38278,7 @@ int Abc_CommandAbc9Cone( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &cone [-ORPLW num] [-avh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &cone [-ORPLW num] [-a
e
vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
extracting multi-output sequential logic cones
\n
"
);
Abc_Print
(
-
2
,
"
\t
-O num : the index of first PO to extract [default = %d]
\n
"
,
iOutNum
);
Abc_Print
(
-
2
,
"
\t
-R num : (optional) the number of outputs to extract [default = %d]
\n
"
,
nOutRange
);
...
...
@@ -38268,6 +38286,7 @@ usage:
Abc_Print
(
-
2
,
"
\t
-L num : (optional) extract cones with higher level [default = %d]
\n
"
,
nLevelMax
);
Abc_Print
(
-
2
,
"
\t
-W num : (optional) extract cones falling into this window [default = %d]
\n
"
,
nTimeWindow
);
Abc_Print
(
-
2
,
"
\t
-a : toggle keeping all CIs or structral support only [default = %s]
\n
"
,
fUseAllCis
?
"all"
:
"structural"
);
Abc_Print
(
-
2
,
"
\t
-e : toggle writing all outputs into individual files [default = %s]
\n
"
,
fExtractAll
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
src/base/cmd/cmd.c
View file @
77e2b1ff
...
...
@@ -60,6 +60,7 @@ static int CmdCommandSis ( Abc_Frame_t * pAbc, int argc, char ** argv
static
int
CmdCommandMvsis
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandCapo
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandStarter
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandAutoTuner
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
extern
int
Cmd_CommandAbcLoadPlugIn
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
@@ -110,6 +111,7 @@ void Cmd_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"mvsis"
,
CmdCommandMvsis
,
1
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"capo"
,
CmdCommandCapo
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"starter"
,
CmdCommandStarter
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"autotuner"
,
CmdCommandAutoTuner
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Various"
,
"load_plugin"
,
Cmd_CommandAbcLoadPlugIn
,
0
);
}
...
...
@@ -2457,6 +2459,118 @@ usage:
return
1
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
CmdCommandAutoTuner
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
extern
void
Cmd_RunAutoTuner
(
char
*
pConfig
,
char
*
pFileList
,
int
nCores
);
FILE
*
pFile
;
char
*
pFileConf
=
NULL
;
char
*
pFileList
=
NULL
;
char
*
pFileName
;
int
c
,
nCores
=
3
;
int
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"NCFvh"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'N'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-N
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nCores
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nCores
<
0
)
goto
usage
;
break
;
case
'C'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-C
\"
should be followed by a string (possibly in quotes).
\n
"
);
goto
usage
;
}
pFileConf
=
argv
[
globalUtilOptind
];
globalUtilOptind
++
;
break
;
case
'F'
:
if
(
globalUtilOptind
>=
argc
)
{
Abc_Print
(
-
1
,
"Command line switch
\"
-F
\"
should be followed by a string (possibly in quotes).
\n
"
);
goto
usage
;
}
pFileList
=
argv
[
globalUtilOptind
];
globalUtilOptind
++
;
break
;
case
'v'
:
fVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
goto
usage
;
}
}
if
(
pFileConf
==
NULL
)
{
Abc_Print
(
-
2
,
"File containing configuration for autotuning is not given.
\n
"
);
return
1
;
}
if
(
pFileList
==
NULL
)
{
Abc_Print
(
-
2
,
"File contining list of files for autotuning is not given.
\n
"
);
return
1
;
}
// get the input file name
pFileName
=
pFileConf
;
if
(
(
pFile
=
Io_FileOpen
(
pFileName
,
"open_path"
,
"rb"
,
0
))
==
NULL
)
// if ( (pFile = fopen( pFileName, "rb" )) == NULL )
{
Abc_Print
(
-
2
,
"Cannot open configuration file
\"
%s
\"
. "
,
pFileName
);
if
((
pFileName
=
Extra_FileGetSimilarName
(
pFileName
,
".c"
,
".s"
,
".scr"
,
".script"
,
NULL
)
))
Abc_Print
(
-
2
,
"Did you mean
\"
%s
\"
?"
,
pFileName
);
Abc_Print
(
-
2
,
"
\n
"
);
return
1
;
}
fclose
(
pFile
);
// get the input file name
pFileName
=
pFileList
;
if
(
(
pFile
=
Io_FileOpen
(
pFileName
,
"open_path"
,
"rb"
,
0
))
==
NULL
)
// if ( (pFile = fopen( pFileName, "rb" )) == NULL )
{
Abc_Print
(
-
2
,
"Cannot open the file list
\"
%s
\"
. "
,
pFileName
);
if
((
pFileName
=
Extra_FileGetSimilarName
(
pFileName
,
".c"
,
".s"
,
".scr"
,
".script"
,
NULL
)
))
Abc_Print
(
-
2
,
"Did you mean
\"
%s
\"
?"
,
pFileName
);
Abc_Print
(
-
2
,
"
\n
"
);
return
1
;
}
fclose
(
pFile
);
// run commands
Cmd_RunAutoTuner
(
pFileConf
,
pFileList
,
nCores
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: autotuner [-N num] [-C file] [-F file] [-vh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
runs command lines listed in <file> concurrently on <num> CPUs
\n
"
);
Abc_Print
(
-
2
,
"
\t
-N num : the number of concurrent jobs including the controler [default = %d]
\n
"
,
nCores
);
Abc_Print
(
-
2
,
"
\t
-C cmd : configuration file for autotuning
\n
"
);
Abc_Print
(
-
2
,
"
\t
-F cmd : list of files to be used for autotuning
\n
"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
/**Function********************************************************************
Synopsis [Print the version string.]
...
...
src/base/cmd/cmdAuto.c
0 → 100644
View file @
77e2b1ff
This diff is collapsed.
Click to expand it.
src/base/cmd/module.make
View file @
77e2b1ff
SRC
+=
src/base/cmd/cmd.c
\
src/base/cmd/cmdAlias.c
\
src/base/cmd/cmdApi.c
\
src/base/cmd/cmdAuto.c
\
src/base/cmd/cmdFlag.c
\
src/base/cmd/cmdHist.c
\
src/base/cmd/cmdLoad.c
\
...
...
src/misc/extra/extraUtilUtil.c
View file @
77e2b1ff
...
...
@@ -102,35 +102,45 @@ int Extra_UtilGetopt( int argc, char *argv[], const char *optstring )
globalUtilOptarg
=
NULL
;
if
(
pScanStr
==
NULL
||
*
pScanStr
==
'\0'
)
{
if
(
globalUtilOptind
==
0
)
globalUtilOptind
++
;
if
(
globalUtilOptind
>=
argc
)
return
EOF
;
place
=
argv
[
globalUtilOptind
];
if
(
place
[
0
]
!=
'-'
||
place
[
1
]
==
'\0'
)
return
EOF
;
globalUtilOptind
++
;
if
(
place
[
1
]
==
'-'
&&
place
[
2
]
==
'\0'
)
return
EOF
;
pScanStr
=
place
+
1
;
if
(
pScanStr
==
NULL
||
*
pScanStr
==
'\0'
)
{
if
(
globalUtilOptind
==
0
)
globalUtilOptind
++
;
if
(
globalUtilOptind
>=
argc
)
return
EOF
;
place
=
argv
[
globalUtilOptind
];
if
(
place
[
0
]
!=
'-'
||
place
[
1
]
==
'\0'
)
return
EOF
;
globalUtilOptind
++
;
if
(
place
[
1
]
==
'-'
&&
place
[
2
]
==
'\0'
)
return
EOF
;
pScanStr
=
place
+
1
;
}
c
=
*
pScanStr
++
;
place
=
strchr
(
optstring
,
c
);
if
(
place
==
NULL
||
c
==
':'
)
{
(
void
)
fprintf
(
stderr
,
"%s: unknown option %c
\n
"
,
argv
[
0
],
c
);
return
'?'
;
}
if
(
*++
place
==
':'
)
{
if
(
*
pScanStr
!=
'\0'
)
{
globalUtilOptarg
=
pScanStr
;
pScanStr
=
NULL
;
}
else
{
if
(
globalUtilOptind
>=
argc
)
{
(
void
)
fprintf
(
stderr
,
"%s: %c requires an argument
\n
"
,
argv
[
0
],
c
);
(
void
)
fprintf
(
stderr
,
"%s: unknown option %c
\n
"
,
argv
[
0
],
c
);
return
'?'
;
}
globalUtilOptarg
=
argv
[
globalUtilOptind
];
globalUtilOptind
++
;
}
if
(
*++
place
==
':'
)
{
if
(
*
pScanStr
!=
'\0'
)
{
globalUtilOptarg
=
pScanStr
;
pScanStr
=
NULL
;
}
else
{
if
(
globalUtilOptind
>=
argc
)
{
(
void
)
fprintf
(
stderr
,
"%s: %c requires an argument
\n
"
,
argv
[
0
],
c
);
return
'?'
;
}
globalUtilOptarg
=
argv
[
globalUtilOptind
];
globalUtilOptind
++
;
}
}
return
c
;
}
...
...
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