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
7d5819ed
Commit
7d5819ed
authored
5 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
Update: compute the move and round numbers in batch (core) mode.
parent
84a18208
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sasaMain.ml
+25
-7
25 additions, 7 deletions
src/sasaMain.ml
with
25 additions
and
7 deletions
src/sasaMain.ml
+
25
−
7
View file @
7d5819ed
...
...
@@ -31,17 +31,34 @@ let (print_step : int -> int -> SasArg.t -> 'v Env.t -> 'v Process.t list -> str
)
exception
Silent
of
int
let
moves
=
ref
0
let
rounds
=
ref
0
let
round_mask
=
ref
[]
let
(
update_round
:
bool
list
list
->
bool
list
list
->
unit
)
=
fun
acti_ll
enab_ll
->
if
!
round_mask
=
[]
then
round_mask
:=
enab_ll
;
round_mask
:=
List
.
map2
(
List
.
map2
(
&&
))
!
round_mask
enab_ll
;
round_mask
:=
List
.
map2
(
List
.
map2
(
fun
m
a
->
m
&&
not
a
))
!
round_mask
acti_ll
;
if
List
.
for_all
(
List
.
for_all
(
not
))
!
round_mask
then
(
round_mask
:=
enab_ll
;
incr
rounds
);
()
let
(
simustep
:
int
->
int
->
SasArg
.
t
->
string
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
'
v
Env
.
t
->
'
v
Env
.
t
*
string
)
=
fun
n
i
args
activate_val
pl_n
e
->
(* 1: Get enable processes *)
let
all
,
enab_ll
=
Sasacore
.
Main
.
get_enable_processes
pl_n
e
in
let
pl
=
fst
(
List
.
split
pl_n
)
in
List
.
iter
(
List
.
iter
(
fun
b
->
if
b
then
incr
moves
))
enab_ll
;
if
not
(
args
.
rif
)
&&
List
.
for_all
(
fun
b
->
not
b
)
(
List
.
flatten
enab_ll
)
then
(
print_step
n
i
args
e
pl
activate_val
enab_ll
;
incr
rounds
;
raise
(
Silent
(
n
-
i
+
1
))
)
else
if
args
.
daemon
=
Daemon
.
Custom
then
...
...
@@ -51,6 +68,7 @@ let (simustep: int -> int -> SasArg.t -> string ->
let
next_activate_val
,
pnal
=
Daemon
.
f
args
.
dummy_input
(
args
.
verbose
>
1
)
args
.
daemon
pl
all
enab_ll
get_action_value
in
update_round
next_activate_val
enab_ll
;
let
next_activate_val
=
String
.
concat
" "
(
List
.
map
...
...
@@ -68,11 +86,10 @@ let (simustep: int -> int -> SasArg.t -> string ->
let
rec
(
simuloop
:
int
->
int
->
SasArg
.
t
->
string
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
'
v
Env
.
t
->
unit
)
=
fun
n
i
args
activate_val
pl_n
e
->
let
ne
,
next_activate_val
=
simustep
n
i
args
activate_val
pl_n
e
in
if
i
>
0
then
simuloop
n
(
i
-
1
)
args
next_activate_val
pl_n
ne
else
(
print_string
"#q
\n
"
;
flush
stdout
)
let
ne
,
next_activate_val
=
simustep
n
i
args
activate_val
pl_n
e
in
if
i
>
0
then
simuloop
n
(
i
-
1
)
args
next_activate_val
pl_n
ne
else
(
print_string
"#q
\n
"
;
flush
stdout
)
let
()
=
let
args
,
pl_n
,
e
=
Sasacore
.
Main
.
make
true
Sys
.
argv
in
...
...
@@ -83,7 +100,8 @@ let () =
|
Failure
msg
->
Printf
.
eprintf
" [sasa] Error: %s
\n
%!"
msg
|
Silent
i
->
let
str
=
if
args
.
rif
then
"#"
else
""
in
Printf
.
eprintf
"
\n
%sThis algo is silent after %i steps
\n
"
str
i
;
Printf
.
eprintf
"
\n
%sThis algo is silent after %i moves, %i steps, %i rounds.
\n
"
str
!
moves
i
!
rounds
;
flush
stderr
;
flush
stdout
;
print_string
"
\n
#quit
\n
"
;
...
...
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