Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Caitlin Ross
codes
Commits
d689a68b
Commit
d689a68b
authored
Jul 15, 2015
by
yangxuserene
Browse files
add jobmap-local-global-mapping for dumpi jobmap
parent
f8ebb23d
Changes
4
Hide whitespace changes
Inline
Side-by-side
codes/codes-jobmap.h
View file @
d689a68b
...
...
@@ -25,17 +25,23 @@
enum
codes_jobmap_type
{
/* the "dummy" jobmap is an example implementation. It simply specifies N
* jobs, with exactly one rank per job, with a trivial mapping */
CODES_JOBMAP_DUMMY
CODES_JOBMAP_DUMMY
,
CODES_JOBMAP_DUMPI
};
struct
codes_jobmap_params_dummy
{
int
num_jobs
;
};
/** jobmap interface **/
struct
codes_jobmap_params_dumpi
{
int
num_jobs
;
int
*
num_traces_job
;
};
struct
codes_jobmap_ctx
;
/** jobmap interface **/
struct
codes_jobmap_ctx
;
struct
codes_jobmap_id
{
int
job
;
int
rank
;
// relative to job
...
...
src/Makefile.subdir
View file @
d689a68b
...
...
@@ -99,6 +99,7 @@ src_libcodes_base_a_SOURCES = \
src/util/codes-jobmap-method-impl.h
\
src/util/codes-jobmap.c
\
src/util/jobmap-impl/jobmap-dummy.c
\
src/util/jobmap-impl/jobmap-local-global-mapping.c
\
src/workload/codes-workload.c
\
src/workload/codes-workload-method.h
\
src/workload/methods/codes-iolang-wrkld.c
\
...
...
src/util/codes-jobmap.c
View file @
d689a68b
...
...
@@ -11,6 +11,7 @@
#include "codes/codes-jobmap.h"
extern
struct
codes_jobmap_impl
jobmap_dummy_impl
;
extern
struct
codes_jobmap_impl
jobmap_dumpi_impl
;
struct
codes_jobmap_ctx
*
codes_jobmap_configure
(
enum
codes_jobmap_type
t
,
void
const
*
params
)
...
...
@@ -24,6 +25,9 @@ codes_jobmap_configure(enum codes_jobmap_type t, void const * params)
case
CODES_JOBMAP_DUMMY
:
c
->
impl
=
&
jobmap_dummy_impl
;
break
;
case
CODES_JOBMAP_DUMPI
:
c
->
impl
=
&
jobmap_dumpi_impl
;
break
;
default:
free
(
c
);
fprintf
(
stderr
,
"ERROR: unknown jobmap type %d
\n
"
,
t
);
...
...
src/util/jobmap-impl/jobmap-local-global-mapping.c
0 → 100644
View file @
d689a68b
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "src/util/codes-jobmap-method-impl.h"
static
int
jobmap_dumpi_configure
(
void
const
*
params
,
void
**
ctx
)
{
int
*
num_jobs
=
malloc
(
sizeof
(
*
num_jobs
));
assert
(
num_jobs
);
*
ctx
=
num_jobs
;
struct
codes_jobmap_params_dumpi
const
*
p
=
params
;
*
num_jobs
=
p
->
num_jobs
;
return
0
;
}
static
void
jobmap_dumpi_destroy
(
void
*
ctx
)
{
free
(
ctx
);
}
static
struct
codes_jobmap_id
jobmap_dumpi_to_local
(
int
id
,
void
const
*
ctx
)
{
int
const
*
num_jobs
=
ctx
;
struct
codes_jobmap_id
rtn
;
if
(
id
<
*
num_jobs
)
{
rtn
.
job
=
id
;
rtn
.
rank
=
0
;
}
else
{
rtn
.
job
=
-
1
;
rtn
.
rank
=
-
1
;
}
printf
(
"greetings
\n
"
);
return
rtn
;
}
static
int
jobmap_dumpi_to_global
(
struct
codes_jobmap_id
id
,
void
const
*
ctx
)
{
int
const
*
num_jobs
=
ctx
;
if
(
id
.
job
<
*
num_jobs
)
return
id
.
job
;
else
return
-
1
;
}
int
jobmap_dumpi_get_num_jobs
(
void
const
*
ctx
)
{
return
*
(
int
const
*
)
ctx
;
}
struct
codes_jobmap_impl
jobmap_dumpi_impl
=
{
jobmap_dumpi_configure
,
jobmap_dumpi_destroy
,
jobmap_dumpi_to_local
,
jobmap_dumpi_to_global
,
jobmap_dumpi_get_num_jobs
};
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
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