Package mpi

Class File


public final class File extends Object
This class represents MPI_File.
  • Constructor Details

    • File

      public File(Comm comm, String filename, int amode) throws MPIException
      Java binding of MPI_FILE_OPEN using MPI_INFO_NULL.
      Parameters:
      comm - communicator
      filename - name of the file to open
      amode - file access mode
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • File

      public File(Comm comm, String filename, int amode, Info info) throws MPIException
      Java binding of MPI_FILE_OPEN.
      Parameters:
      comm - communicator
      filename - name of the file to open
      amode - file access mode
      info - info object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
  • Method Details

    • close

      public void close() throws MPIException
      Java binding of MPI_FILE_CLOSE.
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • delete

      public static void delete(String filename) throws MPIException
      Java binding of MPI_FILE_DELETE using MPI_INFO_NULL.
      Parameters:
      filename - name of the file to delete
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • delete

      public static void delete(String filename, Info info) throws MPIException
      Java binding of MPI_FILE_DELETE.
      Parameters:
      filename - name of the file to delete
      info - info object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • setSize

      public void setSize(long size) throws MPIException
      Java binding of MPI_FILE_SET_SIZE.
      Parameters:
      size - size to truncate or expand file
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • preallocate

      public void preallocate(long size) throws MPIException
      Java binding of MPI_FILE_PREALLOCATE.
      Parameters:
      size - size to preallocate file
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getSize

      public long getSize() throws MPIException
      Java binding of MPI_FILE_GET_SIZE.
      Returns:
      size of file in bytes
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getGroup

      public Group getGroup() throws MPIException
      Java binding of MPI_FILE_GET_GROUP.
      Returns:
      group which opened the file
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getAMode

      public int getAMode() throws MPIException
      Java binding of MPI_FILE_GET_AMODE.
      Returns:
      file access mode to open the file
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • setInfo

      public void setInfo(Info info) throws MPIException
      Java binding of MPI_FILE_SET_INFO.
      Parameters:
      info - info object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getInfo

      public Info getInfo() throws MPIException
      Java binding of MPI_FILE_GET_INFO.
      Returns:
      new info object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • setView

      public void setView(long disp, Datatype etype, Datatype filetype, String datarep) throws MPIException
      Java binding of MPI_FILE_SET_VIEW using MPI_INFO_NULL.
      Parameters:
      disp - displacement
      etype - elementary datatype
      filetype - filetype
      datarep - data representation
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • setView

      public void setView(long disp, Datatype etype, Datatype filetype, String datarep, Info info) throws MPIException
      Java binding of MPI_FILE_SET_VIEW.
      Parameters:
      disp - displacement
      etype - elementary datatype
      filetype - filetype
      datarep - data representation
      info - info object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getView

      public FileView getView()
      Java binding of MPI_FILE_GET_VIEW.
      Returns:
      file view
    • readAt

      public Status readAt(long offset, Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_AT.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readAtAll

      public Status readAtAll(long offset, Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_AT_ALL.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeAt

      public Status writeAt(long offset, Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_AT.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeAtAll

      public Status writeAtAll(long offset, Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_AT_ALL.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iReadAt

      public Request iReadAt(long offset, Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IREAD_AT.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iReadAtAll

      public Request iReadAtAll(long offset, Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IREAD_AT_ALL.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iWriteAt

      public Request iWriteAt(long offset, Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IWRITE_AT.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iWriteAtAll

      public Request iWriteAtAll(long offset, Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IWRITE_AT_ALL.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • read

      public Status read(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readAll

      public Status readAll(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_ALL.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • write

      public Status write(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeAll

      public Status writeAll(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_ALL.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iRead

      public Request iRead(Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IREAD.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iReadAll

      public Request iReadAll(Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IREAD_ALL.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iWrite

      public Request iWrite(Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IWRITE.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iWriteAll

      public Request iWriteAll(Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IWRITE_ALL.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • seek

      public void seek(long offset, int whence) throws MPIException
      Java binding of MPI_FILE_SEEK.
      Parameters:
      offset - file offset
      whence - update mode
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getPosition

      public long getPosition() throws MPIException
      Java binding of MPI_FILE_GET_POSITION.
      Returns:
      offset of individual pointer
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getByteOffset

      public long getByteOffset(long offset) throws MPIException
      Java binding of MPI_FILE_GET_BYTE_OFFSET.
      Parameters:
      offset - offset
      Returns:
      absolute byte position of offset
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readShared

      public Status readShared(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_SHARED.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeShared

      public Status writeShared(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_SHARED.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iReadShared

      public Request iReadShared(Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IREAD_SHARED.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • iWriteShared

      public Request iWriteShared(Buffer buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_IWRITE_SHARED.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      request object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readOrdered

      public Status readOrdered(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_ORDERED.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeOrdered

      public Status writeOrdered(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_ORDERED.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • seekShared

      public void seekShared(long offset, int whence) throws MPIException
      Java binding of MPI_FILE_SEEK_SHARED.
      Parameters:
      offset - file offset
      whence - update mode
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getPositionShared

      public long getPositionShared() throws MPIException
      Java binding of MPI_FILE_GET_POSITION_SHARED.
      Returns:
      offset of individual pointer
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readAtAllBegin

      public void readAtAllBegin(long offset, Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_AT_ALL_BEGIN.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readAtAllEnd

      public Status readAtAllEnd(Object buf) throws MPIException
      Java binding of MPI_FILE_READ_AT_ALL_END.
      Parameters:
      buf - buffer
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeAtAllBegin

      public void writeAtAllBegin(long offset, Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_AT_ALL_BEGIN.
      Parameters:
      offset - file offset
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeAtAllEnd

      public Status writeAtAllEnd(Object buf) throws MPIException
      Java binding of MPI_FILE_WRITE_AT_ALL_END.
      Parameters:
      buf - buffer
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readAllBegin

      public void readAllBegin(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_ALL_BEGIN.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readAllEnd

      public Status readAllEnd(Object buf) throws MPIException
      Java binding of MPI_FILE_READ_ALL_END.
      Parameters:
      buf - buffer
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeAllBegin

      public void writeAllBegin(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_ALL_BEGIN.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeAllEnd

      public Status writeAllEnd(Object buf) throws MPIException
      Java binding of MPI_FILE_WRITE_ALL_END.
      Parameters:
      buf - buffer
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readOrderedBegin

      public void readOrderedBegin(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_READ_ORDERED_BEGIN.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • readOrderedEnd

      public Status readOrderedEnd(Object buf) throws MPIException
      Java binding of MPI_FILE_READ_ORDERED_END.
      Parameters:
      buf - buffer
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeOrderedBegin

      public void writeOrderedBegin(Object buf, int count, Datatype type) throws MPIException
      Java binding of MPI_FILE_WRITE_ORDERED_BEGIN.
      Parameters:
      buf - buffer
      count - number of items in buffer
      type - datatype of each buffer element
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • writeOrderedEnd

      public Status writeOrderedEnd(Object buf) throws MPIException
      Java binding of MPI_FILE_WRITE_ORDERED_END.
      Parameters:
      buf - buffer
      Returns:
      status object
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getTypeExtent

      public int getTypeExtent(Datatype type) throws MPIException
      Java binding of MPI_FILE_GET_TYPE_EXTENT.
      Parameters:
      type - type of data
      Returns:
      datatype extent
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • setAtomicity

      public void setAtomicity(boolean atomicity) throws MPIException
      Java binding of MPI_FILE_SET_ATOMICITY.
      Parameters:
      atomicity - true to set atomic mode, false to set nonatomic mode
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getAtomicity

      public boolean getAtomicity() throws MPIException
      Java binding of MPI_FILE_GET_ATOMICITY.
      Returns:
      current consistency of the file
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • sync

      public void sync() throws MPIException
      Java binding of MPI_FILE_SYNC.
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • setErrhandler

      public void setErrhandler(Errhandler errhandler) throws MPIException
      Java binding of the MPI operation MPI_FILE_SET_ERRHANDLER.
      Parameters:
      errhandler - new MPI error handler for file
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • getErrhandler

      public Errhandler getErrhandler() throws MPIException
      Java binding of the MPI operation MPI_FILE_GET_ERRHANDLER.
      Returns:
      MPI error handler currently associated with file
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.
    • callErrhandler

      public void callErrhandler(int errorCode) throws MPIException
      Java binding of the MPI operation MPI_FILE_CALL_ERRHANDLER.
      Parameters:
      errorCode - error code
      Throws:
      MPIException - Signals that an MPI exception of some sort has occurred.