MPI_FILE_DELETE(3)

πŸ’– MPI_FILE_DELETE πŸ’–

okay bestie, we're looking at the Open MPI page for MPI_FILE_DELETE(3) β€” yes it's a whole manual page, and yes it's actually fun once you get it. sit with me for a sec ✨


🌸 NAME 🌸

MPI_File_delete β€” deletes a file. that's it. that's the whole job. she removes a file and she does it with main character energy πŸ’…


✨ SYNTAX ✨

πŸŽ€ C Syntax

#include <mpi.h>

int MPI_File_delete(const char *filename, MPI_Info info)

πŸŽ€ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_DELETE(FILENAME, INFO, IERROR)
     CHARACTER*(*)   FILENAME
     INTEGER INFO, IERROR

πŸŽ€ Fortran 2008 Syntax

USE mpi_f08
MPI_File_delete(filename, info, ierror)
     CHARACTER(LEN=*), INTENT(IN) :: filename
     TYPE(MPI_Info), INTENT(IN) :: info
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ¦‹ INPUT PARAMETERS πŸ¦‹

  • filename β€” the name of the file you wanna delete, as a string (that's string bestie, not a vibe).
  • info β€” the Info object. it's a handle.

🌈 OUTPUT PARAMETER 🌈

  • ierror β€” Fortran only: the error status, an integer. 🫢

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea, fr fr: MPI_File_delete deletes the file identified by the file name filename β€” but only if it's not currently open by any process.

and okay, this part is important, don't skip it: it is an error to delete the file with MPI_File_delete if some process has it open, but MPI_File_delete does not check this. like… she will not warn you. she will not look. she just goes πŸƒβ€β™€οΈπŸ’¨

and if the file doesn't exist? MPI_File_delete returns an error in the class MPI_ERR_NO_SUCH_FILE. no cap. πŸ’€


πŸ’œ ERRORS πŸ’œ

almost all MPI routines return an error value β€” C routines hand it back as the return result of the function, and Fortran routines stash it in that last argument. iconic behavior honestly.

before that error value comes back, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. and if no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. and when MPI_COMM_SELF is not initialized β€” like before MPI_Init / MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively β€” the error raises the initial error handler.

that initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or the info key to MPI_Comm_spawn / MPI_Comm_spawn_multiple. and if no other appropriate error handler has been set? then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions, and the MPI_ERRORS_ABORT error handler is called for all other MPI functions.

Open MPI ships three predefined error handlers you can use, periodt:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. dramatic and effective πŸ’…
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. when it's called on a communicator, it acts as if MPI_Abort was called on that communicator. if called on a window or file, it acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. if called on a session, it aborts only the local process.
  • MPI_ERRORS_RETURN β€” returns an error code to the application. chill of her honestly ✨

MPI applications can also implement their own error handlers, by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler, or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler
⚠️ note that MPI does not guarantee that an MPI program can continue past an error. like, she said what she said. plan accordingly bestie 😭

see the MPI man page for a full list of MPI error codes. and see the Error Handling section of the MPI-3.1 standard for even more info, iykyk πŸ“š


2003-2026, The Open MPI Community


and that's the whole page, bestie!! 🧚✨ this was MPI_FILE_DELETE(3) from Open MPI, dated Sep 10, 2026 β€” go delete a file responsibly, don't do it while somebody has it open, and text me when you're done πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from