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
421e000b
Commit
421e000b
authored
Nov 17, 2014
by
Yiannis Tsiouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force 4-space indentation and line-wrap
parent
163ed855
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
39 deletions
+48
-39
Master.hs
Master.hs
+26
-19
Sequential.hs
Sequential.hs
+22
-20
No files found.
Master.hs
View file @
421e000b
...
...
@@ -93,12 +93,14 @@ type ParConf = ([Sq.Generator], ProcessId, [ProcessId], Int, Int, Bool)
-- The function returns a pair consisting of the computed orbit and
-- a list of statistics, the first element of which reports overall statistics,
-- and all remaining elements report statistics of some worker.
orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
MaybeHosts
->
([
Vertex
],
[
MasterStats
])
orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
MaybeHosts
->
([
Vertex
],
[
MasterStats
])
orbit
gs
xs
(
Seq
tablesize
)
=
Sq
.
orbit
gs
xs
tablesize
orbit
gs
xs
(
Par
hostInfo
)
=
par_orbit
gs
xs
hostInfo
-- FIXME Write the proper par_orbit
par_orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
HostInfo
->
([
Vertex
],
[
MasterStats
])
par_orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
HostInfo
->
([
Vertex
],
[
MasterStats
])
par_orbit
gs
xs
hosts
=
([
42
],
[[(
"xxx"
,
"xxx"
)]])
-- collect_credit collects leftover credit from idle workers until
...
...
@@ -118,7 +120,8 @@ collect_orbit elapsedTime n = do
(
orbit
,
stats
)
<-
do_collect_orbit
n
[]
[]
return
(
concat
orbit
,
master_stats
elapsedTime
stats
:
stats
)
do_collect_orbit
::
Int
->
[[
Vertex
]]
->
[
WorkerStats
]
->
Process
([[
Vertex
]],
[
WorkerStats
])
do_collect_orbit
::
Int
->
[[
Vertex
]]
->
[
WorkerStats
]
->
Process
([[
Vertex
]],
[
WorkerStats
])
do_collect_orbit
0
partOrbits
workerStats
=
return
(
partOrbits
,
workerStats
)
do_collect_orbit
n
partOrbits
workerStats
=
do
receiveWait
[
...
...
@@ -130,8 +133,10 @@ do_collect_orbit n partOrbits workerStats = do
-- auxiliary functions
-- functions operating on the StaticMachConf
mk_static_mach_conf
::
[
Sq
.
Generator
]
->
ProcessId
->
[
ProcessId
]
->
Int
->
ParConf
mk_static_mach_conf
gs
master
workers
globalTableSize
=
(
gs
,
master
,
workers
,
globalTableSize
,
0
,
True
)
mk_static_mach_conf
::
[
Sq
.
Generator
]
->
ProcessId
->
[
ProcessId
]
->
Int
->
ParConf
mk_static_mach_conf
gs
master
workers
globalTableSize
=
(
gs
,
master
,
workers
,
globalTableSize
,
0
,
True
)
get_gens
::
ParConf
->
[
Sq
.
Generator
]
get_gens
(
gs
,
_
,
_
,
_
,
_
,
_
)
=
gs
...
...
@@ -153,10 +158,12 @@ get_spawn_img_comp (_, _, _, _, _, spawmImgComp) = spawmImgComp
set_idle_timeout
::
ParConf
->
Int
->
ParConf
set_idle_timeout
(
gs
,
mst
,
wks
,
gts
,
timeout
,
spic
)
x
=
(
gs
,
mst
,
wks
,
gts
,
x
,
spic
)
set_idle_timeout
(
gs
,
mst
,
wks
,
gts
,
timeout
,
spic
)
x
=
(
gs
,
mst
,
wks
,
gts
,
x
,
spic
)
clear_spawn_img_comp
::
ParConf
->
ParConf
clear_spawn_img_comp
(
gs
,
mst
,
wks
,
gts
,
tmt
,
spawmImgComp
)
=
(
gs
,
mst
,
wks
,
gts
,
tmt
,
False
)
clear_spawn_img_comp
(
gs
,
mst
,
wks
,
gts
,
tmt
,
spawmImgComp
)
=
(
gs
,
mst
,
wks
,
gts
,
tmt
,
False
)
-- produce readable statistics
master_stats
::
Int
->
[
WorkerStats
]
->
MasterStats
...
...
Sequential.hs
View file @
421e000b
...
...
@@ -54,34 +54,37 @@ orbit gs xs tableSize = (orbit, [stat])
-- Table -- hash table holding vertices
-- Queue -- work queue
-- VertsRecvd -- number of vertices removed from the Queue so far
vertex_server
::
SeqConf
->
VTable
->
BankersDequeue
Vertex
->
Int
->
(
VTable
,
Int
)
vertex_server
::
SeqConf
->
VTable
->
BankersDequeue
Vertex
->
Int
->
(
VTable
,
Int
)
vertex_server
staticMachConf
table
queue
vertsRecvd
=
case
popFront
queue
of
(
Nothing
,
_
)
->
(
table
,
vertsRecvd
)
(
Just
x
,
queue1
)
->
vertex_server
staticMachConf
newTable
newQueue
(
vertsRecvd
+
1
)
where
(
newTable
,
newQueue
)
=
handle_vertex
staticMachConf
x
table
queue1
(
Just
x
,
queue1
)
->
let
(
newTable
,
newQueue
)
=
handle_vertex
staticMachConf
x
table
queue1
in
vertex_server
staticMachConf
newTable
newQueue
(
vertsRecvd
+
1
)
-- handle_vertex checks whether vertex X is stored in Table;
-- if not, it is in inserted and the images of the generators
-- are pushed into the work queue.
handle_vertex
::
SeqConf
->
Vertex
->
VTable
->
BankersDequeue
Vertex
->
(
VTable
,
BankersDequeue
Vertex
)
handle_vertex
::
SeqConf
->
Vertex
->
VTable
->
BankersDequeue
Vertex
->
(
VTable
,
BankersDequeue
Vertex
)
handle_vertex
staticMachConf
x
table
queue
=
case
is_member
x
slot
table
of
-- check whether X is already in Table
-- X already in table; do nothing
True
->
(
table
,
queue
)
-- X not in table
False
->
(
newTable
,
newQueue
)
-- return updated table and queue
where
newTable
=
insert
x
slot
table
-- insert X at Slot
xs
=
[
g
x
|
g
<-
gs
]
-- compute images of X under generators Gs
newQueue
=
foldl
pushBack
queue
xs
-- enquene Xs
where
gs
=
get_gens
staticMachConf
slot
=
hash_vertex
staticMachConf
x
-- compute Slot
False
->
let
-- insert X at Slot
newTable
=
insert
x
slot
table
-- compute images of X under generators Gs and enqueue
xs
=
[
g
x
|
g
<-
get_gens
staticMachConf
]
newQueue
=
foldl
pushBack
queue
xs
in
(
newTable
,
newQueue
)
-- return updated table and queue
where
slot
=
hash_vertex
staticMachConf
x
-- compute Slot
-- hash_vertex computes the hash table slot of vertex X
hash_vertex
::
SeqConf
->
Vertex
->
Int
hash_vertex
staticMachConf
x
=
hsh
`
rem
`
tableSize
hash_vertex
staticMachConf
x
=
hsh
`
rem
`
tableSize
where
tableSize
=
get_table_size
staticMachConf
hsh
=
abs
$
hash
x
...
...
@@ -104,4 +107,3 @@ seq_stats elapsedTime frequency vertsRecvd =
(
"wall_time"
,
show
elapsedTime
)
:
(
"vertices_recvd"
,
show
vertsRecvd
)
:
freq_to_stat
frequency
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