Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
io.hpp File Reference
Include dependency graph for io.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  shamalgs
 namespace to contain everything implemented by shamalgs

Functions

template<class T>
void shamalgs::collective::viewed_write_all_fetch (MPI_File fh, T *ptr_data, u64 data_cnt, u64 &file_head_ptr)
 Writes data to an MPI file in a collective manner.
template<class T>
void shamalgs::collective::viewed_write_all_fetch_known_total_size (MPI_File fh, T *ptr_data, u64 data_cnt, u64 total_cnt, u64 &file_head_ptr)
 Writes data to an MPI file in a collective manner and updates the file head pointer.
void shamalgs::collective::write_header_raw (MPI_File fh, std::string s, u64 &file_head_ptr)
 Writes a string to a file using MPI and updates the file head pointer.
std::string shamalgs::collective::read_header_raw (MPI_File fh, size_t len, u64 &file_head_ptr)
 Reads a string of length len from a file using MPI and updates the file head pointer.
void shamalgs::collective::write_header_val (MPI_File fh, size_t val, u64 &file_head_ptr)
 Writes a size_t to a file using MPI and updates the file head pointer.
template<class T>
void shamalgs::collective::write_at (MPI_File fh, const void *buf, size_t len, u64 file_head_ptr)
 Writes data at a given offset in a file using MPI.
void shamalgs::collective::write_at_large (MPI_File fh, const u8 *buf, size_t len, u64 file_head_ptr)
 Writes a large byte buffer at a given offset in a file using MPI.
template<class T>
void shamalgs::collective::read_at (MPI_File fh, void *buf, size_t len, u64 file_head_ptr)
 Reads data at a given offset in a file using MPI.
void shamalgs::collective::read_at_large (MPI_File fh, u8 *buf, size_t len, u64 file_head_ptr)
 Reads a large byte buffer at a given offset in a file using MPI.
size_t shamalgs::collective::read_header_val (MPI_File fh, u64 &file_head_ptr)
 Reads a size_t from a file using MPI and updates the file head pointer.
void shamalgs::collective::write_header (MPI_File fh, std::string s, u64 &file_head_ptr)
 Writes a string to a file using MPI and updates the file head pointer. The string is preceded by its length.
std::string shamalgs::collective::read_header (MPI_File fh, u64 &file_head_ptr)
 Reads a string from a file using MPI and updates the file head pointer. The string is preceded by its length.

Detailed Description

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file io.hpp.

Function Documentation

◆ read_at()

template<class T>
void shamalgs::collective::read_at ( MPI_File fh,
void * buf,
size_t len,
u64 file_head_ptr )
inline

Reads data at a given offset in a file using MPI.

Parameters
fhMPI file handle
bufpointer to the data that should be read
lennumber of elements of type T to be read
file_head_ptroffset in the file where the data should be read

Definition at line 201 of file io.hpp.

◆ read_at_large()

void shamalgs::collective::read_at_large ( MPI_File fh,
u8 * buf,
size_t len,
u64 file_head_ptr )
inline

Reads a large byte buffer at a given offset in a file using MPI.

This function splits the transfer into chunks of at most 1 GiB and delegates each chunk to read_at<u8>. Use this instead of read_at when len may exceed the range safely representable as an MPI count (read_at narrows len to int).

Parameters
fhMPI file handle
bufpointer to the buffer that should receive the bytes
lennumber of bytes to read
file_head_ptroffset in the file where the data should be read

Definition at line 224 of file io.hpp.

◆ read_header()

std::string shamalgs::collective::read_header ( MPI_File fh,
u64 & file_head_ptr )
inline

Reads a string from a file using MPI and updates the file head pointer. The string is preceded by its length.

Parameters
fhMPI file handle
file_head_ptrfile head pointer
Returns
string read from file

Definition at line 276 of file io.hpp.

◆ read_header_raw()

std::string shamalgs::collective::read_header_raw ( MPI_File fh,
size_t len,
u64 & file_head_ptr )
inline

