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
c7bb52d6
Commit
c7bb52d6
authored
Nov 14, 2014
by
Aggelos Giantsios
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add type aliases for the configuration
The configuration is the type of the StaticMachConf variable
parent
fba696a6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
Sequential.hs
Sequential.hs
+7
-8
Types.hs
Types.hs
+5
-0
No files found.
Sequential.hs
View file @
c7bb52d6
...
@@ -27,13 +27,12 @@ import WorkerAux
...
@@ -27,13 +27,12 @@ import WorkerAux
import
Types
import
Types
(
Generator
(
Generator
,
Freq
,
Freq
,
SeqConf
,
Stats
,
Stats
,
Vertex
,
Vertex
,
VTable
,
VTable
)
)
type
Conf
=
([
Generator
],
Int
)
-- DATA
-- DATA
-- Static Machine Configuration:
-- Static Machine Configuration:
-- {Gs, --list of generators
-- {Gs, --list of generators
...
@@ -70,7 +69,7 @@ orbit gs xs tableSize = (orbit, [stat])
...
@@ -70,7 +69,7 @@ orbit gs xs tableSize = (orbit, [stat])
-- Table -- hash table holding vertices
-- Table -- hash table holding vertices
-- Queue -- work queue
-- Queue -- work queue
-- VertsRecvd -- number of vertices removed from the Queue so far
-- VertsRecvd -- number of vertices removed from the Queue so far
vertex_server
::
Conf
->
VTable
->
BankersDequeue
Vertex
->
Int
->
(
VTable
,
Int
)
vertex_server
::
Seq
Conf
->
VTable
->
BankersDequeue
Vertex
->
Int
->
(
VTable
,
Int
)
vertex_server
staticMachConf
table
queue
vertsRecvd
=
vertex_server
staticMachConf
table
queue
vertsRecvd
=
case
popFront
queue
of
case
popFront
queue
of
(
Nothing
,
_
)
->
(
table
,
vertsRecvd
)
(
Nothing
,
_
)
->
(
table
,
vertsRecvd
)
...
@@ -80,7 +79,7 @@ vertex_server staticMachConf table queue vertsRecvd =
...
@@ -80,7 +79,7 @@ vertex_server staticMachConf table queue vertsRecvd =
-- handle_vertex checks whether vertex X is stored in Table;
-- handle_vertex checks whether vertex X is stored in Table;
-- if not, it is in inserted and the images of the generators
-- if not, it is in inserted and the images of the generators
-- are pushed into the work queue.
-- are pushed into the work queue.
handle_vertex
::
Conf
->
Vertex
->
VTable
->
BankersDequeue
Vertex
->
(
VTable
,
BankersDequeue
Vertex
)
handle_vertex
::
Seq
Conf
->
Vertex
->
VTable
->
BankersDequeue
Vertex
->
(
VTable
,
BankersDequeue
Vertex
)
handle_vertex
staticMachConf
x
table
queue
=
handle_vertex
staticMachConf
x
table
queue
=
case
is_member
x
slot
table
of
-- check whether X is already in Table
case
is_member
x
slot
table
of
-- check whether X is already in Table
-- X already in table; do nothing
-- X already in table; do nothing
...
@@ -95,7 +94,7 @@ handle_vertex staticMachConf x table queue =
...
@@ -95,7 +94,7 @@ handle_vertex staticMachConf x table queue =
-- hash_vertex computes the hash table slot of vertex X
-- hash_vertex computes the hash table slot of vertex X
hash_vertex
::
Conf
->
Vertex
->
Int
hash_vertex
::
Seq
Conf
->
Vertex
->
Int
hash_vertex
staticMachConf
x
=
hash_vertex
staticMachConf
x
=
hsh
`
rem
`
tableSize
hsh
`
rem
`
tableSize
where
tableSize
=
get_table_size
staticMachConf
where
tableSize
=
get_table_size
staticMachConf
...
@@ -105,13 +104,13 @@ hash_vertex staticMachConf x =
...
@@ -105,13 +104,13 @@ hash_vertex staticMachConf x =
-- auxiliary functions
-- auxiliary functions
-- functions operating on the StaticMachConf
-- functions operating on the StaticMachConf
mk_static_mach_conf
::
[
Generator
]
->
Int
->
Conf
mk_static_mach_conf
::
[
Generator
]
->
Int
->
Seq
Conf
mk_static_mach_conf
gs
tableSize
=
(
gs
,
tableSize
)
mk_static_mach_conf
gs
tableSize
=
(
gs
,
tableSize
)
get_gens
::
Conf
->
[
Generator
]
get_gens
::
Seq
Conf
->
[
Generator
]
get_gens
staticMachConf
=
fst
staticMachConf
get_gens
staticMachConf
=
fst
staticMachConf
get_table_size
::
Conf
->
Int
get_table_size
::
Seq
Conf
->
Int
get_table_size
staticMachConf
=
snd
staticMachConf
get_table_size
staticMachConf
=
snd
staticMachConf
-- produce readable statistics
-- produce readable statistics
...
...
Types.hs
View file @
c7bb52d6
...
@@ -6,6 +6,8 @@ module Types ( Ct(..)
...
@@ -6,6 +6,8 @@ module Types ( Ct(..)
,
Freq
,
Freq
,
Host
,
Host
,
MaybeHosts
(
..
)
,
MaybeHosts
(
..
)
,
ParConf
,
SeqConf
,
Stats
,
Stats
,
Vertex
,
Vertex
,
VTable
)
where
,
VTable
)
where
...
@@ -15,6 +17,7 @@ import Data.Array
...
@@ -15,6 +17,7 @@ import Data.Array
)
)
import
Control.Distributed.Process
import
Control.Distributed.Process
(
NodeId
(
NodeId
,
ProcessId
)
)
type
Freq
=
[
Int
]
type
Freq
=
[
Int
]
...
@@ -25,6 +28,8 @@ type Generator = Vertex -> Vertex
...
@@ -25,6 +28,8 @@ type Generator = Vertex -> Vertex
type
Host
=
(
NodeId
,
Int
,
Int
,
Int
)
-- Node, Procs, TableSize, IdleTimeout
type
Host
=
(
NodeId
,
Int
,
Int
,
Int
)
-- Node, Procs, TableSize, IdleTimeout
data
MaybeHosts
=
Seq
Int
data
MaybeHosts
=
Seq
Int
|
Par
[
Host
]
|
Par
[
Host
]
type
SeqConf
=
([
Generator
],
Int
)
type
ParConf
=
([
Generator
],
ProcessId
,
[
ProcessId
],
Int
,
Int
,
Bool
)
-- counters/timers record
-- counters/timers record
data
Ct
=
Ct
{
data
Ct
=
Ct
{
...
...
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