Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
codes
codes
Commits
f947e07d
Commit
f947e07d
authored
Sep 26, 2013
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
draft of workload gen reverse computation
parent
70488a96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
2 deletions
+88
-2
src/workload/codes-workload.c
src/workload/codes-workload.c
+88
-2
No files found.
src/workload/codes-workload.c
View file @
f947e07d
...
...
@@ -17,20 +17,64 @@ extern struct codes_workload_method test_workload_method;
static
struct
codes_workload_method
*
method_array
[]
=
{
&
test_workload_method
,
NULL
};
/* NOTE: we could make this faster with a smarter data structure. For now
* we just have a linked list of rank_queue structs, one per rank that has
* opened the workload. We then have a linked list off of each of those
* to hold a lifo queue of operations that have been reversed for that rank.
*/
/* holds an operation that has been reversed */
struct
rc_op
{
struct
codes_workload_op
op
;
struct
rc_op
*
next
;
};
/* tracks lifo queue of reversed operations for a given rank */
struct
rank_queue
{
int
rank
;
struct
rc_op
*
lifo
;
struct
rank_queue
*
next
;
};
static
struct
rank_queue
*
ranks
=
NULL
;
int
codes_workload_load
(
const
char
*
type
,
const
char
*
params
,
int
rank
)
{
int
i
;
int
ret
;
struct
rank_queue
*
tmp
;
for
(
i
=
0
;
method_array
[
i
]
!=
NULL
;
i
++
)
{
if
(
strcmp
(
method_array
[
i
]
->
method_name
,
type
)
==
0
)
{
/* load appropriate workload generator */
ret
=
method_array
[
i
]
->
codes_workload_load
(
params
,
rank
);
if
(
ret
<
0
)
{
return
(
-
1
);
}
/* are we tracking information for this rank yet? */
tmp
=
ranks
;
while
(
tmp
)
{
if
(
tmp
->
rank
==
rank
)
break
;
tmp
=
tmp
->
next
;
}
if
(
tmp
==
NULL
)
{
tmp
=
malloc
(
sizeof
(
*
tmp
));
assert
(
tmp
);
tmp
->
rank
=
rank
;
tmp
->
lifo
=
NULL
;
tmp
->
next
=
ranks
;
ranks
=
tmp
;
}
return
(
i
);
}
}
...
...
@@ -41,6 +85,33 @@ int codes_workload_load(const char* type, const char* params, int rank)
void
codes_workload_get_next
(
int
wkld_id
,
int
rank
,
struct
codes_workload_op
*
op
)
{
struct
rank_queue
*
tmp
;
struct
rc_op
*
tmp_op
;
/* first look to see if we have a reversed operation that we can
* re-issue
*/
tmp
=
ranks
;
while
(
tmp
)
{
if
(
tmp
->
rank
==
rank
)
break
;
tmp
=
tmp
->
next
;
}
assert
(
tmp
);
if
(
tmp
->
lifo
)
{
tmp_op
=
tmp
->
lifo
;
tmp
->
lifo
=
tmp_op
->
next
;
*
op
=
tmp_op
->
op
;
free
(
tmp_op
);
printf
(
"codes_workload_get_next re-issuing reversed operation.
\n
"
);
return
;
}
/* ask generator for the next operation */
printf
(
"codes_workload_get_next issuing new operation.
\n
"
);
method_array
[
wkld_id
]
->
codes_workload_get_next
(
rank
,
op
);
return
;
...
...
@@ -48,9 +119,24 @@ void codes_workload_get_next(int wkld_id, int rank, struct codes_workload_op *op
void
codes_workload_get_next_rc
(
int
wkld_id
,
int
rank
,
const
struct
codes_workload_op
*
op
)
{
/* TODO: fill this in */
struct
rank_queue
*
tmp
;
struct
rc_op
*
tmp_op
;
tmp
=
ranks
;
while
(
tmp
)
{
if
(
tmp
->
rank
==
rank
)
break
;
tmp
=
tmp
->
next
;
}
assert
(
tmp
);
tmp_op
=
malloc
(
sizeof
(
*
tmp_op
));
assert
(
tmp_op
);
tmp_op
->
op
=
*
op
;
tmp_op
->
next
=
tmp
->
lifo
;
tmp
->
lifo
=
tmp_op
;
assert
(
0
);
return
;
}
...
...
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