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
88100d3d
Commit
88100d3d
authored
Nov 18, 2014
by
Yiannis Tsiouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring + trying to identify the problem (not working)
parent
f9fba183
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
MasterWorker.hs
MasterWorker.hs
+14
-12
No files found.
MasterWorker.hs
View file @
88100d3d
...
@@ -23,9 +23,10 @@ import Control.Distributed.Process (Process, ProcessId, NodeId,
...
@@ -23,9 +23,10 @@ import Control.Distributed.Process (Process, ProcessId, NodeId,
import
Data.Hashable
(
hash
)
import
Data.Hashable
(
hash
)
import
Data.Maybe
(
fromJust
)
import
Data.Maybe
(
fromJust
)
import
Credit
(
ACredit
,
Credit
,
credit
,
credit_atomic
,
import
Credit
(
ACredit
,
Credit
,
credit
,
debit_atomic
,
debit_atomic_nz
,
credit_atomic
,
debit_atomic
,
is_one
,
is_zero
,
zero
)
debit_atomic_nz
,
is_one
,
is_zero
,
zero
)
import
qualified
Sequential
as
Sq
(
Generator
,
orbit
)
import
qualified
Sequential
as
Sq
(
Generator
,
orbit
)
import
Table
(
Freq
,
Vertex
,
VTable
,
import
Table
(
Freq
,
Vertex
,
VTable
,
freq_from_stat
,
freq_to_stat
,
freq_from_stat
,
freq_to_stat
,
...
@@ -234,18 +235,19 @@ defaultCt = Ct { verts_recvd = 0
...
@@ -234,18 +235,19 @@ defaultCt = Ct { verts_recvd = 0
-- initialise worker
-- initialise worker
init
::
Int
->
Int
->
Bool
->
Process
()
init
::
Int
->
Int
->
Bool
->
Process
()
init
localTableSize
idleTimeout
spawnImgComp
=
do
init
localTableSize
idleTimeout
spawnImgComp
=
let
table
=
new
localTableSize
receiveWait
[
receiveWait
[
match
$
\
(
"init"
,
staticMachConf0
)
->
do
match
$
\
(
"init"
,
staticMachConf0
)
->
do
let
statData
=
defaultCt
let
staticMachConf1
=
set_idle_timeout
staticMachConf0
idleTimeout
staticMachConf1
=
set_idle_timeout
staticMachConf0
idleTimeout
staticMachConf
=
staticMachConf
=
if
spawnImgComp
then
staticMachConf1
if
spawnImgComp
then
staticMachConf1
else
clear_spawn_img_comp
staticMachConf1
else
clear_spawn_img_comp
staticMachConf1
credit
=
zero
vertex_server
staticMachConf
zero
(
new
localTableSize
)
defaultCt
vertex_server
staticMachConf
credit
table
statData
]
]
vertex_server
::
ParConf
->
Credit
->
VTable
->
Ct
->
Process
()
vertex_server
_
_
_
_
=
return
()
{-
-- main worker loop: server handling vertex messages;
-- main worker loop: server handling vertex messages;
-- StaticMachConf: info about machine configuration
-- StaticMachConf: info about machine configuration
-- Credit: credit currently held by the server,
-- Credit: credit currently held by the server,
...
@@ -286,6 +288,7 @@ vertex_server staticMachConf credit table statData = do
...
@@ -286,6 +288,7 @@ vertex_server staticMachConf credit table statData = do
let newStatData = statData {credit_retd = newCreditRetd}
let newStatData = statData {credit_retd = newCreditRetd}
vertex_server staticMachConf zero table newStatData
vertex_server staticMachConf zero table newStatData
Just _ -> return ()
Just _ -> return ()
-}
-- handle_vertex checks whether vertex X is stored in Slot of Table;
-- handle_vertex checks whether vertex X is stored in Slot of Table;
-- if not, it is in inserted there and the images of the generators
-- if not, it is in inserted there and the images of the generators
...
@@ -294,7 +297,6 @@ vertex_server staticMachConf credit table statData = do
...
@@ -294,7 +297,6 @@ vertex_server staticMachConf credit table statData = do
handle_vertex
::
ParConf
->
Vertex
->
Int
->
Credit
->
VTable
handle_vertex
::
ParConf
->
Vertex
->
Int
->
Credit
->
VTable
->
Process
(
Credit
,
VTable
)
->
Process
(
Credit
,
VTable
)
handle_vertex
staticMachConf
x
slot
credit
table
handle_vertex
staticMachConf
x
slot
credit
table
-- check whether x is already in table
|
is_member
x
slot
table
=
return
(
credit
,
table
)
-- x already in table;
|
is_member
x
slot
table
=
return
(
credit
,
table
)
-- x already in table;
-- do nothing
-- do nothing
|
otherwise
=
do
-- x not in table
|
otherwise
=
do
-- x not in table
...
...
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