Reads a string of length len from a file using MPI and updates the file head pointer.

Parameters
fhMPI file handle
lenlength of string to read
file_head_ptrfile head pointer
Returns
string read from file

Definition at line 116 of file io.hpp.

◆ read_header_val()

size_t shamalgs::collective::read_header_val ( MPI_File fh,
u64 & file_head_ptr )
inline

Reads a size_t from a file using MPI and updates the file head pointer.

Parameters
fhMPI file handle
file_head_ptrfile head pointer
Returns
size_t read from file

Definition at line 241 of file io.hpp.

◆ viewed_write_all_fetch()

template<class T>
void shamalgs::collective::viewed_write_all_fetch ( MPI_File fh,
T * ptr_data,
u64 data_cnt,
u64 & file_head_ptr )

Writes data to an MPI file in a collective manner.

Template Parameters
TThe type of data to be written.
Parameters
fhThe MPI file handle.
ptr_dataPointer to the data to be written.
data_cntNumber of elements of type T to be written.
file_head_ptrThe current file head pointer, which is updated after the write operation.

Definition at line 39 of file io.hpp.

◆ viewed_write_all_fetch_known_total_size()

template<class T>
void shamalgs::collective::viewed_write_all_fetch_known_total_size ( MPI_File fh,
T * ptr_data,
u64 data_cnt,
u64 total_cnt,
u64 & file_head_ptr )

Writes data to an MPI file in a collective manner and updates the file head pointer.

Template Parameters
TThe type of data to be written.
Parameters
fhThe MPI file handle.
ptr_dataPointer to the data to be written.
data_cntNumber of elements of type T to be written.
total_cntTotal number of elements of type T in the file.
file_head_ptrThe current file head pointer, which is updated after the write operation.

Definition at line 69 of file io.hpp.

◆ write_at()

template<class T>
void shamalgs::collective::write_at ( MPI_File fh,
const void * buf,
size_t len,
u64 file_head_ptr )
inline

Writes data at a given offset in a file using MPI.

Parameters
fhMPI file handle
bufpointer to the data to be written
lennumber of elements of type T to be written
file_head_ptroffset in the file where the data should be written

Definition at line 158 of file io.hpp.

◆ write_at_large()

void shamalgs::collective::write_at_large ( MPI_File fh,
const u8 * buf,
size_t len,
u64 file_head_ptr )
inline

Writes a large byte buffer at a given offset in a file using MPI.

This function splits the transfer into chunks of at most 1 GiB and delegates each chunk to write_at<u8>. Use this instead of write_at when len may exceed the range safely representable as an MPI count (write_at narrows len to int).

Parameters
fhMPI file handle
bufpointer to the bytes to be written
lennumber of bytes to write
file_head_ptroffset in the file where the data should be written

Definition at line 181 of file io.hpp.

◆ write_header()

void shamalgs::collective::write_header ( MPI_File fh,
std::string s,
u64 & file_head_ptr )
inline

Writes a string to a file using MPI and updates the file head pointer. The string is preceded by its length.

Parameters
fhMPI file handle
sstring to write
file_head_ptrfile head pointer

Definition at line 262 of file io.hpp.

◆ write_header_raw()

void shamalgs::collective::write_header_raw ( MPI_File fh,
std::string s,
u64 & file_head_ptr )
inline

Writes a string to a file using MPI and updates the file head pointer.

Note that all processes should call this function with the same content

Parameters
fhMPI file handle
sstring to write
file_head_ptrfile head pointer

Definition at line 96 of file io.hpp.

Here is the call graph for this function:

◆ write_header_val()

void shamalgs::collective::write_header_val ( MPI_File fh,
size_t val,
u64 & file_head_ptr )
inline

Writes a size_t to a file using MPI and updates the file head pointer.

Parameters
fhMPI file handle
valvalue to write
file_head_ptrfile head pointer

Definition at line 137 of file io.hpp.

Here is the call graph for this function: