Print this article
Wraprun is a utility that enables independent execution of multiple MPI applications under a single aprun call. It borrows from aprun MPMD syntax and also contains some wraprun specific syntax. The latest documentation can be found on the wraprun development README. The examples below illustrate its use.
By default wraprun applications must be dynamically linked. Wraprun itself depends on Python and is compatible with python/2.7.X and python/3.X but requires the user to load their preferred python environment module before loading wraprun. Below is an example of basic wraprun use for the applications foo.out and bar.out.
$ module load dynamic-link $ cc foo.c -o foo.out $ cc bar.c -o bar.out $ module load python wraprun $ wraprun -n 80 ./foo.out : -n 160 ./bar.out
foo.out and bar.out will run independently under a single aprun call.
In addition to the standard process placement flags available to aprun, the –w-cd flag can be set to change the current working directory for each executable:
$ wraprun -n 80 --w-cd /foo/dir ./foo.out : -n 160 --w-cd /bar/dir ./bar.out
This is particularly useful for legacy FORTRAN applications that use hard coded input and output file names.
Multiple instances of an application can be placed on a node using comma-separated PES syntax PES1,PES2,…,PESN syntax, for instance:
$ wraprun -n 2,2,2 ./foo.out [ : other tasks...]
would launch 3 two-process instances of foo.out on a single node.
In this case, the number of allocated nodes must be at least equal to the sum of processes in the comma-separated list of processing elements, divided by the maximum number of processes per node.
This may also be combined with the –w-cd flag :
$ wraprun -n 2,2,2 --w-cd /foo/dir1,/foo/dir2,/foo/dir3 ./foo.out [ : other tasks...]
For nonMPI executables a wrapper application, serial, is provided. This wrapper ensures that all executables will run to completion before aprun exits. To use, place serial in front of your application and arguments:
$ wraprun -n 1 serial ./foo.out -foo_args [ : other tasks...]
The stdout/err of each task run under wraprun will be directed to to it’s own unique file in the current working directory with names in the form:
Recommendations and Limitations
It is recommended that applications be dynamically linked. On Titan this can be accomplished by loading the dynamic-link module before invoking the Cray compile wrappers CC,cc, ftn.
The library may be statically linked although this is not fully supported.
All executables must reside in a compute node visible filesystem, e.g. Lustre. The underlying aprun call made by wraprun enforces the aprun ‘no-copy’ (‘-b’) flag.
wraprun works by intercepting all MPI function calls that contain an MPI_Comm argument. If an application calls an MPI function, containing an MPI_Comm argument, not included in src/split.c, the results are undefined.