Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Xin Wang
codes-dev
Commits
fb8bda12
Commit
fb8bda12
authored
Sep 04, 2015
by
Jonathan Jenkins
Browse files
make codes-workload impl interface public
so people can bring their own workload
parent
cafa11b9
Changes
11
Hide whitespace changes
Inline
Side-by-side
codes/codes-workload.h
View file @
fb8bda12
...
...
@@ -17,6 +17,7 @@
#define MAX_NAME_LENGTH_WKLD 512
/* implementations included with codes */
typedef
struct
iolang_params
iolang_params
;
typedef
struct
darshan_params
darshan_params
;
typedef
struct
recorder_params
recorder_params
;
...
...
@@ -199,6 +200,13 @@ struct codes_workload_op
}
u
;
};
// helper macro for implementations - call this if multi-app support not
// available
#define APP_ID_UNSUPPORTED(id, name) \
if (id != 0) \
tw_error(TW_LOC,\
"APP IDs not supported for %s generator, 0 required", name);
/* read workload configuration from a CODES configuration file and return the
* workload name and parameters, which can then be passed to
* codes_workload_load */
...
...
@@ -268,6 +276,22 @@ void codes_workload_print_op(
int
app_id
,
int
rank
);
/* implementation structure */
struct
codes_workload_method
{
char
*
method_name
;
/* name of the generator */
void
*
(
*
codes_workload_read_config
)
(
ConfigHandle
*
handle
,
char
const
*
section_name
,
char
const
*
annotation
,
int
num_ranks
);
int
(
*
codes_workload_load
)(
const
char
*
params
,
int
app_id
,
int
rank
);
void
(
*
codes_workload_get_next
)(
int
app_id
,
int
rank
,
struct
codes_workload_op
*
op
);
int
(
*
codes_workload_get_rank_cnt
)(
const
char
*
params
,
int
app_id
);
};
/* dynamically add to the workload implementation table. Must be done BEFORE
* calls to codes_workload_read_config or codes_workload_load */
void
codes_workload_add_method
(
struct
codes_workload_method
const
*
method
);
/* NOTE: there is deliberately no finalize function; we don't have any
* reliable way to tell when a workload is truly done and will not
* participate in further reverse computation. The underlying generators
...
...
src/Makefile.subdir
View file @
fb8bda12
...
...
@@ -105,7 +105,6 @@ src_libcodes_base_a_SOURCES = \
src/util/jobmap-impl/jobmap-identity.c
\
src/util/codes-mapping-context.c
\
src/workload/codes-workload.c
\
src/workload/codes-workload-method.h
\
src/workload/methods/codes-iolang-wrkld.c
\
src/workload/methods/codes-checkpoint-wrkld.c
\
src/workload/methods/test-workload-method.c
\
...
...
src/workload/codes-workload-method.h
deleted
100644 → 0
View file @
cafa11b9
/*
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
/* I/O workload generator API to be used by workload generator methods.
* It mimics the top level codes-workload.h API, except that there is no
* reverse handler.
*/
#ifndef CODES_WORKLOAD_METHOD_H
#define CODES_WORKLOAD_METHOD_H
#include
"ross.h"
#include
"codes/codes-workload.h"
#define APP_ID_UNSUPPORTED(id, name) \
if (id != 0) \
tw_error(TW_LOC,\
"APP IDs not supported for %s generator, 0 required", name);
struct
codes_workload_method
{
char
*
method_name
;
/* name of the generator */
void
*
(
*
codes_workload_read_config
)
(
ConfigHandle
*
handle
,
char
const
*
section_name
,
char
const
*
annotation
,
int
num_ranks
);
int
(
*
codes_workload_load
)(
const
char
*
params
,
int
app_id
,
int
rank
);
void
(
*
codes_workload_get_next
)(
int
app_id
,
int
rank
,
struct
codes_workload_op
*
op
);
int
(
*
codes_workload_get_rank_cnt
)(
const
char
*
params
,
int
app_id
);
};
#endif
/* CODES_WORKLOAD_METHOD_H */
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
*/
src/workload/codes-workload.c
View file @
fb8bda12
...
...
@@ -8,7 +8,6 @@
#include
"ross.h"
#include
"codes/codes-workload.h"
#include
"codes-workload-method.h"
/* list of available methods. These are statically compiled for now, but we
* could make generators optional via autoconf tests etc. if needed
...
...
@@ -26,7 +25,7 @@ extern struct codes_workload_method recorder_io_workload_method;
#endif
extern
struct
codes_workload_method
checkpoint_workload_method
;
static
struct
codes_workload_method
*
method_array
[]
=
static
struct
codes_workload_method
const
*
method_array
_default
[]
=
{
&
test_workload_method
,
&
iolang_workload_method
,
...
...
@@ -40,7 +39,13 @@ static struct codes_workload_method *method_array[] =
&
recorder_io_workload_method
,
#endif
&
checkpoint_workload_method
,
NULL
};
NULL
};
// once initialized, adding a workload generator is an error
static
int
is_workloads_init
=
0
;
static
int
num_user_methods
=
0
;
static
struct
codes_workload_method
const
**
method_array
=
NULL
;
/* This shim layer is responsible for queueing up reversed operations and
* re-issuing them so that the underlying workload generator method doesn't
...
...
@@ -70,12 +75,34 @@ struct rank_queue
static
struct
rank_queue
*
ranks
=
NULL
;
// only call this once
static
void
init_workload_methods
(
void
)
{
if
(
is_workloads_init
)
return
;
if
(
method_array
==
NULL
)
method_array
=
method_array_default
;
else
{
// note - includes null char
int
num_default_methods
=
(
sizeof
(
method_array_default
)
/
sizeof
(
method_array_default
[
0
]));
method_array
=
realloc
(
method_array
,
(
num_default_methods
+
num_user_methods
+
1
)
*
sizeof
(
*
method_array
));
memcpy
(
method_array
+
num_user_methods
,
method_array_default
,
num_default_methods
*
sizeof
(
*
method_array_default
));
}
is_workloads_init
=
1
;
}
codes_workload_config_return
codes_workload_read_config
(
ConfigHandle
*
handle
,
char
const
*
section_name
,
char
const
*
annotation
,
int
num_ranks
)
{
init_workload_methods
();
char
type
[
MAX_NAME_LENGTH_WKLD
];
codes_workload_config_return
r
;
r
.
type
=
NULL
;
...
...
@@ -114,6 +141,8 @@ int codes_workload_load(
int
app_id
,
int
rank
)
{
init_workload_methods
();
int
i
;
int
ret
;
struct
rank_queue
*
tmp
;
...
...
@@ -377,6 +406,27 @@ void codes_workload_print_op(
}
}
void
codes_workload_add_method
(
struct
codes_workload_method
const
*
method
)
{
static
int
method_array_cap
=
8
;
if
(
is_workloads_init
)
tw_error
(
TW_LOC
,
"adding a workload method after initialization is forbidden"
);
else
if
(
method_array
==
NULL
){
method_array
=
malloc
(
method_array_cap
*
sizeof
(
*
method_array
));
assert
(
method_array
);
}
if
(
num_user_methods
==
method_array_cap
)
{
method_array_cap
*=
2
;
method_array
=
realloc
(
method_array
,
method_array_cap
*
sizeof
(
*
method_array
));
assert
(
method_array
);
}
method_array
[
num_user_methods
++
]
=
method
;
}
/*
* Local variables:
* c-indent-level: 4
...
...
src/workload/methods/codes-checkpoint-wrkld.c
View file @
fb8bda12
...
...
@@ -12,7 +12,6 @@
#include
"codes/quickhash.h"
#include
"codes/codes-workload.h"
#include
"src/workload/codes-workload-method.h"
#define CHECKPOINT_HASH_TABLE_SIZE 251
...
...
src/workload/methods/codes-darshan-io-wrkld.c
View file @
fb8bda12
...
...
@@ -8,7 +8,6 @@
#include
"codes/codes-workload.h"
#include
"codes/quickhash.h"
#include
"src/workload/codes-workload-method.h"
#include
"darshan-logutils.h"
...
...
src/workload/methods/codes-dumpi-trace-nw-wrkld.c
View file @
fb8bda12
...
...
@@ -14,7 +14,6 @@
#include
"dumpi/libundumpi/bindings.h"
#include
"dumpi/libundumpi/libundumpi.h"
#include
"codes/codes-workload.h"
#include
"src/workload/codes-workload-method.h"
#include
"codes/quickhash.h"
#define MAX_LENGTH 512
...
...
src/workload/methods/codes-iolang-wrkld.c
View file @
fb8bda12
...
...
@@ -13,7 +13,6 @@
#include
"src/iokernellang/codeslexer.h"
#include
"codes/codes-workload.h"
#include
"src/workload/codes-workload-method.h"
#include
"codes/quickhash.h"
#define RANK_HASH_TABLE_SIZE 400
...
...
src/workload/methods/codes-recorder-io-wrkld.c
View file @
fb8bda12
...
...
@@ -17,7 +17,6 @@
#include
"ross.h"
#include
"codes/codes-workload.h"
#include
"src/workload/codes-workload-method.h"
#include
"codes/quickhash.h"
#include
"codes/jenkins-hash.h"
...
...
src/workload/methods/test-workload-method.c
View file @
fb8bda12
...
...
@@ -13,7 +13,6 @@
#include
"ross.h"
#include
"codes/codes-workload.h"
#include
"src/workload/codes-workload-method.h"
static
int
test_workload_load
(
const
char
*
params
,
int
app_id
,
int
rank
);
static
void
test_workload_get_next
(
int
app_id
,
int
rank
,
struct
codes_workload_op
*
op
);
...
...
tests/workload/codes-workload-test.c
View file @
fb8bda12
...
...
@@ -106,6 +106,9 @@ int main(
return
(
-
1
);
}
struct
codes_workload_method
dummy_method
=
{
"foo"
,
NULL
,
NULL
,
NULL
,
NULL
};
codes_workload_add_method
(
&
dummy_method
);
workload_set_params
();
tw_run
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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