File-IO

Located in file: MEL.hpp

ErrorHandler MEL::FileCreateErrorHandler(ErrorHandlerFunc func)

Create a file error handler.

See
MPI_File_create_errhandler
Return
Returns a handle to an error handler
Parameters
  • func -

    The function to use

void MEL::FileSetErrorHandler(const File &file, const ErrorHandler &errHndl)

Set the error handler for a file.

See
MPI_File_set_errhandler
Parameters
  • file -

    The file to attach to

  • errHndl -

    The handler to use

void MEL::FileSetErrorHandler(const File &file, ErrorHandlerFunc func)

Set the error handler for a file.

Parameters
  • file -

    The file to attach to

  • func -

    The function to use

ErrorHandler MEL::FileGetErrorHandler(const File &file)

Get the error handler for a file.

See
MPI_File_get_errhandler
Return
Returns a handle to the error handler
Parameters
  • file -

    The file to attach to

FileMode MEL::FileGetMode(const File &file)

Get the mode a file was opened with.

See
MPI_File_get_amode
Return
Returns the file mode
Parameters
  • file -

    The file to attach to

bool MEL::FileIsAtomic(const File &file)

Is the file opened in an atomic mode?

See
MPI_File_get_atomicity
Return
Returns true is the file is opened atomically
Parameters
  • file -

    The file to attach to

void MEL::FileSetAtomicity(const File &file, const bool atom)

Set the atomicity of the file handle.

See
MPI_File_set_atomicity
Parameters
  • file -

    The file to attach to

  • atom -

    Boolean value representing atomicity

Offset MEL::FileGetByteOffset(const File &file, const Offset offset)

Get the byte position of the file cursor relative to a given location.

See
MPI_File_get_byte_offset
Return
Returns the number of bytes from the given offset
Parameters
  • file -

    The file to attach to

  • offset -

    The relative offset to measure byte distance against

Group MEL::FileGetGroup(const File &file)

Get the comm group a file was opened as a part of.

See
MPI_File_get_group
Return
Returns comm group the file handle belongs to
Parameters
  • file -

    The file to attach to

Info MEL::FileGetInfo(const File &file)

Get the MPI_Info object attached to a file handle.

See
MPI_File_get_info
Return
Returns the info object
Parameters
  • file -

    The file to attach to

void MEL::FileSetInfo(const File &file, const Info &info)

Set the MPI_Info object attached to a file handle.

See
MPI_File_set_info
Parameters
  • file -

    The file to attach to

  • info -

    The info object to attach

Offset MEL::FileGetPosition(const File &file)

Get the position of the file cursor.

See
MPI_File_get_position
Return
Returns the location of the file cursor in bytes
Parameters
  • file -

    The file to attach to

Offset MEL::FileGetPositionShared(const File &file)

Get the position of the shared file cursor.

See
MPI_File_get_position_shared
Return
Returns the location of the shared file cursor in bytes
Parameters
  • file -

    The file to attach to

Offset MEL::FileGetSize(const File &file)

Get the size of the file in bytes.

See
MPI_File_get_size
Return
Returns the size of the file in bytes
Parameters
  • file -

    The file to attach to

void MEL::FileSetSize(const File &file, const Offset size)

Set the size of the file in bytes.

See
MPI_File_set_size
Parameters
  • file -

    The file to attach to

  • size -

    The size in bytes to set the file size to

Aint MEL::FileGetTypeExtent(const File &file, const Datatype &datatype)

Get the extent of the derived type set to the file handle.

See
MPI_File_get_type_extent
Return
Returns the extent of the type
Parameters
  • file -

    The file to attach to

  • datatype -

    The derived datatype to measure the extent of

File MEL::FileOpen(const Comm &comm, const std::string &path, const FileMode amode)

Open a file and return a handle to it.

See
MPI_File_open, MPI_File_set_errhandler
Return
Returns a handle to the file pointer
Parameters
  • comm -

    The comm world to open the file with

  • path -

    The path to the desired file

  • amode -

    The file mode to open the file with

File MEL::FileOpenIndividual(const std::string &path, const FileMode amode)

Open a file on an individual process and return a handle to it.

Return
Returns a handle to the file pointer
Parameters
  • path -

    The path to the desired file

  • amode -

    The file mode to open the file with

void MEL::FileDelete(const std::string &path)

Delete a file by its path.

See
MPI_File_delete
Parameters
  • path -

    The path to the file to be deleted

void MEL::FileClose(File &file)

Close the file attached to the given file handle.

See
MPI_File_close
Parameters
  • file -

    The file handle to be closed

void MEL::FilePreallocate(const File &file, const Offset fileSize)

