GithubHelp home page GithubHelp logo

lh-cbicr / tmux-mpi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wrs20/tmux-mpi

0.0 0.0 0.0 48 KB

TMUX-MPI: A tool for launching MPI processes in tmux windows.

License: MIT License

Python 100.00%

tmux-mpi's Introduction

TMUX-MPI

Introduction

tmux-mpi connects MPI processes to tmux windows. MPI launches n instances of dtach, these n instances are then connected to in tmux windows. To launch a command use:

tmux-mpi <nproc> <command>

For example,

tmux-mpi 2 hostname

will start a tmux session called tmux-mpi that can be connected to in a different terminal with

tmux attach -t tmux-mpi

or use

tmux attach

if there are no other tmux sessions. You may need to scroll up in the tmux window to see the output of this example. This dtach approach does mean that if the program crashes manual cleanup may need to happen. For example:

pkill -9 dtach

Copyright 2020, WR Saunders, [email protected]

Installation

Requires dtach and tmux to be installed. Pip installable with:

pip install --upgrade --no-cache-dir git+https://github.com/wrs20/tmux-mpi@master

Configuration

Some environment variables can be set to configure behaviour. These are environment variables such that they can be set once somewhere in an environment.

TMUX_MPI_MPIRUN
Configure how mpiexec is called, e.g. TMUX_MPI_MPIRUN="mpiexec -s all" for recent Intel MPI.
TMUX_MPI_POST_LAUNCH
Configure a command to launch after the processes have started, e.g. TMUX_MPI_POST_LAUNCH="xterm -e 'tmux attach -t TMUX_MPI_SESSION_NAME'" would launch a new xterm and connect to the created server. The string TMUX_MPI_SESSION_NAME will be replaced with the actual session name.
TMUX_MPI_MODE
Choose if each rank should be in a new tmux window using window (default) or pane, e.g. TMUX_MPI_MODE=pane.
TMUX_MPI_SYNC_PANES
Synchronises the input to the tmux panes when using TMUX_MPI_MODE=pane, e.g. TMUX_MPI_SYNC_PANES=1. Default off. Note that this uses the pane synchronisation built into tmux.

Examples

Try the following to start debugging a Python program using a C extension in GDB and 2 MPI ranks. The environment variable will automatically launch a xterm window to connect to the session. Note that tmux window numbers are not MPI ranks (this functionality would require this tool to access the MPI implementation somehow).

# Start a xterm that connects to the session
export TMUX_MPI_POST_LAUNCH="xterm -e 'tmux attach -t TMUX_MPI_SESSION_NAME'"
# launch tmux-mpi
tmux-mpi 2 gdb --ex run --args python <script-name>

Same as above but using tmux panes instead of windows and synchronised input:

# Start a xterm that connects to the session
export TMUX_MPI_POST_LAUNCH="xterm -e 'tmux attach -t TMUX_MPI_SESSION_NAME'"
# use panes not windows
export TMUX_MPI_MODE=pane
#synchronised inputs
export TMUX_MPI_SYNC_PANES=1
# launch tmux-mpi
tmux-mpi 2 gdb --ex run --args python <script-name>

Known Issues and Workarounds

Intel MPI

Some (recent?) versions of Intel MPI try to do stdin redirection by default. If you have issues with ranks not starting try the following (as demonstrated using python):

TMUX_MPI_MPIRUN="mpiexec -s all" tmux-mpi 2 python

tmux-mpi's People

Contributors

wrs20 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.