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
2a169880
Commit
2a169880
authored
Jan 08, 2014
by
Jonathan Jenkins
Browse files
added experimental lp-io reverse computation support
parent
21b03940
Changes
2
Hide whitespace changes
Inline
Side-by-side
codes/lp-io.h
View file @
2a169880
...
...
@@ -21,6 +21,11 @@ int lp_io_prepare(char *directory, int flags, lp_io_handle* handle, MPI_Comm com
/* to be called within LPs to store a block of data */
int
lp_io_write
(
tw_lpid
gid
,
char
*
identifier
,
int
size
,
void
*
buffer
);
/* undo the immediately preceding write for the given LP
* (hack for logging/testing optimistic mode, not recommended for general use)
*/
int
lp_io_write_rev
(
tw_lpid
gid
,
char
*
identifier
);
/* to be called (collectively) after tw_run() to flush data to disk */
int
lp_io_flush
(
lp_io_handle
handle
,
MPI_Comm
comm
);
...
...
src/util/lp-io.c
View file @
2a169880
...
...
@@ -100,6 +100,52 @@ int lp_io_write(tw_lpid gid, char* identifier, int size, void* buffer)
return
(
0
);
}
int
lp_io_write_rev
(
tw_lpid
gid
,
char
*
identifier
){
struct
identifier
*
id
;
struct
io_buffer
*
buf
,
*
buf_prev
;
/* find given identifier */
if
(
strlen
(
identifier
)
>=
32
)
{
fprintf
(
stderr
,
"Error: identifier %s too big.
\n
"
,
identifier
);
return
(
-
1
);
}
id
=
identifiers
;
while
(
id
&&
(
strcmp
(
identifier
,
id
->
identifier
)
!=
0
)){
id
=
id
->
next
;
}
if
(
!
id
){
fprintf
(
stderr
,
"Error: identifier %s not found on reverse.
\n
"
,
identifier
);
return
(
-
1
);
}
/* attempt to find previous LP's write. This is made easier by the fact
* that the list is stored newest-to-oldest */
buf
=
id
->
buffers
;
buf_prev
=
NULL
;
while
(
buf
){
if
(
buf
->
gid
==
gid
){
break
;
}
buf_prev
=
buf
;
buf
=
buf
->
next
;
}
if
(
!
buf
){
fprintf
(
stderr
,
"Error: no lp-io write buffer found for LP %lu (reverse write)
\n
"
,
gid
);
return
(
-
1
);
}
id
->
buffers_count
--
;
/* remove the buffer from the list
* (NULLs for end-of-list are preserved) */
if
(
buf
==
id
->
buffers
)
{
/* buf is head of list */
id
->
buffers
=
buf
->
next
;
}
else
{
/* buf is in list, has a previous element */
buf_prev
->
next
=
buf
->
next
;
}
free
(
buf
->
buffer
);
free
(
buf
);
return
(
0
);
}
int
lp_io_prepare
(
char
*
directory
,
int
flags
,
lp_io_handle
*
handle
,
MPI_Comm
comm
)
{
...
...
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