MPIL_Trace_on(3)
π MPIL_Trace_on β the LAM/MPI glow-up for run-time tracing β¨
okay bestie, this is a page from the LAM/MPI manual (yes, the MPIL_Trace_on(3) one), and it's about flipping your tracing ON at exactly the right moment. sit with me, it's gonna be good π
πΈ NAME πΈ
MPIL_Trace_on β the LAM/MPI-specific function that turns run-time tracing on, like a little light switch for your trace files π
β¨ SYNOPSIS β¨
#include <mpi.h>
int MPIL_Trace_on(void)
π¦ NOTES π¦
so the whole point of these functions is giving your app the flexibility to generate traces only during the certain interesting phases of its execution. and why do we care? because that technique can considerably reduce the size of the trace files and also the burden of displaying them. it's giving "we only film the good parts" energy π
both functions are collective over the MPI_COMM_WORLD communicator, no cap.
in typical usage, you'd use the -toff option of mpirun (1) to enable tracing, but start with the runtime switch in the off position. then, at the beginning of an interesting phase of program execution, MPIL_Trace_on gets called. MPIL_Trace_off gets called after the interesting phase. and you can turn tracing on and off many times β each period of tracing eventually forms a trace segment in the trace file extracted by lamtrace (1). if the on/off functions are never used and tracing is enabled with the -ton option of mpirun (1), you get a single trace segment instead. one long take, periodt π¬
the on/off functions have no effect if tracing is not enabled by mpirun (1) with either the -ton or -toff switches. which is actually iconic news: your application can be littered with these functions and still run without trace collection and with very little additional overhead, thanks to the no-operation function calls. sprinkle them everywhere, it's fine π§
this is a LAM/MPI-specific function and is intended mainly for debugging. if you're using this function, it should be used in conjunction with the LAM_MPI C preprocessor macro:
#if LAM_MPI
MPIL_Trace_on();
#endif
protect the vibes, protect the portability π«Ά
π LIMITATIONS π
after the volume of generated traces exceeds a preset limit, the oldest traces are discarded in favour of new traces. yes, they get evicted, it's brutal out here π. and avoiding discarded traces is further incentive to use MPIL_Trace_on and MPIL_Trace_off β like, that's literally a whole extra reason. keep your faves, don't let them get deleted π
π NOTES FOR FORTRAN π
all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. in Fortran, MPI routines are subroutines, and they're invoked with the call statement. different syntax, same slay β
all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, all of them. don't fight it π
π₯ ERRORS π₯
if an error occurs in an MPI function, the current MPI error handler is called to handle it. by default, this error handler aborts the MPI job. dramatic? yes. but that's the default, so.
the error handler may be changed with MPI_Errhandler_set; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned (in C and Fortran; this error handler is less useful with the C++ MPI bindings β the predefined error handler MPI::ERRORS_THROW_EXCEPTIONS should be used in C++ if the error value needs to be recovered). note that MPI does not guarantee that an MPI program can continue past an error. so like... plan accordingly π
all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function and Fortran routines in the last argument. the C++ bindings for MPI do not return error values; instead, error values are communicated by throwing exceptions of type MPI::Exception (but not by default). exceptions are only thrown if the error value is not MPI::SUCCESS.
also note that if the MPI::ERRORS_RETURN handler is set in C++, while MPI functions will return upon an error, there will be no way to recover what the actual error value was. that's the trade-off, bestie π¬
MPI_SUCCESSβ no error; the MPI routine completed successfully. the dream. the goal. πMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. go ask the string, she knows π¬
π SEE ALSO π
MPI_Trace_off, mpirun
π LOCATION π
mpil_trace.c
that's the whole page, no notes skipped, every flag and error code present and accounted for π«‘β¨ this was LAM/MPI 7.1.4, dated 6/24/2006 β an absolute vintage icon, honestly, and she still eats π π
π¦ where this page comes from
- debian bookworm: lam-mpidoc 7.1.4-7
- debian trixie: lam-mpidoc 7.1.4-7.2
- ubuntu jammy: lam-mpidoc 7.1.4-7
- ubuntu noble: lam-mpidoc 7.1.4-7.1build2
- ubuntu questing: lam-mpidoc 7.1.4-8
- ubuntu resolute: lam-mpidoc 7.1.4-8build1
- ubuntu stonking: lam-mpidoc 7.1.4-8build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms