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
163ed855
Commit
163ed855
authored
Nov 17, 2014
by
Yiannis Tsiouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Stats type more module-specific
parent
0a8089a2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
92 deletions
+91
-92
Master.hs
Master.hs
+18
-23
Sequential.hs
Sequential.hs
+8
-6
Table.hs
Table.hs
+15
-18
Worker.hs
Worker.hs
+50
-45
No files found.
Master.hs
View file @
163ed855
...
@@ -7,15 +7,17 @@ import Control.Distributed.Process (Process, ProcessId, NodeId,
...
@@ -7,15 +7,17 @@ import Control.Distributed.Process (Process, ProcessId, NodeId,
match
,
receiveWait
)
match
,
receiveWait
)
import
Credit
(
credit
,
is_one
)
import
Credit
(
credit
,
is_one
)
import
qualified
Sequential
as
Sq
(
Generator
,
orbit
)
import
qualified
Sequential
as
Sq
(
Generator
,
orbit
)
import
Table
(
Stats
,
Vertex
,
freq_from_stat
,
import
Table
(
Vertex
,
freq_from_stat
,
freq_to_stat
,
sum_freqs
)
freq_to_stat
,
sum_freqs
)
import
Worker
(
credit_retd_from_stat
,
import
Worker
(
WorkerStats
,
credit_retd_from_stat
,
init_idle_from_stat
,
init_idle_from_stat
,
max_idle_from_stat
,
max_idle_from_stat
,
min_atomic_credit_from_stat
,
min_atomic_credit_from_stat
,
tail_idle_from_stat
,
tail_idle_from_stat
,
verts_recvd_from_stat
)
verts_recvd_from_stat
)
type
MasterStats
=
[(
String
,
String
)]
data
MaybeHosts
=
Seq
Int
data
MaybeHosts
=
Seq
Int
|
Par
HostInfo
|
Par
HostInfo
data
HostInfo
=
JustOne
(
Int
,
-- Number of processes
data
HostInfo
=
JustOne
(
Int
,
-- Number of processes
...
@@ -91,22 +93,14 @@ type ParConf = ([Sq.Generator], ProcessId, [ProcessId], Int, Int, Bool)
...
@@ -91,22 +93,14 @@ type ParConf = ([Sq.Generator], ProcessId, [ProcessId], Int, Int, Bool)
-- The function returns a pair consisting of the computed orbit and
-- The function returns a pair consisting of the computed orbit and
-- a list of statistics, the first element of which reports overall statistics,
-- a list of statistics, the first element of which reports overall statistics,
-- and all remaining elements report statistics of some worker.
-- and all remaining elements report statistics of some worker.
orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
MaybeHosts
->
([
Vertex
],
[
Stats
])
orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
MaybeHosts
->
([
Vertex
],
[
Master
Stats
])
orbit
gs
xs
(
Seq
tablesize
)
=
Sq
.
orbit
gs
xs
tablesize
orbit
gs
xs
(
Seq
tablesize
)
=
Sq
.
orbit
gs
xs
tablesize
orbit
gs
xs
(
Par
hostInfo
)
=
par_orbit
gs
xs
hostInfo
orbit
gs
xs
(
Par
hostInfo
)
=
par_orbit
gs
xs
hostInfo
-- FIXME Write the proper par_orbit
-- FIXME Write the proper par_orbit
par_orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
HostInfo
->
([
Vertex
],
[
Stats
])
par_orbit
::
[
Vertex
->
Vertex
]
->
[
Vertex
]
->
HostInfo
->
([
Vertex
],
[
Master
Stats
])
par_orbit
gs
xs
hosts
=
([
42
],
[[(
"xxx"
,
"xxx"
)]])
par_orbit
gs
xs
hosts
=
([
42
],
[[(
"xxx"
,
"xxx"
)]])
-- collect_credit collects leftover credit from idle workers until
-- collect_credit collects leftover credit from idle workers until
-- the credit adds up to 1.
-- the credit adds up to 1.
collect_credit
::
[
Int
]
->
Process
()
collect_credit
::
[
Int
]
->
Process
()
...
@@ -119,12 +113,12 @@ collect_credit crdt =
...
@@ -119,12 +113,12 @@ collect_credit crdt =
]
]
-- collect_orbit collects partial orbits and stats from N workers.
-- collect_orbit collects partial orbits and stats from N workers.
collect_orbit
::
Int
->
Int
->
Process
([
Vertex
],
[
Stats
])
collect_orbit
::
Int
->
Int
->
Process
([
Vertex
],
[
Master
Stats
])
collect_orbit
elapsedTime
n
=
do
collect_orbit
elapsedTime
n
=
do
(
orbit
,
stats
)
<-
do_collect_orbit
n
[]
[]
(
orbit
,
stats
)
<-
do_collect_orbit
n
[]
[]
return
(
concat
orbit
,
master_stats
elapsedTime
stats
:
stats
)
return
(
concat
orbit
,
master_stats
elapsedTime
stats
:
stats
)
do_collect_orbit
::
Int
->
[[
Vertex
]]
->
[
Stats
]
->
Process
([[
Vertex
]],
[
Stats
])
do_collect_orbit
::
Int
->
[[
Vertex
]]
->
[
WorkerStats
]
->
Process
([[
Vertex
]],
[
Worker
Stats
])
do_collect_orbit
0
partOrbits
workerStats
=
return
(
partOrbits
,
workerStats
)
do_collect_orbit
0
partOrbits
workerStats
=
return
(
partOrbits
,
workerStats
)
do_collect_orbit
n
partOrbits
workerStats
=
do
do_collect_orbit
n
partOrbits
workerStats
=
do
receiveWait
[
receiveWait
[
...
@@ -165,15 +159,16 @@ clear_spawn_img_comp :: ParConf -> ParConf
...
@@ -165,15 +159,16 @@ 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
-- produce readable statistics
master_stats
::
Int
->
[
Stats
]
->
Stats
master_stats
::
Int
->
[
WorkerStats
]
->
MasterStats
master_stats
elapsedTime
workerStats
=
(
"wall_time"
,
show
elapsedTime
)
master_stats
elapsedTime
workerStats
=
:
(
"vertices_recvd"
,
show
vertsRecvd
)
(
"wall_time"
,
show
elapsedTime
)
:
(
"credit_retd"
,
show
creditRetd
)
:
(
"vertices_recvd"
,
show
vertsRecvd
)
:
(
"min_atomic_credit"
,
show
minAtomicCredit
)
:
(
"credit_retd"
,
show
creditRetd
)
:
(
"max_init_idle_time"
,
show
maxInitIdle
)
:
(
"min_atomic_credit"
,
show
minAtomicCredit
)
:
(
"max_idle_time"
,
show
maxIdle
)
:
(
"max_init_idle_time"
,
show
maxInitIdle
)
:
(
"max_tail_idle_time"
,
show
maxTailIdle
)
:
(
"max_idle_time"
,
show
maxIdle
)
:
freq_to_stat
freq
:
(
"max_tail_idle_time"
,
show
maxTailIdle
)
:
freq_to_stat
freq
where
freq
=
sum_freqs
$
map
freq_from_stat
workerStats
where
freq
=
sum_freqs
$
map
freq_from_stat
workerStats
vertsRecvd
=
sum
$
map
verts_recvd_from_stat
workerStats
vertsRecvd
=
sum
$
map
verts_recvd_from_stat
workerStats
creditRetd
=
sum
$
map
credit_retd_from_stat
workerStats
creditRetd
=
sum
$
map
credit_retd_from_stat
workerStats
...
...
Sequential.hs
View file @
163ed855
...
@@ -10,13 +10,13 @@ module Sequential( -- Types
...
@@ -10,13 +10,13 @@ module Sequential( -- Types
import
Data.Dequeue
(
BankersDequeue
,
fromList
,
popFront
,
pushBack
)
import
Data.Dequeue
(
BankersDequeue
,
fromList
,
popFront
,
pushBack
)
import
Data.Hashable
(
hash
)
import
Data.Hashable
(
hash
)
import
Table
(
Freq
,
Stats
,
Vertex
,
VTable
,
import
Table
(
Freq
,
Vertex
,
VTable
,
freq_to_stat
,
get_freq
,
freq_to_stat
,
get_freq
,
insert
,
is_member
,
new
,
insert
,
is_member
,
new
,
to_list
)
to_list
)
import
Utils
(
now
)
import
Utils
(
now
)
type
Generator
=
Vertex
->
Vertex
type
Generator
=
Vertex
->
Vertex
type
SeqConf
=
([
Generator
],
Int
)
type
SeqConf
=
([
Generator
],
Int
)
type
SeqStats
=
[(
String
,
String
)]
-- DATA
-- DATA
-- Static Machine Configuration:
-- Static Machine Configuration:
...
@@ -32,7 +32,7 @@ type SeqConf = ([Generator], Int)
...
@@ -32,7 +32,7 @@ type SeqConf = ([Generator], Int)
-- where the hash table is of size TableSize.
-- where the hash table is of size TableSize.
-- The function returns a pair consisting of the computed orbit and a singleton
-- The function returns a pair consisting of the computed orbit and a singleton
-- list of statistics (mainly runtime and fill degree of the table).
-- list of statistics (mainly runtime and fill degree of the table).
orbit
::
[
Generator
]
->
[
Vertex
]
->
Int
->
([
Vertex
],
[
Stats
])
orbit
::
[
Generator
]
->
[
Vertex
]
->
Int
->
([
Vertex
],
[
S
eqS
tats
])
orbit
gs
xs
tableSize
=
(
orbit
,
[
stat
])
orbit
gs
xs
tableSize
=
(
orbit
,
[
stat
])
where
-- assemble static configuration
where
-- assemble static configuration
staticMachConf
=
mk_static_mach_conf
gs
tableSize
staticMachConf
=
mk_static_mach_conf
gs
tableSize
...
@@ -99,7 +99,9 @@ get_table_size :: SeqConf -> Int
...
@@ -99,7 +99,9 @@ get_table_size :: SeqConf -> Int
get_table_size
staticMachConf
=
snd
staticMachConf
get_table_size
staticMachConf
=
snd
staticMachConf
-- produce readable statistics
-- produce readable statistics
seq_stats
::
Int
->
Freq
->
Int
->
Stats
seq_stats
::
Int
->
Freq
->
Int
->
S
eqS
tats
seq_stats
elapsedTime
frequency
vertsRecvd
=
seq_stats
elapsedTime
frequency
vertsRecvd
=
(
"wall_time"
,
show
elapsedTime
)
:
(
"vertices_recvd"
,
show
vertsRecvd
)
:
freq_to_stat
frequency
(
"wall_time"
,
show
elapsedTime
)
:
(
"vertices_recvd"
,
show
vertsRecvd
)
:
freq_to_stat
frequency
Table.hs
View file @
163ed855
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
--
--
module
Table
(
-- Types
module
Table
(
-- Types
Freq
Freq
,
Stats
,
VTable
,
VTable
,
Vertex
,
Vertex
-- Functions
-- Functions
...
@@ -30,7 +29,7 @@ import Data.Array (Array, elems, listArray, (!), (//))
...
@@ -30,7 +29,7 @@ import Data.Array (Array, elems, listArray, (!), (//))
type
Freq
=
[
Int
]
type
Freq
=
[
Int
]
type
Vertex
=
Int
type
Vertex
=
Int
type
VTable
=
Array
Int
[
Vertex
]
type
VTable
=
Array
Int
[
Vertex
]
type
Stats
=
[(
String
,
String
)]
type
Table
Stats
=
[(
String
,
String
)]
-- Note: Hash tables have a fixed number of slots but each slot can store
-- Note: Hash tables have a fixed number of slots but each slot can store
-- a list of vertices. The functions is_member/3 and insert/3
-- a list of vertices. The functions is_member/3 and insert/3
...
@@ -106,26 +105,24 @@ sum_freqs fs = foldl (flip sum_freqs2) [] fs
...
@@ -106,26 +105,24 @@ sum_freqs fs = foldl (flip sum_freqs2) [] fs
-- freq_to_stat produces a readable statistics from a table fill frequency;
-- freq_to_stat produces a readable statistics from a table fill frequency;
-- the input frequency F is itself part of the statistics
-- the input frequency F is itself part of the statistics
freq_to_stat
::
Freq
->
Stats
freq_to_stat
::
Freq
->
TableStats
freq_to_stat
frequency
=
[
(
"freq"
,
show
frequency
)
freq_to_stat
frequency
=
,
(
"size"
,
show
$
freq_to_vertices
frequency
)
[
(
"freq"
,
show
frequency
)
,
(
"slots"
,
show
$
freq_to_slots
frequency
)
,
(
"size"
,
show
$
freq_to_vertices
frequency
)
,
(
"nonempty_slots"
,
,
(
"slots"
,
show
$
freq_to_slots
frequency
)
show
$
freq_to_nonempty_slots
frequency
)
,
(
"nonempty_slots"
,
show
$
freq_to_nonempty_slots
frequency
)
,
(
"fill_deg"
,
show
$
fill_deg
frequency
)
,
(
"fill_deg"
,
show
$
fill_deg
frequency
)
,
(
"max_freq"
,
show
$
max_freq
frequency
)
,
(
"max_freq"
,
show
$
max_freq
frequency
)
,
(
"avg_freq"
,
show
$
avg_freq
frequency
)
,
(
"avg_freq"
,
show
$
avg_freq
frequency
)
,
(
"nonempty_avg_freq"
,
,
(
"nonempty_avg_freq"
,
show
$
avg_nonempty_freq
frequency
)
]
show
$
avg_nonempty_freq
frequency
)
]
-- freq_from_stat extracts a table fill frequency from a statistics Stat
-- freq_from_stat extracts a table fill frequency from a statistics Stat
-- (assuming Stat was produced by freq_to_stat/1, otherwise returns []);
-- (assuming Stat was produced by freq_to_stat/1, otherwise returns []);
freq_from_stat
::
Stats
->
Freq
freq_from_stat
::
Table
Stats
->
Freq
freq_from_stat
stat
=
freq_from_stat
stat
=
case
"freq"
`
lookup
`
stat
of
case
"freq"
`
lookup
`
stat
of
Just
val
->
read
val
::
[
Int
]
Just
val
->
read
val
::
[
Int
]
Nothing
->
[]
Nothing
->
[]
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- auxiliary functions
-- auxiliary functions
...
...
Worker.hs
View file @
163ed855
...
@@ -2,31 +2,36 @@
...
@@ -2,31 +2,36 @@
-- orbit-int worker (computing vertices and holding part of hash table)
-- orbit-int worker (computing vertices and holding part of hash table)
--
--
module
Worker
(
--init
module
Worker
(
--init
--, distribute_vertices
--, distribute_vertices
--, send_image
--, send_image
verts_recvd_from_stat
verts_recvd_from_stat
,
credit_retd_from_stat
,
credit_retd_from_stat
,
min_atomic_credit_from_stat
,
min_atomic_credit_from_stat
,
init_idle_from_stat
,
init_idle_from_stat
,
tail_idle_from_stat
,
tail_idle_from_stat
,
max_idle_from_stat
,
max_idle_from_stat
,
WorkerStats
)
where
)
where
import
Control.Distributed.Process
(
NodeId
)
import
Control.Distributed.Process
(
NodeId
)
import
Table
(
Freq
,
Stats
,
freq_to_stat
)
import
Table
(
Freq
,
freq_to_stat
)
import
Utils
(
now
)
import
Utils
(
now
)
type
WorkerStats
=
[(
String
,
String
)]
-- counters/timers record
-- counters/timers record
data
Ct
=
Ct
{
data
Ct
=
Ct
{
verts_recvd
::
Int
-- #vertices received by this server so far
verts_recvd
::
Int
-- #vertices received by this server so far
,
credit_retd
::
Int
-- #times server has returned credit to
,
credit_retd
::
Int
-- #times server has returned credit to master
-- master
,
min_atomic_credit
::
Int
-- minimal atomic credit received so far
,
min_atomic_credit
::
Int
-- minimal atomic credit received so far
,
last_event
::
Int
-- time stamp [ms] of most recent event
,
last_event
::
Int
-- time stamp [ms] of most recent event
,
init_idle
::
Int
-- idle time [ms] between init recv first vertex
,
init_idle
::
Int
-- idle time [ms] between init recv first
,
tail_idle
::
Int
-- idle time [ms] between send last vertex and dump
-- vertex
,
max_idle
::
Int
-- max idle [ms] time between vertices
,
tail_idle
::
Int
-- idle time [ms] between send last vertex
}
-- and dump
,
max_idle
::
Int
-- max idle [ms] time between vertices
}
defaultCt
::
Ct
defaultCt
::
Ct
defaultCt
=
Ct
{
verts_recvd
=
0
defaultCt
=
Ct
{
verts_recvd
=
0
...
@@ -39,49 +44,49 @@ defaultCt = Ct { verts_recvd = 0
...
@@ -39,49 +44,49 @@ defaultCt = Ct { verts_recvd = 0
}
}
-- produce readable statistics
-- produce readable statistics
worker_stats
::
NodeId
->
Freq
->
Ct
->
Stats
worker_stats
::
NodeId
->
Freq
->
Ct
->
WorkerStats
worker_stats
node
frequency
statData
=
(
"node"
,
show
node
)
worker_stats
node
frequency
statData
=
:
(
"vertices_recvd"
,
show
$
verts_recvd
statData
)
(
"node"
,
show
node
)
:
(
"credit_retd"
,
show
$
credit_retd
statData
)
:
(
"vertices_recvd"
,
show
$
verts_recvd
statData
)
:
(
"min_atomic_credit"
,
show
$
min_atomic_credit
statData
)
:
(
"credit_retd"
,
show
$
credit_retd
statData
)
:
(
"init_idle_time"
,
show
$
init_idle
statData
)
:
(
"min_atomic_credit"
,
show
$
min_atomic_credit
statData
)
:
(
"max_idle_time"
,
show
$
max_idle
statData
)
:
(
"init_idle_time"
,
show
$
init_idle
statData
)
:
(
"tail_idle_time"
,
show
$
tail_idle
statData
)
:
(
"max_idle_time"
,
show
$
max_idle
statData
)
:
freq_to_stat
frequency
:
(
"tail_idle_time"
,
show
$
tail_idle
statData
)
:
freq_to_stat
frequency
verts_recvd_from_stat
::
Stats
->
Int
verts_recvd_from_stat
::
Worker
Stats
->
Int
verts_recvd_from_stat
stat
=
verts_recvd_from_stat
stat
=
case
"vertices_recvd"
`
lookup
`
stat
of
case
"vertices_recvd"
`
lookup
`
stat
of
Just
val
->
read
val
::
Int
Just
val
->
read
val
::
Int
Nothing
->
0
-- instead of false
Nothing
->
0
-- instead of false
credit_retd_from_stat
::
Stats
->
Int
credit_retd_from_stat
::
Worker
Stats
->
Int
credit_retd_from_stat
stat
=
credit_retd_from_stat
stat
=
case
"credit_retd"
`
lookup
`
stat
of
case
"credit_retd"
`
lookup
`
stat
of
Just
val
->
read
val
::
Int
Just
val
->
read
val
::
Int
Nothing
->
0
-- instead of false
Nothing
->
0
-- instead of false
min_atomic_credit_from_stat
::
Stats
->
Int
min_atomic_credit_from_stat
::
Worker
Stats
->
Int
min_atomic_credit_from_stat
stat
=
min_atomic_credit_from_stat
stat
=
case
"min_atomic_credit"
`
lookup
`
stat
of
case
"min_atomic_credit"
`
lookup
`
stat
of
Just
val
->
read
val
::
Int
Just
val
->
read
val
::
Int
Nothing
->
0
-- instead of false
Nothing
->
0
-- instead of false
init_idle_from_stat
::
Stats
->
Int
init_idle_from_stat
::
Worker
Stats
->
Int
init_idle_from_stat
stat
=
init_idle_from_stat
stat
=
case
"init_idle_time"
`
lookup
`
stat
of
case
"init_idle_time"
`
lookup
`
stat
of
Just
val
->
read
val
::
Int
Just
val
->
read
val
::
Int
Nothing
->
0
-- instead of false
Nothing
->
0
-- instead of false
tail_idle_from_stat
::
Stats
->
Int
tail_idle_from_stat
::
Worker
Stats
->
Int
tail_idle_from_stat
stat
=
tail_idle_from_stat
stat
=
case
"tail_idle_time"
`
lookup
`
stat
of
case
"tail_idle_time"
`
lookup
`
stat
of
Just
val
->
read
val
::
Int
Just
val
->
read
val
::
Int
Nothing
->
0
-- instead of false
Nothing
->
0
-- instead of false
max_idle_from_stat
::
Stats
->
Int
max_idle_from_stat
::
Worker
Stats
->
Int
max_idle_from_stat
stat
=
max_idle_from_stat
stat
=
case
"max_idle_time"
`
lookup
`
stat
of
case
"max_idle_time"
`
lookup
`
stat
of
Just
val
->
read
val
::
Int
Just
val
->
read
val
::
Int
Nothing
->
0
-- instead of false
Nothing
->
0
-- instead of false
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