Environment
Launching MPI programs
MPICH_jll.mpiexec — Functionmpiexec()A wrapper function for the MPI launcher executable. Returns a Cmd object pointing to the MPI launcher.
Usage
julia> run(`$(mpiexec()) -n 3 echo hello world`);
hello world
hello world
hello worldMPI.install_mpiexecjl — FunctionMPI.install_mpiexecjl(; command::String = "mpiexecjl",
destdir::String = joinpath(DEPOT_PATH[1], "bin"),
force::Bool = false, verbose::Bool = true)Install the mpiexec wrapper to destdir directory, with filename command. Set force to true to overwrite an existing destination file with the same path. If verbose is true, the installation prints information about the progress of the process.
Enums
MPI.ThreadLevel — TypeThreadLevelAn Enum denoting the level of threading support in the current process:
MPI.THREAD_SINGLE: Only one thread will execute.MPI.THREAD_FUNNELED: The process may be multi-threaded, but the application must ensure that only the main thread makes MPI calls. SeeIs_thread_main.MPI.THREAD_SERIALIZED: The process may be multi-threaded, and multiple threads may make MPI calls, but only one at a time (i.e. all MPI calls are serialized).MPI.THREAD_MULTIPLE: Multiple threads may call MPI, with no restrictions.
See also
Functions
MPI.Abort — FunctionAbort(comm::Comm, errcode::Integer)Make a “best attempt” to abort all tasks in the group of comm. This function does not require that the invoking environment take any action with the error code. However, a Unix or POSIX environment should handle this as a return errorcode from the main program.
External links
MPI.Init — FunctionInit(;threadlevel=:serialized, finalize_atexit=true, errors_return=true)Initialize MPI in the current process. The keyword options:
threadlevel: either:single,:funneled,:serialized(default),:multiple, or an instance ofThreadLevel.finalize_atexit: iftrue(default), adds anatexithook to callMPI.Finalizeif it hasn't already been called.errors_return: iftrue(default), will set the default error handlers forMPI.COMM_SELFandMPI.COMM_WORLDto beMPI.ERRORS_RETURN. MPI errors will then appear as Julia exceptions.
It will return the ThreadLevel value which MPI is initialized at.
All MPI programs must call this function at least once before calling any other MPI operations: the only MPI functions that may be called before MPI.Init are MPI.Initialized and MPI.Finalized.
It is safe to call MPI.Init multiple times, however it is not valid to call it after calling MPI.Finalize.
External links
MPI.Query_thread — FunctionQuery_thread()Query the level of threading support in the current process. Returns a ThreadLevel value denoting
External links
MPI.Is_thread_main — FunctionIs_thread_main()Queries whether the current thread is the main thread according to MPI. This can be called by any thread, and is useful for the THREAD_FUNNELED ThreadLevel.
External links
MPI.Initialized — FunctionInitialized()Returns true if MPI.Init has been called, false otherwise.
It is unaffected by MPI.Finalize, and is one of the few functions that may be called before MPI.Init.
External links
MPI.Finalize — FunctionFinalize()Marks MPI state for cleanup. This should be called after MPI.Init, and can be called at most once. No further MPI calls (other than Initialized or Finalized) should be made after it is called.
MPI.Init will automatically insert a hook to call this function when Julia exits, if it hasn't already been called.
External links
MPI.Finalized — FunctionFinalized()Returns true if MPI.Finalize has completed, false otherwise.
It is safe to call before MPI.Init and after MPI.Finalize.
External links
MPI.add_init_hook! — FunctionMPI.add_init_hook!(f)Register a function f that will be called as f() when MPI.Init is called. These are invoked in a first-in, first-out (FIFO) order.
MPI.run_init_hooks — FunctionMPI.run_init_hooks()Execute all functions that have been registered using MPI.add_init_hook!().
This function is executed automatically by MPI.Init() but must be invoked manually if MPI has been initialized externally by a direct call to MPI_Init(). It is safe to call this function multiple times (subsequent runs will be a no-op).
MPI.add_finalize_hook! — FunctionMPI.add_finalize_hook!(f)Register a function f that will be called as f() when MPI.Finalizer is called. These are invoked in a last-in, first-out (LIFO) order.
Errors
MPI.MPIError — TypeMPIErrorError thrown when an MPI function returns an error code. The code field contains the MPI error code.
MPI.API.FeatureLevelError — TypeFeatureLevelErrorError thrown if a feature is not implemented in the current MPI backend.