Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sasa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
verimag
synchrone
sasa
Commits
0a3cdd00
Commit
0a3cdd00
authored
2 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
new: add a --gen-dot-at-legit
parent
5008d6f6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/sasacore/sasArg.ml
+37
-31
37 additions, 31 deletions
lib/sasacore/sasArg.ml
lib/sasacore/sasArg.mli
+5
-4
5 additions, 4 deletions
lib/sasacore/sasArg.mli
with
42 additions
and
35 deletions
lib/sasacore/sasArg.ml
+
37
−
31
View file @
0a3cdd00
(* Time-stamp: <modified the 0
6
/0
4
/202
2
(at
10
:07) by Erwan Jahier> *)
(* Time-stamp: <modified the
1
0/0
1
/202
3
(at
22
:07) by Erwan Jahier> *)
type
init_search
=
No_init_search
|
Local
of
int
|
Global
of
int
|
Annealing
of
int
No_init_search
|
Local
of
int
|
Global
of
int
|
Annealing
of
int
type
t
=
{
mutable
topo
:
string
;
...
...
@@ -14,29 +14,30 @@ type t = {
mutable
no_data_file
:
bool
;
mutable
quiet
:
bool
;
mutable
ifi
:
bool
;
mutable
gen_dot_at_legit
:
bool
;
mutable
gen_lutin
:
bool
;
mutable
gen_oracle
:
bool
;
mutable
dummy_input
:
bool
;
mutable
output_algos
:
bool
;
mutable
gen_register
:
bool
;
mutable
init_search
:
init_search
;
mutable
_args
:
(
string
*
Arg
.
spec
*
string
)
list
;
mutable
_user_man
:
(
string
*
string
list
)
list
;
mutable
_hidden_man
:
(
string
*
string
list
)
list
;
mutable
_user_man
:
(
string
*
string
list
)
list
;
mutable
_hidden_man
:
(
string
*
string
list
)
list
;
mutable
_others
:
string
list
;
mutable
_margin
:
int
;
}
let
usage_msg
tool
=
(
"usage: "
^
tool
^
" [<option>]* <topology>.dot
let
usage_msg
tool
=
(
"usage: "
^
tool
^
" [<option>]* <topology>.dot
use -h to see the available options.
"
)
let
print_usage
tool
=
Printf
.
printf
"%s
\n
"
(
usage_msg
tool
);
flush
stdout
let
(
make_args
:
unit
->
t
)
=
fun
()
->
let
(
make_args
:
unit
->
t
)
=
fun
()
->
{
topo
=
""
;
length
=
10000
;
...
...
@@ -48,15 +49,16 @@ let (make_args : unit -> t) =
no_data_file
=
false
;
quiet
=
false
;
ifi
=
false
;
gen_dot_at_legit
=
false
;
gen_lutin
=
false
;
gen_oracle
=
false
;
dummy_input
=
false
;
output_algos
=
false
;
gen_register
=
false
;
init_search
=
No_init_search
;
_args
=
[]
;
_user_man
=
[]
;
_hidden_man
=
[]
;
_args
=
[]
;
_user_man
=
[]
;
_hidden_man
=
[]
;
_others
=
[]
;
_margin
=
12
;
}
...
...
@@ -93,7 +95,7 @@ let (mkopt : t -> string list -> ?hide:bool -> ?arg:string -> Arg.spec ->
let
treto
o
=
opt
._
args
<-
(
o
,
se
,
""
)
::
opt
._
args
in
List
.
iter
treto
ol
;
let
col1
=
(
String
.
concat
", "
ol
)
^
arg
in
if
hide
if
hide
then
opt
._
hidden_man
<-
(
col1
,
ml
)
::
opt
._
hidden_man
else
opt
._
user_man
<-
(
col1
,
ml
)
::
opt
._
user_man
...
...
@@ -101,8 +103,8 @@ let myexit i = exit i
(*******************************************************************************)
(*** User Options Tab **)
let
(
mkoptab
:
string
array
->
t
->
unit
)
=
fun
argv
args
->
let
(
mkoptab
:
string
array
->
t
->
unit
)
=
fun
argv
args
->
(
mkopt
args
[
"--length"
;
"-l"
]
~
arg
:
" <int>"
(
Arg
.
Int
(
fun
i
->
args
.
length
<-
i
))
...
...
@@ -116,7 +118,7 @@ let (mkoptab : string array -> t -> unit) =
mkopt
args
[
"--central-daemon"
;
"-cd"
]
(
Arg
.
Unit
(
fun
()
->
args
.
daemon
<-
DaemonType
.
Central
))
[
"Use a Central daemon (selects exactly one action)"
];
mkopt
args
[
"--locally-central-daemon"
;
"-lcd"
]
(
Arg
.
Unit
(
fun
()
->
args
.
daemon
<-
DaemonType
.
LocallyCentral
))
[
"Use a Locally Central daemon"
;
...
...
@@ -125,7 +127,7 @@ let (mkoptab : string array -> t -> unit) =
(
Arg
.
Unit
(
fun
()
->
args
.
daemon
<-
DaemonType
.
Distributed
))
[
"Use a Distributed daemon (which select at least one action)."
;
"This is the default daemon."
];
mkopt
args
[
"--custom-daemon"
;
"-custd"
]
(
Arg
.
Unit
(
fun
()
->
args
.
daemon
<-
DaemonType
.
Custom
;
args
.
rif
<-
true
))
[
"Use a Custom daemon (forces --rif)"
];
...
...
@@ -185,10 +187,14 @@ let (mkoptab : string array -> t -> unit) =
(
Arg
.
String
(
fun
fn
->
args
.
output_file_name
<-
Some
fn
))
[
"Generate simulation data in a file (use stdout otherwise)"
];
mkopt
args
~
hide
:
true
[
"--gen-dot-at-legit"
;
"-gdal"
]
(
Arg
.
Unit
(
fun
()
->
args
.
gen_dot_at_legit
<-
true
))
[
"Generate a dot file initialised with the reached legitimate config"
];
mkopt
args
[
"--seed"
;
"-seed"
]
(
Arg
.
Int
(
fun
i
->
Seed
.
set
~
verb
:
(
args
.
verbose
>
0
)
i
))
~
arg
:
" <int>"
[
"Set the pseudo-random generator seed of build-in daemons (wins over --replay)"
];
mkopt
args
[
"--replay"
;
"-replay"
]
(
Arg
.
Unit
(
fun
()
->
Seed
.
replay_seed
:=
true
))
[
"Use the last generated seed to replay the last run"
];
...
...
@@ -204,11 +210,11 @@ let (mkoptab : string array -> t -> unit) =
mkopt
args
~
hide
:
true
[
"--list-algos"
;
"-algo"
]
(
Arg
.
Unit
(
fun
()
->
args
.
output_algos
<-
true
))
[
"Output the algo files used in the dot file and exit. "
];
mkopt
args
~
hide
:
true
[
"--gen-register"
;
"-reg"
]
(
Arg
.
Unit
(
fun
()
->
args
.
gen_register
<-
true
))
[
"Generates the registering files and exit. "
];
mkopt
args
~
hide
:
true
[
"--dummy-input"
]
(
Arg
.
Unit
(
fun
()
->
args
.
dummy_input
<-
true
))
[
"Add a dummy input to sasa so that built-in daemon can be used from rdbg"
];
...
...
@@ -237,14 +243,14 @@ let (mkoptab : string array -> t -> unit) =
(
Arg
.
Unit
(
fun
_
->
print_usage
(
argv
.
(
0
));
options
args
stdout
;
exit
0
))
[
"Display main options"
];
mkopt
args
[
"--more"
;
"-m"
]
(
Arg
.
Unit
(
fun
()
->
more_options
args
stdout
;
exit
0
))
mkopt
args
[
"--more"
;
"-m"
]
(
Arg
.
Unit
(
fun
()
->
more_options
args
stdout
;
exit
0
))
[
"Display more options"
]
)
(* all unrecognized options are accumulated *)
let
(
add_other
:
t
->
string
->
unit
)
=
fun
opt
s
->
fun
opt
s
->
opt
._
others
<-
s
::
opt
._
others
let
current
=
ref
0
;;
...
...
@@ -272,21 +278,21 @@ let parse argv = (
mkoptab
argv
args
;
Arg
.
parse_argv
~
current
:
current
argv
args
._
args
(
add_other
args
)
(
usage_msg
argv
.
(
0
));
Functory
.
Cores
.
set_number_of_cores
args
.
cores_nb
;
(
List
.
iter
(
fun
f
->
(
List
.
iter
(
fun
f
->
if
(
String
.
sub
f
0
1
=
"-"
)
then
unexpected
f
unexpected
f
else
if
not
(
Sys
.
file_exists
f
)
then
file_notfound
f
else
()
)
)
args
._
others
);
current
:=
save_current
;
args
.
topo
<-
(
match
args
._
others
with
[]
->
[]
->
Printf
.
fprintf
stderr
"*** The topology file is missing in '%s'
\n
%s
\n
"
(
argv
.
(
0
))
(
usage_msg
argv
.
(
0
));
exit
2
;
(
argv
.
(
0
))
(
usage_msg
argv
.
(
0
));
exit
2
;
|
x
::_
->
x
);
args
...
...
@@ -294,8 +300,8 @@ let parse argv = (
with
|
Arg
.
Bad
msg
->
Printf
.
fprintf
stderr
" [sasa] Error when calling '%s': %s
\n
%s
\n
%!"
(
argv
.
(
0
))
(
first_line
msg
)
(
usage_msg
argv
.
(
0
));
exit
2
;
|
Arg
.
Help
msg
->
Printf
.
fprintf
stdout
"%s
\n
%s
\n
"
msg
(
usage_msg
argv
.
(
0
));
(
first_line
msg
)
(
usage_msg
argv
.
(
0
));
exit
2
;
|
Arg
.
Help
msg
->
Printf
.
fprintf
stdout
"%s
\n
%s
\n
"
msg
(
usage_msg
argv
.
(
0
));
exit
0
)
This diff is collapsed.
Click to expand it.
lib/sasacore/sasArg.mli
+
5
−
4
View file @
0a3cdd00
(* Time-stamp: <modified the 0
6
/0
4
/202
2
(at
09:32
) by Erwan Jahier> *)
(* Time-stamp: <modified the
1
0/0
1
/202
3
(at
22:08
) by Erwan Jahier> *)
type
init_search
=
No_init_search
|
Local
of
int
|
Global
of
int
|
Annealing
of
int
No_init_search
|
Local
of
int
|
Global
of
int
|
Annealing
of
int
type
t
=
{
mutable
topo
:
string
;
...
...
@@ -14,6 +14,7 @@ type t = {
mutable
no_data_file
:
bool
;
mutable
quiet
:
bool
;
mutable
ifi
:
bool
;
mutable
gen_dot_at_legit
:
bool
;
mutable
gen_lutin
:
bool
;
mutable
gen_oracle
:
bool
;
mutable
dummy_input
:
bool
;
...
...
@@ -22,8 +23,8 @@ type t = {
mutable
init_search
:
init_search
;
mutable
_args
:
(
string
*
Arg
.
spec
*
string
)
list
;
mutable
_user_man
:
(
string
*
string
list
)
list
;
mutable
_hidden_man
:
(
string
*
string
list
)
list
;
mutable
_user_man
:
(
string
*
string
list
)
list
;
mutable
_hidden_man
:
(
string
*
string
list
)
list
;
mutable
_others
:
string
list
;
mutable
_margin
:
int
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment