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
39aaad5c
Commit
39aaad5c
authored
Nov 20, 2014
by
Yiannis Tsiouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add proper main for setting-up the nodes
parent
5a9af884
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
17 deletions
+32
-17
Bench.hs
Bench.hs
+31
-17
MasterWorker.hs
MasterWorker.hs
+1
-0
No files found.
Bench.hs
View file @
39aaad5c
...
...
@@ -4,17 +4,16 @@ module Bench( -- sequential benchmarks
,
par
,
par_seq
-- distributed benhcmarks
,
dist
,
dist_seq
,
seqTest
,
main
)
where
import
Control.Concurrent
(
threadDelay
)
import
Control.Distributed.Process
import
Control.Distributed.Process.Node
import
qualified
Control.Distributed.Process.Backend.SimpleLocalnet
as
SLN
import
Prelude
hiding
(
seq
)
import
Network.Transport.TCP
import
System.Environment
(
getArgs
)
import
MasterWorker
(
HostInfo
(
..
),
MaybeHosts
(
..
),
MasterStats
,
orbit
)
import
MasterWorker
import
Utils
-----------------------------------------------------------------------------
...
...
@@ -63,11 +62,26 @@ sz (mainStats : _) =
Nothing
->
"false"
Just
s
->
"{size,"
++
s
++
"}"
seqTest
::
IO
()
seqTest
=
do
Right
t
<-
createTransport
"127.0.0.1"
"10504"
defaultTCPParameters
node
<-
newLocalNode
t
initRemoteTable
runProcess
node
$
do
res
<-
par
gg13
11
2
rtable
::
RemoteTable
rtable
=
MasterWorker
.
__remoteTable
initRemoteTable
main
::
IO
()
main
=
do
args
<-
getArgs
case
args
of
[
"master"
,
host
,
port
]
->
do
b
<-
SLN
.
initializeBackend
host
port
rtable
print
$
"Starting master @ "
++
host
++
":"
++
port
++
" with slaves:"
SLN
.
startMaster
b
$
\
slaves
->
do
liftIO
$
print
$
" "
++
show
slaves
res
<-
dist
gg13
11
2
slaves
liftIO
$
print
res
threadDelay
(
1
*
1000000
)
[
"slave"
,
host
,
port
]
->
do
b
<-
SLN
.
initializeBackend
host
port
rtable
print
$
"Starting slave @ "
++
host
++
":"
++
port
SLN
.
startSlave
b
-- 1 second wait. Otherwise the main thread can terminate before
-- our messages reach the logging process or get flushed to stdio
--threadDelay (1 * 1000000)
MasterWorker.hs
View file @
39aaad5c
...
...
@@ -21,6 +21,7 @@ module MasterWorker( -- Master
,
tail_idle_from_stat
,
max_idle_from_stat
,
WorkerStats
,
__remoteTable
)
where
import
Control.Distributed.Process
...
...
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