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
4f4a7cb9
Commit
4f4a7cb9
authored
Nov 19, 2014
by
Aggelos Giantsios
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GenClos data in Utils to use in Bench
parent
e8812d3b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
31 deletions
+74
-31
Bench.hs
Bench.hs
+8
-9
MasterWorker.hs
MasterWorker.hs
+6
-19
Sequential.hs
Sequential.hs
+2
-2
Table.hs
Table.hs
+1
-1
Utils.hs
Utils.hs
+57
-0
No files found.
Bench.hs
View file @
4f4a7cb9
...
@@ -6,14 +6,13 @@ module Bench( -- sequential benchmarks
...
@@ -6,14 +6,13 @@ module Bench( -- sequential benchmarks
,
dist
,
dist_seq
,
dist
,
dist_seq
)
where
)
where
import
Control.Distributed.Process
(
Process
,
NodeId
)
import
Control.Distributed.Process
import
Data.List
(
lookup
)
import
Data.List
(
lookup
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
Prelude
hiding
(
seq
)
import
Prelude
hiding
(
seq
)
import
MasterWorker
(
HostInfo
(
..
),
MaybeHosts
(
..
),
import
MasterWorker
(
HostInfo
(
..
),
MaybeHosts
(
..
),
GenClos
,
MasterStats
,
orbit
)
MasterStats
,
orbit
)
import
Table
(
Vertex
)
import
Utils
import
Utils
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
...
@@ -23,32 +22,32 @@ import Utils
...
@@ -23,32 +22,32 @@ import Utils
-- * number of processors P > 0 (per node)
-- * number of processors P > 0 (per node)
-- * list of Workers (in short node name format 'name@host')
-- * list of Workers (in short node name format 'name@host')
-- sequential orbit computation
-- sequential orbit computation
seq
::
(
Int
->
GenClos
)
->
Int
->
Process
String
seq
::
(
Vertex
->
GenClos
)
->
Vertex
->
Process
String
seq
generators
n
=
seq
generators
n
=
orbit
(
generators
n
)
[
0
]
(
Seq
(
2
*
n
))
>>=
return
.
sz
.
snd
orbit
(
generators
n
)
[
0
]
(
Seq
(
2
*
n
))
>>=
return
.
sz
.
snd
-- parallel orbit computation (par_seq/3 does not spawn image computation)
-- parallel orbit computation (par_seq/3 does not spawn image computation)
par
::
(
Int
->
GenClos
)
->
Int
->
Int
->
Process
String
par
::
(
Vertex
->
GenClos
)
->
Vertex
->
Int
->
Process
String
par
generators
n
p
=
par
generators
n
p
=
orbit
(
generators
n
)
[
0
]
orbit
(
generators
n
)
[
0
]
(
Par
(
JustOne
(
p
,
((
2
*
n
)
`
div
`
p
)
+
1
,
0
,
True
)))
(
Par
(
JustOne
(
p
,
((
2
*
n
)
`
div
`
p
)
+
1
,
0
,
True
)))
>>=
return
.
sz
.
snd
>>=
return
.
sz
.
snd
par_seq
::
(
Int
->
GenClos
)
->
Int
->
Int
->
Process
String
par_seq
::
(
Vertex
->
GenClos
)
->
Vertex
->
Int
->
Process
String
par_seq
generators
n
p
=
par_seq
generators
n
p
=
orbit
(
generators
n
)
[
0
]
orbit
(
generators
n
)
[
0
]
(
Par
(
JustOne
(
p
,
((
2
*
n
)
`
div
`
p
)
+
1
,
0
,
False
)))
(
Par
(
JustOne
(
p
,
((
2
*
n
)
`
div
`
p
)
+
1
,
0
,
False
)))
>>=
return
.
sz
.
snd
>>=
return
.
sz
.
snd
-- distributed orbit computation (dist_seq/4 does not spawn image computation)
-- distributed orbit computation (dist_seq/4 does not spawn image computation)
dist
::
(
Int
->
GenClos
)
->
Int
->
Int
->
[
NodeId
]
->
Process
String
dist
::
(
Vertex
->
GenClos
)
->
Vertex
->
Int
->
[
NodeId
]
->
Process
String
dist
generators
n
p
workers
=
dist
generators
n
p
workers
=
orbit
(
generators
n
)
[
0
]
orbit
(
generators
n
)
[
0
]
(
Par
(
Many
[(
h
,
p
,
(
2
*
n
)
`
div
`
(
w
*
p
)
+
1
,
1
,
True
)
|
h
<-
workers
]))
(
Par
(
Many
[(
h
,
p
,
(
2
*
n
)
`
div
`
(
w
*
p
)
+
1
,
1
,
True
)
|
h
<-
workers
]))
>>=
return
.
sz
.
snd
>>=
return
.
sz
.
snd
where
w
=
length
workers
where
w
=
length
workers
dist_seq
::
(
Int
->
GenClos
)
->
Int
->
Int
->
[
NodeId
]
->
Process
String
dist_seq
::
(
Vertex
->
GenClos
)
->
Vertex
->
Int
->
[
NodeId
]
->
Process
String
dist_seq
generators
n
p
workers
=
dist_seq
generators
n
p
workers
=
orbit
(
generators
n
)
[
0
]
orbit
(
generators
n
)
[
0
]
(
Par
(
Many
[(
h
,
p
,
(
2
*
n
)
`
div
`
(
w
*
p
)
+
1
,
1
,
False
)
|
h
<-
workers
]))
(
Par
(
Many
[(
h
,
p
,
(
2
*
n
)
`
div
`
(
w
*
p
)
+
1
,
1
,
False
)
|
h
<-
workers
]))
...
...
MasterWorker.hs
View file @
4f4a7cb9
{-# LANGUAGE TemplateHaskell
, DeriveDataTypeable
#-}
{-# LANGUAGE TemplateHaskell #-}
--
--
-- orbit-int master (controlling orbit computation)
-- orbit-int master (controlling orbit computation)
--
--
module
MasterWorker
(
-- Master
module
MasterWorker
(
-- Master
GenClos
HostInfo
(
..
)
,
HostInfo
(
..
)
,
MasterStats
,
MasterStats
,
MaybeHosts
(
..
)
,
MaybeHosts
(
..
)
,
orbit
,
orbit
...
@@ -26,27 +25,15 @@ module MasterWorker( -- Master
...
@@ -26,27 +25,15 @@ module MasterWorker( -- Master
import
Control.Distributed.Process
import
Control.Distributed.Process
import
Control.Distributed.Process.Closure
import
Control.Distributed.Process.Closure
import
Data.Binary
import
Data.Hashable
(
hash
)
import
Data.Hashable
(
hash
)
import
Data.Maybe
(
fromJust
)
import
Data.Maybe
(
fromJust
)
import
Data.Typeable
import
Prelude
hiding
(
init
)
import
Prelude
hiding
(
init
)
import
Credit
import
Credit
import
qualified
Sequential
as
Sq
(
Generator
,
orbit
)
import
qualified
Sequential
as
Sq
(
orbit
)
import
Table
import
Table
import
Utils
(
dispatcher
,
now
)
import
Utils
(
GenClos
(
..
),
Generator
,
dispatcher
,
now
)
-- Trying to serialize ParConf closures...
newtype
GenClos
=
GenClos
(
String
,
Int
,
[
Sq
.
Generator
])
deriving
(
Typeable
)
instance
Show
GenClos
where
showsPrec
p
(
GenClos
(
name
,
_
,
_
))
=
(
name
++
)
instance
Binary
GenClos
where
put
(
GenClos
(
name
,
n
,
_
))
=
put
(
name
,
n
)
get
=
get
>>=
\
(
name
,
n
)
->
return
$
GenClos
(
name
,
n
,
dispatcher
name
n
)
-- counters/timers record
-- counters/timers record
data
Ct
=
Ct
{
verts_recvd
::
Int
-- #vertices received by this server so far
data
Ct
=
Ct
{
verts_recvd
::
Int
-- #vertices received by this server so far
...
@@ -281,7 +268,7 @@ distribute_vetices staticMachConf credit (x : xs) = do
...
@@ -281,7 +268,7 @@ distribute_vetices staticMachConf credit (x : xs) = do
-- send_image sends image of X under G to the worker determined by
-- send_image sends image of X under G to the worker determined by
-- the hash of G(X); the message is tagged with atomic credit K.
-- the hash of G(X); the message is tagged with atomic credit K.
send_image
::
ParConf
->
Vertex
->
Sq
.
Generator
->
ACredit
->
Process
()
send_image
::
ParConf
->
Vertex
->
Generator
->
ACredit
->
Process
()
send_image
staticMachConf
x
g
k
=
send_vertex
staticMachConf
(
g
x
)
k
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
-- send_vertex hashes vertex X and sends it to the worker determined by
...
...
Sequential.hs
View file @
4f4a7cb9
...
@@ -12,9 +12,9 @@ import Data.Hashable (hash)
...
@@ -12,9 +12,9 @@ import Data.Hashable (hash)
import
Table
(
Freq
,
Vertex
,
VTable
,
freq_to_stat
,
get_freq
,
import
Table
(
Freq
,
Vertex
,
VTable
,
freq_to_stat
,
get_freq
,
insert
,
is_member
,
new
,
to_list
)
insert
,
is_member
,
new
,
to_list
)
import
Utils
(
now
)
import
Utils
(
Generator
,
now
)
type
Generator
=
Vertex
->
Vertex
type
SeqConf
=
([
Generator
],
Int
)
type
SeqConf
=
([
Generator
],
Int
)
type
SeqStats
=
[(
String
,
String
)]
type
SeqStats
=
[(
String
,
String
)]
...
...
Table.hs
View file @
4f4a7cb9
...
@@ -25,9 +25,9 @@ module Table( -- Types
...
@@ -25,9 +25,9 @@ module Table( -- Types
)
where
)
where
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
import
Utils
(
Vertex
)
type
Freq
=
[
Int
]
type
Freq
=
[
Int
]
type
Vertex
=
Int
type
VTable
=
Array
Int
[
Vertex
]
type
VTable
=
Array
Int
[
Vertex
]
type
TableStats
=
[(
String
,
String
)]
type
TableStats
=
[(
String
,
String
)]
...
...
Utils.hs
View file @
4f4a7cb9
{-# LANGUAGE DeriveDataTypeable #-}
module
Utils
where
module
Utils
where
import
Data.Binary
import
Data.Typeable
-- Trying to serialize ParConf closures...
newtype
GenClos
=
GenClos
(
String
,
Int
,
[
Generator
])
deriving
(
Typeable
)
instance
Show
GenClos
where
showsPrec
p
(
GenClos
(
name
,
_
,
_
))
=
(
name
++
)
instance
Binary
GenClos
where
put
(
GenClos
(
name
,
n
,
_
))
=
put
(
name
,
n
)
get
=
get
>>=
\
(
name
,
n
)
->
return
$
GenClos
(
name
,
n
,
dispatcher
name
n
)
type
Generator
=
Vertex
->
Vertex
type
Vertex
=
Int
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- generators
-- generators
...
@@ -58,6 +76,7 @@ f5 n x = r n $ (fib (p3 10 0 (s5 0 900 999 1000 (r 1000 x)))) + p2 1 x
...
@@ -58,6 +76,7 @@ f5 n x = r n $ (fib (p3 10 0 (s5 0 900 999 1000 (r 1000 x)))) + p2 1 x
-- sets (= lists) of generators
-- sets (= lists) of generators
g
_
=
[]
g
_
=
[]
gg
n
=
GenClos
(
"g"
,
n
,
(
g
n
))
g1
n
=
[
f1
n
]
g1
n
=
[
f1
n
]
g2
n
=
[
f2
n
]
g2
n
=
[
f2
n
]
...
@@ -65,6 +84,13 @@ g3 n = [f3 n]
...
@@ -65,6 +84,13 @@ g3 n = [f3 n]
g4
n
=
[
f4
n
]
g4
n
=
[
f4
n
]
g5
n
=
[
f5
n
]
g5
n
=
[
f5
n
]
gg1
,
gg2
,
gg3
,
gg4
,
gg5
::
Vertex
->
GenClos
gg1
n
=
GenClos
(
"g1"
,
n
,
(
g1
n
))
gg2
n
=
GenClos
(
"g2"
,
n
,
(
g2
n
))
gg3
n
=
GenClos
(
"g3"
,
n
,
(
g3
n
))
gg4
n
=
GenClos
(
"g4"
,
n
,
(
g4
n
))
gg5
n
=
GenClos
(
"g5"
,
n
,
(
g5
n
))
g12
n
=
g1
n
++
g2
n
g12
n
=
g1
n
++
g2
n
g13
n
=
g1
n
++
g3
n
g13
n
=
g1
n
++
g3
n
g14
n
=
g1
n
++
g4
n
g14
n
=
g1
n
++
g4
n
...
@@ -76,6 +102,15 @@ g34 n = g3 n ++ g4 n
...
@@ -76,6 +102,15 @@ g34 n = g3 n ++ g4 n
g35
n
=
g3
n
++
g5
n
g35
n
=
g3
n
++
g5
n
g45
n
=
g4
n
++
g5
n
g45
n
=
g4
n
++
g5
n
gg12
,
gg13
,
gg14
,
gg15
,
gg23
,
gg24
,
gg24
::
Vertex
->
GenClos
gg12
n
=
GenClos
(
"g12"
,
n
,
(
g12
n
))
gg13
n
=
GenClos
(
"g13"
,
n
,
(
g13
n
))
gg14
n
=
GenClos
(
"g14"
,
n
,
(
g14
n
))
gg15
n
=
GenClos
(
"g15"
,
n
,
(
g15
n
))
gg23
n
=
GenClos
(
"g23"
,
n
,
(
g23
n
))
gg24
n
=
GenClos
(
"g24"
,
n
,
(
g24
n
))
gg25
n
=
GenClos
(
"g25"
,
n
,
(
g25
n
))
g123
n
=
g12
n
++
g3
n
g123
n
=
g12
n
++
g3
n
g124
n
=
g12
n
++
g4
n
g124
n
=
g12
n
++
g4
n
g125
n
=
g12
n
++
g5
n
g125
n
=
g12
n
++
g5
n
...
@@ -87,14 +122,36 @@ g235 n = g23 n ++ g5 n
...
@@ -87,14 +122,36 @@ g235 n = g23 n ++ g5 n
g245
n
=
g24
n
++
g5
n
g245
n
=
g24
n
++
g5
n
g345
n
=
g34
n
++
g5
n
g345
n
=
g34
n
++
g5
n
gg123
,
gg124
,
gg125
,
gg134
,
gg135
,
gg145
,
gg234
,
gg235
,
gg245
,
gg345
::
Vertex
->
GenClos
gg123
n
=
GenClos
(
"g123"
,
n
,
(
g123
n
))
gg124
n
=
GenClos
(
"g124"
,
n
,
(
g124
n
))
gg125
n
=
GenClos
(
"g125"
,
n
,
(
g125
n
))
gg134
n
=
GenClos
(
"g134"
,
n
,
(
g134
n
))
gg135
n
=
GenClos
(
"g135"
,
n
,
(
g135
n
))
gg145
n
=
GenClos
(
"g145"
,
n
,
(
g145
n
))
gg234
n
=
GenClos
(
"g234"
,
n
,
(
g234
n
))
gg235
n
=
GenClos
(
"g235"
,
n
,
(
g235
n
))
gg245
n
=
GenClos
(
"g245"
,
n
,
(
g245
n
))
gg345
n
=
GenClos
(
"g345"
,
n
,
(
g345
n
))
g1234
n
=
g123
n
++
g4
n
g1234
n
=
g123
n
++
g4
n
g1235
n
=
g123
n
++
g5
n
g1235
n
=
g123
n
++
g5
n
g1245
n
=
g124
n
++
g5
n
g1245
n
=
g124
n
++
g5
n
g1345
n
=
g134
n
++
g5
n
g1345
n
=
g134
n
++
g5
n
g2345
n
=
g234
n
++
g5
n
g2345
n
=
g234
n
++
g5
n
gg1234
,
gg1235
,
gg1245
,
gg1345
,
gg2345
::
Vertex
->
GenClos
gg1234
n
=
GenClos
(
"g1234"
,
n
,
(
g1234
n
))
gg1235
n
=
GenClos
(
"g1235"
,
n
,
(
g1235
n
))
gg1245
n
=
GenClos
(
"g1245"
,
n
,
(
g1245
n
))
gg1345
n
=
GenClos
(
"g1345"
,
n
,
(
g1345
n
))
gg2345
n
=
GenClos
(
"g2345"
,
n
,
(
g2345
n
))
g12345
n
=
g1234
n
++
g5
n
g12345
n
=
g1234
n
++
g5
n
gg12345
::
Vertex
->
GenClos
gg12345
n
=
GenClos
(
"g12345"
,
n
,
(
g12345
n
))
dispatcher
::
String
->
Int
->
[
Int
->
Int
]
dispatcher
::
String
->
Int
->
[
Int
->
Int
]
dispatcher
"g"
=
g
dispatcher
"g"
=
g
dispatcher
"g1"
=
g1
dispatcher
"g1"
=
g1
...
...
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