Preallocate the opened file to the given size on the file system.

See
MPI_File_preallocate
Parameters
  • file -

    The file to be preallocated

  • fileSize -

    The size of the file in bytes

void MEL::FileSeek(const File &file, const Offset offset, const SeekMode seekMode = MEL::SeekMode::SET)

Move the file cursor to a specific position.

See
MPI_File_seek
Parameters
  • file -

    The file

  • offset -

    The position to move the file cursor to

  • seekMode -

    The mode to move the cursor by

void MEL::FileSeekShared(const File &file, const Offset offset, const SeekMode seekMode = MEL::SeekMode::SET)

Move the shared file cursor to a specific position.

The same values must be provided by all processes

See
MPI_File_seek_shared
Parameters
  • file -

    The shared file

  • offset -

    The position to move the file cursor to

  • seekMode -

    The mode to move the cursor by

void MEL::FileSync(const File &file)

Force all queued and pending disk operations on a file to be completed.

See
MPI_File_sync
Parameters
  • file -

    The file to be synchronized

void MEL::FileSetView(const File &file, const Offset offset, const Datatype elementaryType, const Datatype fileType, const std::string &datarep = "native")

Set the view of a file handle for subsequent read/writes.

See
MPI_File_set_view
Parameters
  • file -

    The file handle

  • offset -

    Byte offset from start of the file

  • elementaryType -

    The derived type representing the type of each element to be written

  • fileType -

    The derived type representing the structure of data to be written

  • datarep -

    String argument telling the MPI implementation how data is represented. Default is “native”

void MEL::FileSetView(const File &file, const FileView &view)

Set the view of a file handle for subsequent read/writes.

Parameters
  • file -

    The file handle

  • view -

    A utility structure that stores the values of a file view

void MEL::FileGetView(const File &file, Offset &offset, Datatype &elementaryType, Datatype &fileType, std::string &datarep)

Get the view attached to a file handle.

See
MPI_File_get_view
Parameters
  • file -

    The file handle

  • offset -

    Byte offset from start of the file

  • elementaryType -

    The derived type representing the type of each element to be written

  • fileType -

    The derived type representing the structure of data to be written

  • datarep -

    String argument telling the MPI implementation how data is represented. Default is “native”

FileView MEL::FileGetView(const File &file)

Get the view attached to a file handle.

Return
Returns a utility structure that stores the values of a file view
Parameters
  • file -

    The file handle

Status MEL::FileWrite(const File &file, const void *sptr, const int snum, const Datatype &datatype)

Write to file from a single process.

See
MPI_File_write
Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Status MEL::FileWriteAll(const File &file, const void *sptr, const int snum, const Datatype &datatype)

Write to file from all processes that opened the file.

See
MPI_File_write_all
Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Status MEL::FileWriteAt(const File &file, const Offset offset, const void *sptr, const int snum, const Datatype &datatype)

Write to file from a single process at the desired offset.

See
MPI_File_write_at
Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to write at

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Status MEL::FileWriteAtAll(const File &file, const Offset offset, const void *sptr, const int snum, const Datatype &datatype)

Write to file from all processes that opened the file at the desired offset.

See
MPI_File_write_at_all
Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to write at

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Status MEL::FileWriteOrdered(const File &file, const void *sptr, const int snum, const Datatype &datatype)

Write to file from all processes that opened the file in sequence.

See
MPI_File_write_ordered
Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Status MEL::FileWriteShared(const File &file, const void *sptr, const int snum, const Datatype &datatype)

Write to file from any processes that opened the file in parallel.

See
MPI_File_write_shared
Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Request MEL::FileIwrite(const File &file, const void *sptr, const int snum, const Datatype &datatype)

Non-Blocking.

Write to file from a single processes

See
MPI_File_iwrite
Return
A request object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Request MEL::FileIwriteAt(const File &file, const Offset offset, const void *sptr, const int snum, const Datatype &datatype)

Non-Blocking.

Write to file from a single process at the desired offset

See
MPI_File_iwrite_at
Return
A request object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to write to

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Request MEL::FileIwriteShared(const File &file, const void *sptr, const int snum, const Datatype &datatype)

Non-Blocking.

Write to file from any processes that opened the file in parallel

See
MPI_File_iwrite_shared
Return
A request object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

  • datatype -

    The derived type representing the elements to be written

Status MEL::FileRead(const File &file, void *rptr, const int rnum, const Datatype &datatype)

Read from file from a single process.

See
MPI_File_read
Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Status MEL::FileReadAll(const File &file, void *rptr, const int rnum, const Datatype &datatype)

Read from file from all processes that opened the file.

