GitLab maintenance scheduled for Today, 2020-02-27, from 17:00 to 18:00 CT - Services will be unavailable during this time.

Commit 2a169880 authored by Jonathan Jenkins's avatar Jonathan Jenkins

added experimental lp-io reverse computation support

parent 21b03940
...@@ -21,6 +21,11 @@ int lp_io_prepare(char *directory, int flags, lp_io_handle* handle, MPI_Comm com ...@@ -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 */ /* to be called within LPs to store a block of data */
int lp_io_write(tw_lpid gid, char* identifier, int size, void* buffer); 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 */ /* to be called (collectively) after tw_run() to flush data to disk */
int lp_io_flush(lp_io_handle handle, MPI_Comm comm); int lp_io_flush(lp_io_handle handle, MPI_Comm comm);
......
...@@ -100,6 +100,52 @@ int lp_io_write(tw_lpid gid, char* identifier, int size, void* buffer) ...@@ -100,6 +100,52 @@ int lp_io_write(tw_lpid gid, char* identifier, int size, void* buffer)
return(0); 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) int lp_io_prepare(char *directory, int flags, lp_io_handle* handle, MPI_Comm comm)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment