DMTCP(1)
πΈ NAME πΈ
okay so bestie, sit down, hydrate, because today we're talking about dmtcp β Distributed MultiThreaded Checkpointing π it's literally the tool that freezes your programs mid-sentence like a screenshot and then brings them back to life later. no cap.
β¨ SYNOPSIS β¨
like, the whole vibe in four lines:
dmtcp_coordinator [port]
dmtcp_launch command [args...]
dmtcp_restart ckpt_FILE1.dmtcp [ckpt_FILE2.dmtcp...]
dmtcp_command coordinatorCommand
π¦ DESCRIPTION π¦
so DMTCP is a tool for transparently checkpointing the state of an arbitrary group of programs, spread across many machines, all connected by sockets π. it does not modify your program, and it does not modify your operating system. it justβ¦ does it. main character energy, honestly.
and MTCP? that's a standalone component of DMTCP, available as a checkpointing library for a single process. one process, one little legend π«Ά
π OPTIONS π
for each command, the --help or -h flag will show you the command-line options, bestie. and plot twist: most command line options can also be controlled through environment variables β¨ you can set those in bash with export NAME=value, or in tcsh with setenv NAME value. pick your fighter.
DMTCP_CHECKPOINT_INTERVAL=integerβ time in seconds between automatic checkpoints. you can also start one manually by typing'c'into the coordinator, iconic. (default:0, disabled;dmtcp_coordinatoronly)DMTCP_HOST=stringβ the hostname where the cluster-wide coordinator is running. (default:localhost;dmtcp_launch,dmtcp_restartonly)DMTCP_PORT=integerβ the port the cluster-wide coordinator listens on. (default:7779)DMTCP_GZIP=(1|0)β set it to"0"to disable compression of checkpoint images. (default:1, compression enabled;dmtcp_launchonly)
β οΈ WARNING: gzip adds seconds π without gzip, ckpt/restart is often less than 1 s.
DMTCP_CHECKPOINT_DIR=pathβ the directory to store checkpoint images in. (default:./)DMTCP_SIGCKPT=integerβ internal signal number to use for checkpointing. it must not be used by the user program, okay? like, don't touch it. (default:SIGUSR2;dmtcp_launchonly)
π DMTCP_COORDINATOR π
every computation you wanna checkpoint has to include a DMTCP coordinator process. you can either start one explicitly with dmtcp_coordinator, or just let one get started implicitly in the background by dmtcp_launch or dmtcp_restart β they need it to operate, so they'll handle it. the address of the unique coordinator should be specified by dmtcp_launch, dmtcp_restart, and dmtcp_command either through the --host and --port command-line flags or through the DMTCP_HOST and DMTCP_PORT environment variables. if you give neither, the host-port pair defaults to localhost-7779. the host-port pair associated with a particular coordinator is given by the command-line flags used in the dmtcp_coordinator command, or the environment variables then in effect, or the default of localhost-7779.
the coordinator is stateless and is not checkpointed. so on restart, you can use an existing coordinator or a brand new one, whichever. multiple computations under DMTCP control can coexist just fine, as long as you give each one a unique coordinator (with a unique host-port pair) π«Ά
the coordinator initiates a checkpoint for all processes in its computation group. checkpoints can be:
- performed automatically on an interval (see
DMTCP_CHECKPOINT_INTERVALabove) - initiated manually on the standard input of the coordinator (see the next paragraph)
- initiated directly under program control by the computation through the plugin API (see below)
the coordinator accepts the following commands on its standard input. each command should be followed by the <return> key π the commands are:
lβ list connected nodessβ print status messagecβ checkpoint all nodesfβ force a restart even if there are missing nodes (debugging)kβ kill all nodesqβ kill all nodes and quit?β show this message
coordinator commands can also be issued remotely using dmtcp_command. slay π
π EXAMPLE USAGE π
- in a separate terminal window, start the
dmtcp_coordinator. (see previous section.)
dmtcp_coordinator
- in separate terminal(s), replace each command(s) with
"dmtcp_launch [command]". the checkpointed program will connect to the coordinator specified byDMTCP_HOSTandDMTCP_PORT. new threads will be checkpointed as part of the process. child processes will automatically be checkpointed. remote processes started viasshwill automatically checkpointed. (internally, DMTCP modifies thesshcommand line to calldmtcp_launchon the remote host.)
dmtcp_launch ./myprogram
- to manually initiate a checkpoint, either run the command below or type
"c"followed by<return>into the coordinator. checkpoint files for each process will be written toDMTCP_CHECKPOINT_DIR. thedmtcp_coordinatorwill write"dmtcp_restart_script.sh"to its working directory. this script contains the necessary calls todmtcp_restartto restart the entire computation, including remote processes created viassh.
dmtcp_command -c
OR: dmtcp_command --checkpoint
- to restart, one should execute
dmtcp_restart_script.sh, which is created by thedmtcp_coordinatorin its working directory at the time of checkpoint. one can optionally edit this script to migrate processes to different hosts. by default, only one restarted process will be restarted in the foreground and receive the standard input. the script may be edited to choose which process will be restarted in the foreground.
./dmtcp_restart_script.sh
π§ DMTCP PLUGIN π§
the source distribution includes a top-level plugin directory, with examples of how to write a plugin for DMTCP π plugins allow a checkpointed application to disconnect from an external resource, and then reconnect to it at the time of restart. further examples are in the test/plugin directory. in particular, test/plugin/applic-initiated demonstrates how an application can request a checkpoint under program control. cute, right?
the plugin feature adds three new user-programmable capabilities. a plugin may:
- add wrappers around system calls
- take special actions at during certain events (e.g. pre-checkpoint, resume/post-checkpoint, restart)
- and may insert key-value pairs into a database at restart time that is then available to be queried by the restarted processes of a computation.
(the events available to the plugin feature form a superset of the events available with the dmtcpaware interface.) one or more plugins are invoked via a list of colon-separated absolute pathnames.
dmtcp_launch --with-plugin PLUGIN1[:PLUGIN2]...
π DMTCPAWARE API π
okay so this API is now deprecated in favor of DMTCP plugins (see above) π DMTCP provides a programming interface to allow checkpointed applications to interact with dmtcp. in the source distribution, see dmtcpaware/dmtcpaware.h for the functions available. see test/dmtcpaware[123].c for three example applications. for an example of its usage, try:
cd test; rm dmtcpaware1; make dmtcpaware1; ./autotest -v dmtcpaware1
the user application should link with libdmtcpaware.so (-ldmtcpaware) and use the header file dmtcp/dmtcpaware.h.
β RETURN CODE β
a target program under DMTCP control normally returns the same return code as if it were executed without DMTCP. however, if DMTCP fails (as opposed to the target program failing), DMTCP returns a DMTCP-specific return code, rc (or rc+1, rc+2 for two special cases), where rc is the integer value of the environment variable DMTCP_FAIL_RC if set, or else the default value, 99.
so yeah. 99. remember it. iykyk π
π SEE ALSO π
full documentation is available at the DMTCP home page:
http://dmtcp.sourceforge.net/- FAQ:
http://dmtcp.sourceforge.net/FAQ.html - Plugins:
https://github.com/dmtcp/dmtcp/blob/master/doc/plugin-tutorial.pdf(DMTCP-2.x)
πΈ AUTHORS πΈ
DMTCP and its standalone single-process component MTCP (MultiThreaded CheckPointing) were created by the long-term contributors, Jason Ansel, Kapil Arya, Gene Cooperman, Rohan Garg, Artem Y. Polyakov, Mike Rieker, and a series of additional contributors including Alex Brick, Tyler Denniston, William Enright, Gregory Kerr, Ana-Maria Visan, and others π«Ά for support, see the DMTCP home page.
and that's the whole thing, bestie β¨ this was written by the DMTCP team and dated June 17, 2008, living forever as DMTCP(1) in section 1 of the manual π
go checkpoint something and eat, fr fr π
π¦ where this page comes from
- arch rolling: dmtcp 4.2.0-1 Β· LGPL-3.0-or-later
- fedora 43: dmtcp 3.1.2-1.fc42 Β· LGPL-3.0-or-later AND (MIT OR BSD-3-Clause)
- fedora 44: dmtcp 4.1.0-1.fc44 Β· LGPL-3.0-or-later AND (MIT OR BSD-3-Clause)
- nixos 26.05: dmtcp 4.1.0
- nixpkgs unstable: dmtcp 4.1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms