|
| cs_file_t * | cs_file_open (const char *name, cs_file_mode_t mode, cs_file_access_t method) |
| | Create a file descriptor and open the associated file. More...
|
| |
| cs_file_t * | cs_file_open_default (const char *name, cs_file_mode_t mode) |
| | Create a file descriptor and open the associated file, using the default file communicator and access method. More...
|
| |
| cs_file_t * | cs_file_open_serial (const char *name, cs_file_mode_t mode) |
| | Create a file descriptor and open the associated file, using the serial IO on the root rank. More...
|
| |
| cs_file_t * | cs_file_free (cs_file_t *f) |
| | Destroy a file descriptor and close the associated file. More...
|
| |
| const char * | cs_file_get_name (const cs_file_t *f) |
| | Return a file's name. More...
|
| |
| void | cs_file_set_big_endian (cs_file_t *f) |
| | Ensure that data is read or written in big-endian (network standard) format. More...
|
| |
| int | cs_file_get_swap_endian (const cs_file_t *f) |
| | Return a file's byte-swapping behavior. More...
|
| |
| void | cs_file_set_swap_endian (cs_file_t *f, int swap) |
| | Set a file's byte-swapping behavior. More...
|
| |
| size_t | cs_file_read_global (cs_file_t *f, void *buf, size_t size, size_t ni) |
| | Read global data from a file, distributing it to all processes associated with that file. More...
|
| |
| size_t | cs_file_write_global (cs_file_t *f, const void *buf, size_t size, size_t ni) |
| | Write global data to a file. More...
|
| |
| size_t | cs_file_read_block (cs_file_t *f, void *buf, size_t size, size_t stride, cs_gnum_t global_num_start, cs_gnum_t global_num_end) |
| | Read data to a buffer, distributing a contiguous part of it to each process associated with a file. More...
|
| |
| size_t | cs_file_write_block (cs_file_t *f, const void *buf, size_t size, size_t stride, cs_gnum_t global_num_start, cs_gnum_t global_num_end) |
| | Write data to a file, each associated process providing a contiguous part of this data. More...
|
| |
| size_t | cs_file_write_block_buffer (cs_file_t *f, void *buf, size_t size, size_t stride, cs_gnum_t global_num_start, cs_gnum_t global_num_end) |
| | Write data to a file, each associated process providing a contiguous part of this data. More...
|
| |
| int | cs_file_seek (cs_file_t *f, cs_file_off_t offset, cs_file_seek_t whence) |
| | Update the file pointer according to whence. More...
|
| |
| cs_file_off_t | cs_file_tell (cs_file_t *f) |
| | Return the position of the file pointer. More...
|
| |
| void | cs_file_dump (const cs_file_t *f) |
| | Dump the metadata of a file structure in human readable form. More...
|
| |
| void | cs_file_free_defaults (void) |
| | Free the default options for file access. More...
|
| |
| void | cs_file_get_default_access (cs_file_mode_t mode, cs_file_access_t *method) |
| | Get the default options for file access. More...
|
| |
| void | cs_file_set_default_access (cs_file_mode_t mode, cs_file_access_t method) |
| | Set the default options for file access. More...
|
| |
| cs_file_mpi_positionning_t | cs_file_get_mpi_io_positionning (void) |
| | Get the positionning method for MPI-IO. More...
|
| |
| void | cs_file_set_mpi_io_positionning (cs_file_mpi_positionning_t positionning) |
| | Set the positionning method for MPI-IO. More...
|
| |
| void | cs_file_defaults_info (void) |
| | Print information on default options for file access. More...
|
| |
| int | cs_file_mkdir_default (const char *path) |
| | Create a new directory using default permissions. More...
|
| |
| int | cs_file_isreg (const char *path) |
| | Check if a file exists and is a regular file. More...
|
| |
| int | cs_file_isdir (const char *path) |
| | Check if a directory exists. More...
|
| |
| char ** | cs_file_listdir (const char *path) |
| | List files inside a directory. More...
|
| |
| cs_file_off_t | cs_file_size (const char *path) |
| | Return the size of a file. More...
|
| |
| int | cs_file_remove (const char *path) |
| | Remove a file if it exists and is a regular file. More...
|
| |
File and directory operations, with parallel IO.
| int cs_file_mkdir_default |
( |
const char * |
path | ) |
|
Create a new directory using default permissions.
This function is similar to the POSIX function mkdir(), except that it has no "mode" argument: by default, on a POSIX type system, permissions include read, write, and execute access for the user, group and others, modified by the users umask value (so with a typical configuration, the user will have read, write, and execute pemission, the group and others will only have read and execute permission, but this behavior may be modified).
Also, contrary to the usual mkdir(), if the directory already exists (and is truly a directory), this is considered a success and not a failure, and 0 is returned: the aim of this function is to make a directory available, so if it already exists, this is considered acceptable.
- Parameters
-
| [in] | path | name of new directory. |
- Returns
- 0 on success, -1 if an error occured (in which case errno contains the appropriate error code). If the underlying system has no mkdir() function or it was not detected upon BFT configuration, 1 is returned.
| size_t cs_file_write_block |
( |
cs_file_t * |
f, |
|
|
const void * |
buf, |
|
|
size_t |
size, |
|
|
size_t |
stride, |
|
|
cs_gnum_t |
global_num_start, |
|
|
cs_gnum_t |
global_num_end |
|
) |
| |
Write data to a file, each associated process providing a contiguous part of this data.
Each process should provide a (possibly empty) block of the data, and we should have: global_num_start at rank 0 = 1 global_num_start at rank i+1 = global_num_end at rank i. Otherwise, behavior (especially positioning for future reads) is undefined.
This function may require an internal copy of the data to ensure that the buffer contents are not modified, so if the buffer contents are temporary values, to be deleted after writing, using cs_file_write_block_buffer() instead may be used to avoid an unneeded memory allocation and copy.
- Parameters
-
| [in] | f | cs_file_t descriptor |
| [in] | buf | pointer to location containing data |
| [in] | size | size of each item of data in bytes |
| [in] | stride | number of (interlaced) values per block item |
| [in] | global_num_start | global number of first block item (1 to n numbering) |
| [in] | global_num_end | global number of past-the end block item (1 to n numbering) |
- Returns
- the (local) number of items (not bytes) sucessfully written; currently, errors are fatal.
| size_t cs_file_write_block_buffer |
( |
cs_file_t * |
f, |
|
|
void * |
buf, |
|
|
size_t |
size, |
|
|
size_t |
stride, |
|
|
cs_gnum_t |
global_num_start, |
|
|
cs_gnum_t |
global_num_end |
|
) |
| |
Write data to a file, each associated process providing a contiguous part of this data.
Each process should provide a (possibly empty) block of the data, and we should have: global_num_start at rank 0 = 1 global_num_start at rank i+1 = global_num_end at rank i. Otherwise, behavior (especially positioning for future reads) is undefined.
This function is intended to be used mainly data that is already a copy of original data (such as data that has been redistributed across processors just for the sake of output), or that is to be deleted after writing, so it may modify the values in its input buffer (notably to convert from little-endian to big-endian of vice-versa if necessary).
- Parameters
-
| [in] | f | cs_file_t descriptor |
| [in,out] | buf | pointer to location containing data |
| [in] | size | size of each item of data in bytes |
| [in] | stride | number of (interlaced) values per block item |
| [in] | global_num_start | global number of first block item (1 to n numbering) |
| [in] | global_num_end | global number of past-the end block item (1 to n numbering) |
- Returns
- the (local) number of items (not bytes) sucessfully written; currently, errors are fatal.