See
MPI_File_read_all
Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Status MEL::FileReadAt(const File &file, const Offset offset, void *rptr, const int rnum, const Datatype &datatype)

Read from file from a single process at the desired offset.

See
MPI_File_read_at
Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to read from

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Status MEL::FileReadAtAll(const File &file, const Offset offset, void *rptr, const int rnum, const Datatype &datatype)

Read from file from all processes that opened the file at the desired offset.

See
MPI_File_read_at_all
Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to read from

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Status MEL::FileReadOrdered(const File &file, void *rptr, const int rnum, const Datatype &datatype)

Read from file from all processes that opened the file in sequence.

See
MPI_File_read_ordered
Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Status MEL::FileReadShared(const File &file, void *rptr, const int rnum, const Datatype &datatype)

Read from file from any processes that opened the file in parallel.

See
MPI_File_read_shared
Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Request MEL::FileIread(const File &file, void *rptr, const int rnum, const Datatype &datatype)

Non-Blocking.

Read from file from a single process

See
MPI_File_iread
Return
A request object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Request MEL::FileIreadAt(const File &file, const Offset offset, void *rptr, const int rnum, const Datatype &datatype)

Non-Blocking.

Read from file from a single process at the desired offset

See
MPI_File_iread_at
Return
A request object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to read from

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

Request MEL::FileIreadShared(const File &file, void *rptr, const int rnum, const Datatype &datatype)

Non-Blocking.

Read from file from any process that opened the file in parallel

See
MPI_File_iread_shared
Return
A request object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

  • datatype -

    The derived type representing the elements to be read

template <typename T>
Status MEL::FileWrite(const File &file, const T *sptr, const int snum)

Write to file from a single process.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Status MEL::FileWriteAt(const File &file, const Offset offset, const T *sptr, const int snum)

Write to file from a single process at the desired offset.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to write to

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Status MEL::FileWriteAll(const File &file, const T *sptr, const int snum)

Write to file from all processes that opened the file.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Status MEL::FileWriteAtAll(const File &file, const Offset offset, const T *sptr, const int snum)

Write to file from all processes that opened the file at the desired offset.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to write to

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Status MEL::FileWriteOrdered(const File &file, const T *sptr, const int snum)

Write to file from all processes that opened the file in sequence.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Status MEL::FileWriteShared(const File &file, const T *sptr, const int snum)

Write to file from any processes that opened the file in parallel.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Status MEL::FileRead(const File &file, T *rptr, const int rnum)

Read from file from a single process.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Status MEL::FileReadAt(const File &file, const Offset offset, T *rptr, const int rnum)

Read from file from a single process at the desired offset.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to read from

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Status MEL::FileReadAll(const File &file, T *rptr, const int rnum)

Read from file from all processes that opened the file.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Status MEL::FileReadAtAll(const File &file, const Offset offset, T *rptr, const int rnum)

Read from file from all processes that opened the file at the desired offset.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to read from

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Status MEL::FileReadOrdered(const File &file, T *rptr, const int rnum)

Read from file from all processes that opened the file in sequence.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Status MEL::FileReadShared(const File &file, T *rptr, const int rnum)

Read from file from any processes that opened the file in parallel.

Element size determined by template type

Return
A status object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Request MEL::FileIwrite(const File &file, const T *sptr, const int snum)

Non-Blocking.

Write to file from a single process. Element size determined by template type

Return
A request object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Request MEL::FileIwriteAt(const File &file, const Offset offset, const T *sptr, const int snum)

Non-Blocking.

Write to file from all processes that opened the file at the desired offset. Element size determined by template type

Return
A request object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to write to

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Request MEL::FileIwriteShared(const File &file, const T *sptr, const int snum)

Non-Blocking.

Write to file from any processes that opened the file in parallel. Element size determined by template type

Return
A request object
Parameters
  • file -

    The file handle

  • sptr -

    Pointer to the memory to be written

  • snum -

    The number of elements to write

template <typename T>
Request MEL::FileIread(const File &file, T *rptr, const int rnum)

Non-Blocking.

Read from file from a single process. Element size determined by template type

Return
A request object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Request MEL::FileIreadAt(const File &file, const Offset offset, T *rptr, const int rnum)

Non-Blocking.

Read from file from a single process at the desired offset. Element size determined by template type

Return
A request object
Parameters
  • file -

    The file handle

  • offset -

    Byte offset into the file to read from

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read

template <typename T>
Request MEL::FileIreadShared(const File &file, T *rptr, const int rnum)

Non-Blocking.

Read from file from any processes that opened the file in parallel. Element size determined by template type

Return
A request object
Parameters
  • file -

    The file handle

  • rptr -

    Pointer to the memory to be read into

  • rnum -

    The number of elements to read