pbsrun(8B)
π pbsrun(8B) PBS Professional π
β¨ NAME β¨
pbsrun β general-purpose wrapper script for mpirun. Sheβs the go-between, the bestie who translates, okay? π
π SYNOPSIS π
pbsrun
pbsrun --version
π DESCRIPTION π
Okay so pbsrun is a wrapper script for any of several versions of mpirun. The whole point? It gives PBS a user-transparent way to control jobs that call mpirun in their jobscripts. No cap. β¨
The pbsrun_wrap script instantiates pbsrun so that the wrapper script for the specific version of mpirun being used has the same name as that version of mpirun. Cute, right?
If the mpirun wrapper script is run inside a PBS job, it translates any mpirun call of this form:
mpirun [<options>] <executable> [<args>]
into:
mpirun [<options>] pbs_attach [<special options to pbs_attach>] \
<executable> [<args>]
where special options to pbs_attach means any options pbs_attach needs to do its job (e.g. -j $PBS_JOBID). Slay. π₯
If the wrapper script is executed outside of PBS, a warning is issued about "not running under PBS", but it proceeds as if the actual program had been called in standalone fashion. Lowkey polite of it. π«Ά
The pbsrun wrapper script is not meant to be executed directly. Instead it is instantiated by pbsrun_wrap. It gets copied to the target directory and renamed pbsrun.<mpirun version/flavor>, where mpirun version/flavor is a string that identifies the mpirun version being wrapped (e.g. ch_gm).
The pbsrun script, if executed inside a PBS job, runs an initialization script named $PBS_EXEC/lib/MPI/pbsrun.<mpirun version/flavor>.init, then parses mpirun-like arguments from the command line. It sorts which options and option values to retain, to ignore, or to transform before calling the actual mpirun script with a pbs_attach prefixed to the executable. The actual mpirun to call? Found by tracing the link pointed to by $PBS_EXEC/lib/MPI/pbsrun.<mpirun version/flavor>.link.
For all of the wrapped MPIs, the maximum number of ranks that can be launched is the number of entries in $PBS_NODEFILE. Periodt. π
The wrapped MPIs are:
- MPICH-GM's
mpirun(mpirun.ch_gm) with rsh/ssh ( deprecated as of 14.2.1) - MPICH-MX's
mpirun(mpirun.ch_mx) with rsh/ssh ( deprecated as of 14.2.1) - MPICH-GM's
mpirun(mpirun.mpd) with MPD ( deprecated as of 14.2.1) - MPICH-MX's
mpirun(mpirun.mpd) with MPD ( deprecated as of 14.2.1) - MPICH2's
mpirun - Intel MPI's
mpirun( deprecated as of 13.0) - MVAPICH1's
mpirun( deprecated as of 14.2.1) - MVAPICH2's
mpiexec
βοΈ OPTIONS βοΈ
--versionβpbsrunreturns its PBS version information and exits. This option can only be used alone. So donβt try to combo it, bestie. π
π§ INITIALIZATION SCRIPT π§
The initialization script is called $PBS_EXEC/lib/MPI/pbsrun.<mpirun version/flavor>.init, where mpirun version/flavor reflects the mpirun flavor/version being wrapped. An administrator can modify it to customize against the local flavor/version of mpirun being wrapped.
Inside this sourced init script, 8 variables are set:
options_to_retain="-optA -optB <val> -optC <val1> val2> ..."
options_to_ignore="-optD -optE <n> -optF <val1> val2> ..."
options_to_transform="-optG -optH <val> -optI <val1> val2> ..."
options_to_fail="-optY -optZ ..."
options_to_configfile="-optX <val> ..."
options_with_another_form="-optW <val> ..."
pbs_attach=pbs_attach
options_to_pbs_attach="-J $PBS_JOBID"
π οΈ Initialization Script Options π οΈ
options_to_retainβ Space-separated list of options and values thatpbsrun.<mpirun version/flavor>passes on to the actualmpiruncall. Options must begin with-or--, and option arguments must be specified by some arbitrary name with left and right arrows, as in"<val1>".options_to_ignoreβ Space-separated list of options and values thatpbsrun.<mpirun version/flavor>does not pass on to the actualmpiruncall. Options must begin with-or--, and option arguments must be specified by arbitrary names with left and right arrows, as in"<n>".options_to_transformβ Space-separated list of options and values thatpbsrunmodifies before passing on to the actualmpiruncall.option_to_failβ Space-separated list of options that will causepbsrunto exit upon encountering a match. (Yep, the original saysoption_to_failhere while the variable list hasoptions_to_failβ keep that energy. π)options_to_configfileβ Single option and value that refers to the name of the"configfile"containing command line segments found in certain versions ofmpirun.options_with_another_formβ Space-separated list of options and values that can be found inoptions_to_retain,options_to_ignore, oroptions_to_transform, whose syntax has an alternate, unsupported form.pbs_attachβ Path topbs_attach, which is called before the<executable>argument ofmpirun.options_to_pbs_attachβ Special options to pass to thepbs_attachcall. You may pass variable references (e.g.$PBS_JOBID) and they are substituted bypbsrunto actual values.
If pbsrun encounters any option not found in options_to_retain, options_to_ignore, and options_to_transform, then it is flagged as an error. No silent yikes. π
π§ Functions Created π§
These functions are created inside the init script. These can be modified by the PBS administrator.
transform_action () {
# passed actual values of $options_to_transform
args=$*
}
boot_action () {
mpirun_location=$1
}
evaluate_options_action () {
# passed actual values of transformed options
args=$*
}
configfile_cmdline_action () {
args=$*
}
end_action () {
mpirun_location=$1
}
transform_action()β Thepbsrun.<mpirun version/flavor>wrapper script invokestransform_action()(called once on each matched item and value) with actual options and values received matching one of the"options_to_transform". The function returns a string to pass on to the actualmpiruncall.boot_action()β Performs any initialization tasks needed before running the actualmpiruncall. For instance, GM's MPD requires the MPD daemons to be user-started first. This function is called by thepbsrun.<mpirun version/flavor>script with the location of actualmpirunpassed as the first argument. Also, thepbsrun.<mpirun version/flavor>checks for the exit value of this function to determine whether or not to progress to the next step.evaluate_options_action()β Called with the actual options and values that resulted after consultingoptions_to_retain,options_to_ignore,options_to_transform, and executingtransform_action(). This provides one more chance for the script writer to evaluate all the options and values in general, and make any necessary adjustments, before passing them on to the actualmpiruncall. For instance, this function can specify what the default value is for a missing-npoption.configfile_cmdline_action()β Returns the actual options and values to be put in before theoption_to_configfileparameter.configfile_firstline_action()β Returns the item that is put in the first line of the configuration file specified in theoption_to_configfileparameter.end_action()β Called bypbsrun.<mpirun version/flavor>at the end of execution. It undoes any action done bytransform_action(), like cleanup of temporary files. It is also called whenpbsrun.<mpirun version/flavor>is prematurely killed. This function is called with the location of actualmpirunpassed as first argument.
The actual mpirun program to call is the path pointed to by $PBS_EXEC/lib/MPI/pbsrun.<mpirun version/flavor>.link.
πΈ Modifying *.init scripts πΈ
So administrators can modify *.init scripts without breaking package verification in RPM, master copies of the initialization scripts are named *.init.in. pbsrun_wrap instantiates the *.init.in files as *.init. For instance, $PBS_EXEC/lib/MPI/pbsrun.mpich2.init.in is the master copy, and pbsrun_wrap instantiates it as $PBS_EXEC/lib/MPI/pbsrun.mpich2.init. pbsrun_unwrap takes care of removing the *.init files. Iconic. π
π MPIRUN VERSIONS/FLAVORS π
π§΅ MPICH-GM's mpirun (mpirun.ch_gm) with rsh/ssh: pbsrun.ch_gm π§΅
SYNTAX
pbsrun.ch_gm <options> <executable> <arg1> <arg2> ... <argn>
Deprecated. This is the PBS wrapper script to MPICH-GM's mpirun (mpirun.ch_gm) with rsh/ssh process startup method.
If executed inside a PBS job, this allows for PBS to track all MPICH-GM processes started by rsh/ssh so that PBS can perform accounting and have complete job control.
If executed outside of a PBS job, it behaves exactly as if standard mpirun.ch_gm was used.
OPTIONS HANDLING
If executed inside a PBS job script, all mpirun.ch_gm options given are passed on to the actual mpirun call with these exceptions:
-machinefile <file>β The file argument contents are ignored and replaced by the contents of the$PBS_NODEFILE.-npβ If not specified, the number of entries found in the$PBS_NODEFILEis used.-pgβ The use of the-pgoption, for having multiple executables on multiple hosts, is allowed but it is up to user to make sure only PBS hosts are specified in the process group file; MPI processes spawned are not guaranteed to be under the control of PBS. So yeah, that part is on you. π
WRAP/UNWRAP
To wrap MPICH-GM's mpirun script:
# pbsrun_wrap [MPICH-GM_BIN_PATH]/mpirun.ch_gm pbsrun.ch_gm
To unwrap MPICH-GM's mpirun script:
# pbsrun_unwrap pbsrun.ch_gm
π§΅ MPICH-MX's mpirun (mpirun.ch_mx) with rsh/ssh: pbsrun.ch_mx π§΅
SYNTAX
pbsrun.ch_mx <options> <executable> <arg1> <arg2> ... <argn>
Deprecated. This is the PBS wrapper script to MPICH-MX's mpirun (mpirun.ch_mx) with rsh/ssh process startup method.
If executed inside a PBS job, this allows for PBS to track all MPICH-MX processes started by rsh/ssh so that PBS can perform accounting and has complete job control. π
If it's run outside of a PBS job, bestie, it behaves exactly as if plain ol' standard mpirun.ch_mx was used β no PBS magic, no extras. π«
OPTIONS HANDLING π
Inside a PBS job script? Every mpirun.ch_gm option you give gets passed on to the actual mpirun call β with a few iconic exceptions:
-machinefile <file>β the contents of the file argument are ignored, bestie, and swapped out for whatever's in$PBS_NODEFILE. β¨-npβ not specified? Then the number of entries found in$PBS_NODEFILEis used. Slay. β-pgβ using-pg(for having multiple executables on multiple hosts) is allowed, but it's on you to make sure only PBS hosts are listed in the process group file. The MPI processes spawned are not guaranteed to be under the control of PBS. No cap. β οΈ
WRAP/UNWRAP π
To wrap MPICH-MX's mpirun script:
# pbsrun_wrap [MPICH-MX_BIN_PATH]/mpirun.ch_mx pbsrun.ch_mx
To unwrap MPICH-MX's mpirun script:
# pbsrun_unwrap pbsrun.ch_mx
π MPICH-GM's mpirun (mpirun.mpd) with MPD: pbsrun.gm_mpd
SYNTAX
pbsrun.gm_mpd <options> <executable> <arg1> <arg2> ... <argn>
Deprecated, bestie π β this is the PBS wrapper script for MPICH-GM's mpirun (mpirun.mpd) with the MPD process startup method.
Run it inside a PBS job and PBS gets to track all the MPICH-GM processes started by the MPD daemons β so PBS can do its accounting thing and have complete job control. Iconic behavior, honestly. π
Outside of a PBS job? Behaves exactly as if standard mpirun.ch_gm with MPD was used. π
OPTIONS HANDLING
Inside a PBS job script, all mpirun.ch_gm-with-MPD options get passed on to the actual mpirun call, except these:
-m <file>β the file's contents are ignored and replaced by the contents of$PBS_NODEFILE. π«Ά-npβ if you don't specify it, the number of entries found in$PBS_NODEFILEis used. β¨-pgβ using-pg(multiple executables on multiple hosts) is allowed, but you have to make sure only PBS hosts are listed in the process group file; MPI processes spawned are not guaranteed to be under the control of PBS. π
STARTUP/SHUTDOWN πΈ
The script starts MPD daemons on each of the unique hosts listed in $PBS_NODEFILE, using either rsh or ssh based on the value of the environment variable RSHCOMMAND. The default is rsh. π
It also takes care of shutting those MPD daemons down at the end of a run, so you don't have to. Considerate queen behavior. π§
WRAP/UNWRAP
To wrap MPICH-GM's mpirun script with MPD:
# pbsrun_wrap [MPICH-GM_BIN_PATH]/mpirun.mpd pbsrun.gm_mpd
To unwrap MPICH-GM's mpirun script with MPD:
# pbsrun_unwrap pbsrun.gm_mpd
β¨ MPICH-MX's mpirun (mpirun.mpd) with MPD: pbsrun.mx_mpd
SYNTAX
pbsrun.mx_mpd <options> <executable> <arg1> <arg2> ... <argn>
Deprecated again, sorry babe π β this is the PBS wrapper script for MPICH-MX's mpirun (mpirun.mpd) with the MPD process startup method.
Inside a PBS job, PBS can track all the MPICH-MX processes started by the MPD daemons, so it can do its accounting and have complete job control. π
Outside of a PBS job? Behaves exactly as if standard mpirun.ch_mx with MPD was used. β¨
OPTIONS HANDLING
Inside a PBS job script, all mpirun.ch_gm-with-MPD options get passed on to the actual mpirun call, with these exceptions:
-m <file>β the file's contents are ignored and replaced by the contents of$PBS_NODEFILE. π«Ά-npβ if not specified, the number of entries found in$PBS_NODEFILEis used. β-pgβ allowed (multiple executables on multiple hosts), but it's up to you to make sure only PBS hosts are in the process group file; spawned MPI processes are not guaranteed to be under the control of PBS. π
STARTUP/SHUTDOWN πΈ
The script starts MPD daemons on each of the unique hosts listed in $PBS_NODEFILE, using either the rsh or ssh method, based on the value of the environment variable RSHCOMMAND β rsh is the default. π
It also handles shutting down the MPD daemons at the end of a run. Very demure, very mindful. π§
WRAP/UNWRAP
To wrap MPICH-MX's mpirun script with MPD:
# pbsrun_wrap [MPICH-MX_BIN_PATH]/mpirun.mpd pbsrun.mx_mpd
To unwrap MPICH-MX's mpirun script with MPD:
# pbsrun_unwrap pbsrun.mx_mpd
π¦ MPICH2's mpirun: pbsrun.mpich2
SYNTAX
pbsrun.mpich2 [<global args>] [<local args>] <executable>
[<args>] [: [<local args>] <executable> [<args>]]
- or -
pbsrun.mpich2 -configfile <configfile>
where configfile contains command line segments as lines:
[local args] executable1 [args]
[local args] executable2 [args]
[local args] executable3 [args]
This is the PBS wrapper script for MPICH2's mpirun. π
Inside a PBS job, PBS gets to track all the MPICH2 processes so it can do its accounting and have complete job control. π
Outside of a PBS job? Behaves exactly as standard MPICH2's mpirun would. β¨
OPTIONS HANDLING
Inside a PBS job script, all of MPICH2's mpirun options you give get passed on to the actual mpirun call, except:
-hostand-ghostβ for specifying the execution host to run on. Not passed on to the actualmpiruncall. π«-machinefile <file>β the file's contents are ignored and replaced by the contents of$PBS_NODEFILE. π«Ά- MPICH2's mpirun
-localonly <x>β for specifying the<x>number of processes to run locally. Not supported, bestie π. The user is advised instead to use the equivalent arguments:-np <x> -localonly. Why? Because thepbsrunwrapper script cannot handle a variable number of arguments to an option (like,-localonlyhas 1 argument and-localonly <x>has 2 arguments). π -npβ if the user did not specify a-npoption, then no default value is provided by the PBS wrapper scripts. It's up to the localmpirunto decide what the reasonable default should be β which is usually1. β
STARTUP/SHUTDOWN πΈ
The script makes sure the MPD daemons on each of the hosts listed in $PBS_NODEFILE are started, and it also makes sure those MPD daemons have been shut down at the end of MPI job execution. So thoughtful. π§
WRAP/UNWRAP
To wrap MPICH2's mpirun script:
# pbsrun_wrap [MPICH2_BIN_PATH]/mpirun pbsrun.mpich2
To unwrap MPICH2's mpirun script:
# pbsrun_unwrap pbsrun.mpich2
π Intel MPI's mpirun: pbsrun.intelmpi
Heads up bestie: wrapping Intel MPI, and support for mpdboot, are deprecated. π
SYNTAX
pbsrun.intelmpi [<mpdboot options>] [<mpiexec options>]
<executable> [<prog args>]
[: [<mpiexec options>] <executable> [<prog args>]]
- or -
pbsrun.intelmpi [<mpdboot options>] -f <configfile>
where mpdboot options are any options to pass to the mpdboot program β which Intel MPI's mpirun automatically calls to start MPDs β and configfile contains command line segments as lines. π
This is the PBS wrapper script for Intel MPI's mpirun. β¨
Inside a PBS job, PBS gets to track all the Intel MPI processes so it can do accounting and have complete job control. π
Outside of a PBS job? Behaves exactly as standard Intel MPI's mpirun would. π
Usingpbsrun,pbsrun_wrap, andpbsrun_unwrapwith Intel MPI is deprecated as of13.0. π
OPTIONS HANDLING
Inside a PBS job script, all of the options to the PBS interface to MPI's mpirun get passed to the actual mpirun call, except:
-hostand-ghostβ for specifying the execution host to run on. Not passed on. π«-machinefile <file>β the file's contents are ignored and replaced by the contents of$PBS_NODEFILE. π«Ά- mpdboot options
--totalnum=*and--file=*β ignored and replaced by the number of unique entries in$PBS_NODEFILEand the name of$PBS_NODEFILErespectively. β - arguments to mpdboot options
--file=*and-f <mpd_hosts_file>β replaced by$PBS_NODEFILE. π« -sβ ifpbsrun.intelmpiis called inside a PBS job, Intel MPI'smpirun -sargument tompdbootis not supported, because it closely matches thempirunoption-s <spec>. π The user can simply run a separatempdboot -sbefore callingmpirun. A warning message is issued bypbsrun.intelmpiwhen it hits a-soption, telling users about the supported form. β οΈ-npβ if the user does not specify a-npoption, then no default value is provided by the PBS wrap scripts. It's up to the localmpirunto pick a reasonable default, which is usually1. π
STARTUP/SHUTDOWN πΈ
Intel MPI's mpirun itself takes care of starting/stopping the MPD daemons. π₯ pbsrun.intelmpi always passes the arguments -totalnum=<number of mpds to start> and -file=<mpd_hosts_file> to the actual mpirun, taking its input from the unique entries in $PBS_NODEFILE. β¨
WRAP/UNWRAP
To wrap Intel MPI's mpirun script:
# pbsrun_wrap [INTEL_MPI_BIN_PATH]/mpirun pbsrun.intelmpi
To unwrap Intel MPI's mpirun script:
# pbsrun_unwrap pbsrun.intelmpi
π MVAPICH1's mpirun: pbsrun.mvapich1
SYNTAX
pbsrun.mvapich1 <mpirun options> <executable> <options>
Deprecated π. Only one executable can be specified. This is the PBS wrapper script for MVAPICH1's mpirun.
okay so real talk bestie β if you run this inside a PBS job, it lets PBS clock every single MVAPICH1 rank and keep tabs on their resources, so PBS can do its accounting thing and have full job control. π
and if you run it outside of a PBS job? it just acts exactly like regular mpirun would. no notes, same vibe, same behaviour. β¨
π OPTIONS HANDLING π
when you run this inside a PBS job script, every mpirun option you pass gets handed straight to the real mpirun call β except these chaotic little exceptions:
-map <list>β this one gets flat-out ignored. not today. π-exclude <list>β also ignored, sorry babe. π-machinefile <file>β ignored too, PBS is not taking notes from you on this one.-npβ if you don't specify it, the number of entries in$PBS_NODEFILEgets used instead. ty PBS π
π¦ WRAP/UNWRAP π¦
wanna wrap MVAPICH1's mpirun script? say less:
# pbsrun_wrap <path-to-actual-mpirun> pbsrun.mvapich1
and to unwrap it (undo era, we're healing):
# pbsrun_unwrap pbsrun.mvapich1
π MVAPICH2's mpiexec: pbsrun.mvapich2 π
SYNTAX
pbsrun.mvapich2 <mpiexec args> <executable> <executable's
args> [: <mpiexec args> <executable> <executable's
args>]
so you can specify multiple executables using the colon notation β iconic, honestly. this is the PBS wrapper script for MVAPICH2's mpiexec, which has the same format as the real thing.
if you run it inside a PBS job, PBS gets to see all the MVAPICH2 ranks and track their resources, so it can do accounting and keep complete job control. π₯
if you run it outside of a PBS job, it behaves exactly like the standard mpiexec. same energy. β¨
OPTIONS HANDLING
inside a PBS job script, all your mpiexec options get passed through to the actual mpiexec call, with these two exceptions, bestie:
-host <host>β the contents of the host argument are ignored. we don't know her. π-machinefile <file>β the file argument's contents are ignored and swapped out for the contents of$PBS_NODEFILE. PBS said I'll handle this one. π«Ά
WRAP/UNWRAP
wrapping MVAPICH2's mpiexec script:
# pbsrun_wrap <path-to-actual-mpiexec> pbsrun.mvapich2
unwrapping it:
# pbsrun_unwrap pbsrun.mvapich2
πΈ REQUIREMENTS πΈ
the mpirun you're wrapping has to be installed and working on every single node in the PBS cluster. all of them. no half-slay allowed. π
π ERRORS π
if pbsrun runs into any option that isn't found in options_to_retain, options_to_ignore, or options_to_transform, it gets flagged as an error. periodt. π¨
β SEE ALSO β
pbs_attach(8B)pbsrun_wrap(8B)pbsrun_unwrap(8B)
go read those next, iykyk π§
that's the whole page bestie, you ate that π this one's theLocalflavouredpbsrun(8B)from6 May 2020β mwah, and good luck out there π β¨
π¦ where this page comes from
- nixos 26.05: openpbs 23.06.06-unstable-2026-04-02
- nixpkgs unstable: openpbs 23.06.06-unstable-2026-04-02
- Copyright (C) 1994-2021 Altair Engineering, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms