Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-orbit
Project
Project
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Katerina Roukounaki
cloud-orbit
Commits
d0e50428
Commit
d0e50428
authored
Nov 20, 2014
by
Yiannis Tsiouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish debug info + s/spawnLink/spawn/
parent
39aaad5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
MasterWorker.hs
MasterWorker.hs
+15
-13
No files found.
MasterWorker.hs
View file @
d0e50428
...
...
@@ -161,7 +161,7 @@ vertex_server staticMachConf crdt table statData = do
let
idleTimeout
=
get_idle_timeout
staticMachConf
r
<-
receiveTimeout
idleTimeout
[
match
$
\
(
"vertex"
,
x
,
slot
,
k
)
->
do
say
$
"
g
ot a vertex!"
say
$
"
G
ot a vertex!"
let
creditPlusK
=
credit_atomic
k
crdt
nowTime
=
now
vertsRecvd
=
verts_recvd
statData
...
...
@@ -263,7 +263,7 @@ distribute_vertices :: ParConf -> Credit -> Credit -> Process Credit
distribute_vertices
_
crdt
[]
=
return
crdt
distribute_vertices
staticMachConf
crdt
[
x
]
=
do
let
(
k
,
remainingCredit
)
=
debit_atomic
crdt
say
$
"
r
emaining credit = "
++
show
remainingCredit
++
" k = "
++
show
k
say
$
"
R
emaining credit = "
++
show
remainingCredit
++
" k = "
++
show
k
send_vertex
staticMachConf
x
k
return
remainingCredit
distribute_vertices
staticMachConf
crdt
(
x
:
xs
)
=
do
...
...
@@ -279,7 +279,9 @@ send_image staticMachConf x g k = send_vertex staticMachConf (g x) k
-- send_vertex hashes vertex X and sends it to the worker determined by
-- the hash; the message is tagged with atomic credit K.
send_vertex
::
ParConf
->
Vertex
->
ACredit
->
Process
()
send_vertex
staticMachConf
x
k
=
do
{
say
$
"send to "
++
show
(
x
,
slot
,
k
);
send
pid
(
"vertex"
,
x
,
slot
,
k
)
}
send_vertex
staticMachConf
x
k
=
do
{
say
$
"Send vertex "
++
show
x
++
" to "
++
show
pid
++
" (slot, k) = "
++
show
(
slot
,
k
);
send
pid
(
"vertex"
,
x
,
slot
,
k
)
}
where
(
pid
,
slot
)
=
hash_vertex
staticMachConf
x
-- hash_vertex computes the two-dimensional hash table slot of vertex X where
...
...
@@ -421,22 +423,22 @@ orbit gs xs (Par hostInfo) = par_orbit gs xs hostInfo
par_orbit
::
GenClos
->
[
Vertex
]
->
HostInfo
->
Process
([
Vertex
],
[
MasterStats
])
par_orbit
gs
xs
hosts
=
do
say
"----
i
n par_orbit"
say
"----
I
n par_orbit"
-- spawn workers on Hosts
(
workers
,
globTabSize
)
<-
start_workers
hosts
self
<-
getSelfPid
let
-- assemble StaticMachConf and distribute to Workers
staticMachConf
=
mk_static_mach_conf
gs
self
workers
globTabSize
mapM_
(
\
(
pid
,
_
,
_
)
->
send
pid
(
"init"
,
staticMachConf
))
workers
say
$
"---- after send pid init, xs = "
++
show
xs
let
-- start wall clock timer
startTime
=
now
-- distribute initial vertices to workers
say
$
"---- After send pid init, xs = "
++
show
xs
crdt
<-
distribute_vertices
staticMachConf
one
xs
say
$
"----
a
fter distribute_vertices, credit = "
++
show
crdt
say
$
"----
A
fter distribute_vertices, credit = "
++
show
crdt
-- collect credit handed back by idle workers
collect_credit
crdt
say
"----
a
fter collect credit"
say
"----
A
fter collect credit"
-- collect credit handed back by idle workers
let
-- measure elapsed time (in milliseconds)
elapsedTime
=
now
-
startTime
...
...
@@ -456,12 +458,14 @@ par_orbit gs xs hosts = do
-- * Workers is a list of Worker, sorted wrt. TableOffset in ascending order.
start_workers
::
HostInfo
->
Process
([(
ProcessId
,
Int
,
Int
)],
Int
)
start_workers
(
JustOne
host
)
=
do
say
"----
i
n start_workers"
say
"----
I
n start_workers"
(
workers
,
globalTableSize
)
<-
do_start_shm
host
(
[]
,
0
)
say
"----
a
fter do_start_shm"
say
"----
A
fter do_start_shm"
return
(
reverse
workers
,
globalTableSize
)
start_workers
(
Many
hosts
)
=
do
say
"---- In many start_workers"
(
workers
,
globalTableSize
)
<-
do_start_dist
hosts
(
[]
,
0
)
say
$
"---- After do_start_dist, Workers = "
++
show
workers
return
(
reverse
workers
,
globalTableSize
)
do_start_shm
::
(
Int
,
Int
,
Int
,
Bool
)
->
([(
ProcessId
,
Int
,
Int
)],
Int
)
...
...
@@ -469,9 +473,7 @@ do_start_shm :: (Int, Int, Int, Bool) -> ([(ProcessId, Int, Int)], Int)
do_start_shm
(
0
,
_
,
_
,
_
)
acc
=
return
acc
do_start_shm
(
m
,
tabSize
,
tmOut
,
spawnImgComp
)
(
workers
,
gTabSize
)
=
do
node
<-
getSelfNode
say
$
"---- i got a node id "
++
show
m
++
" "
++
show
tabSize
++
" "
++
show
tmOut
++
" "
++
show
workers
pid
<-
spawnLink
node
(
$
(
mkClosure
'i
n
it
)
(
tabSize
,
tmOut
,
spawnImgComp
))
say
"---- after spawnLink"
pid
<-
spawn
node
(
$
(
mkClosure
'i
n
it
)
(
tabSize
,
tmOut
,
spawnImgComp
))
do_start_shm
(
m
-
1
,
tabSize
,
tmOut
,
spawnImgComp
)
((
pid
,
gTabSize
,
tabSize
)
:
workers
,
gTabSize
+
tabSize
)
...
...
@@ -480,7 +482,7 @@ do_start_dist :: [(NodeId, Int, Int, Int, Bool)] -> ([(ProcessId, Int, Int)], In
do_start_dist
[]
acc
=
return
acc
do_start_dist
((
_
,
0
,
_
,
_
,
_
)
:
hosts
)
acc
=
do_start_dist
hosts
acc
do_start_dist
((
node
,
m
,
tabSize
,
tmOut
,
spawnImgComp
)
:
hosts
)
(
workers
,
gTabSize
)
=
do
pid
<-
spawn
Link
node
(
$
(
mkClosure
'i
n
it
)
(
tabSize
,
tmOut
,
spawnImgComp
))
pid
<-
spawn
node
(
$
(
mkClosure
'i
n
it
)
(
tabSize
,
tmOut
,
spawnImgComp
))
do_start_dist
((
node
,
m
-
1
,
tabSize
,
tmOut
,
spawnImgComp
)
:
hosts
)
((
pid
,
gTabSize
,
tabSize
)
:
workers
,
gTabSize
+
tabSize
)
...
...
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