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
f2711d79
Commit
f2711d79
authored
Jul 29, 2015
by
Jonathan Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename jobmap-list vars to be clearer
parent
cb3aed49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
src/util/jobmap-impl/jobmap-list.c
src/util/jobmap-impl/jobmap-list.c
+20
-20
No files found.
src/util/jobmap-impl/jobmap-list.c
View file @
f2711d79
...
...
@@ -29,8 +29,8 @@
struct
jobmap_list
{
int
num_jobs
;
int
*
num_rank_job
;
int
**
lp_array
s
;
int
*
rank_counts
;
int
**
global_id
s
;
};
#define COND_REALLOC(_len_expr, _cap_var, _buf_var) \
...
...
@@ -115,10 +115,10 @@ static int jobmap_list_configure(void const * params, void ** ctx)
// job storage
lst
->
num_jobs
=
0
;
int
job_cap
=
8
;
lst
->
num_rank_job
=
calloc
(
job_cap
,
sizeof
(
*
lst
->
num_rank_job
));
assert
(
lst
->
num_rank_job
);
lst
->
lp_arrays
=
calloc
(
job_cap
,
sizeof
(
*
lst
->
lp_array
s
));
assert
(
lst
->
lp_array
s
);
lst
->
rank_counts
=
calloc
(
job_cap
,
sizeof
(
*
lst
->
rank_counts
));
assert
(
lst
->
rank_counts
);
lst
->
global_ids
=
calloc
(
job_cap
,
sizeof
(
*
lst
->
global_id
s
));
assert
(
lst
->
global_id
s
);
// line storage
int
line_cap
=
1
<<
10
;
...
...
@@ -128,8 +128,8 @@ static int jobmap_list_configure(void const * params, void ** ctx)
int
rc
=
0
;
do
{
rc
=
parse_line
(
f
,
&
line_buf
,
&
line_cap
,
&
lst
->
num_rank_job
[
lst
->
num_jobs
],
&
lst
->
lp_array
s
[
lst
->
num_jobs
]);
&
lst
->
rank_counts
[
lst
->
num_jobs
],
&
lst
->
global_id
s
[
lst
->
num_jobs
]);
if
(
rc
==
-
1
)
{
// error and exit
if
(
ferror
(
f
))
{
...
...
@@ -137,14 +137,14 @@ static int jobmap_list_configure(void const * params, void ** ctx)
break
;
}
}
else
if
(
lst
->
num_rank_job
[
lst
->
num_jobs
]
>
0
)
{
else
if
(
lst
->
rank_counts
[
lst
->
num_jobs
]
>
0
)
{
lst
->
num_jobs
++
;
}
// resize if needed
if
(
!
feof
(
f
)
&&
lst
->
num_jobs
==
job_cap
)
{
int
tmp
=
job_cap
;
COND_REALLOC
(
lst
->
num_jobs
,
tmp
,
lst
->
num_rank_job
);
COND_REALLOC
(
lst
->
num_jobs
,
job_cap
,
lst
->
lp_array
s
);
COND_REALLOC
(
lst
->
num_jobs
,
tmp
,
lst
->
rank_counts
);
COND_REALLOC
(
lst
->
num_jobs
,
job_cap
,
lst
->
global_id
s
);
}
}
while
(
!
feof
(
f
));
...
...
@@ -156,10 +156,10 @@ static int jobmap_list_configure(void const * params, void ** ctx)
}
else
{
for
(
int
i
=
0
;
i
<
job_cap
;
i
++
)
{
free
(
lst
->
lp_array
s
[
i
]);
free
(
lst
->
global_id
s
[
i
]);
}
free
(
lst
->
lp_array
s
);
free
(
lst
->
num_rank_job
);
free
(
lst
->
global_id
s
);
free
(
lst
->
rank_counts
);
free
(
lst
);
*
ctx
=
NULL
;
return
-
1
;
...
...
@@ -175,8 +175,8 @@ static struct codes_jobmap_id jobmap_list_to_local(int id, void const * ctx)
struct
jobmap_list
*
lst
=
(
struct
jobmap_list
*
)
ctx
;
for
(
int
i
=
0
;
i
<
lst
->
num_jobs
;
i
++
)
{
for
(
int
j
=
0
;
j
<
lst
->
num_rank_job
[
i
];
j
++
)
{
if
(
id
==
lst
->
lp_array
s
[
i
][
j
])
{
for
(
int
j
=
0
;
j
<
lst
->
rank_counts
[
i
];
j
++
)
{
if
(
id
==
lst
->
global_id
s
[
i
][
j
])
{
rtn
.
job
=
i
;
rtn
.
rank
=
j
;
return
rtn
;
...
...
@@ -192,7 +192,7 @@ static int jobmap_list_to_global(struct codes_jobmap_id id, void const * ctx)
struct
jobmap_list
*
lst
=
(
struct
jobmap_list
*
)
ctx
;
if
(
id
.
job
<
lst
->
num_jobs
)
return
lst
->
lp_array
s
[
id
.
job
][
id
.
rank
];
return
lst
->
global_id
s
[
id
.
job
][
id
.
rank
];
else
return
-
1
;
}
...
...
@@ -208,11 +208,11 @@ static void jobmap_list_destroy(void * ctx)
{
struct
jobmap_list
*
lst
=
(
struct
jobmap_list
*
)
ctx
;
for
(
int
i
=
0
;
i
<
lst
->
num_jobs
;
i
++
){
free
(
lst
->
lp_array
s
[
i
]);
free
(
lst
->
global_id
s
[
i
]);
}
free
(
lst
->
lp_array
s
);
free
(
lst
->
num_rank_job
);
free
(
lst
->
global_id
s
);
free
(
lst
->
rank_counts
);
free
(
ctx
);
}
...
...
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