lp-io.h 1.1 KB
Newer Older
1
/*
Philip Carns's avatar
Philip Carns committed
2
 * Copyright (C) 2013 University of Chicago.
3
 * See COPYRIGHT notice in top-level directory.
Philip Carns's avatar
Philip Carns committed
4
 *
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 */

#ifndef LP_IO_H
#define LP_IO_H

#include <ross.h>

typedef char* lp_io_handle;

#define LP_IO_UNIQ_SUFFIX 1

/* to be called (collectively) before running simulation to prepare the
 * output directory.
 */
int lp_io_prepare(char *directory, int flags, lp_io_handle* handle, MPI_Comm comm);

/* to be called within LPs to store a block of data */
int lp_io_write(tw_lpid gid, char* identifier, int size, void* buffer);

24
25
26
27
28
/* 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);

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* to be called (collectively) after tw_run() to flush data to disk */
int lp_io_flush(lp_io_handle handle, MPI_Comm comm);

/* retrieves the directory name for a handle */
static inline char* lp_io_handle_to_dir(lp_io_handle handle)
{
    return(strdup(handle));
}

#endif /* LP_IO_H */

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ft=c ts=8 sts=4 sw=4 expandtab
 */