Pirana
Scope
Pirana is a graphical user interface (GUI) for managing your NONMEM models. It allows you to select models, pass Perl-speaks-NONMEM (PsN
) commands, organize modeling projects, and interface with R
or Xpose
to generate diagnostic plots.
Commonly used features
The most commonly used features of Pirana are shown in the screenshot. In addition to simply running the model, you can select a model from the list and right-click to see a list of commonly used actions (Keizer 2013):
Launching
On Metworx, Pirana can be launched either by (i) clicking the Pirana icon on the desktop, or (ii) opening the start menu in the bottom left corner and beginning to type pirana
:
Example: Execute and generate R plots
Running a model using the execute
command opens another window where you can adjust settings such as the NONMEM version or the number of cores to parallelize across:
After clicking the run button, another window pops up to let you know when the model is complete.
To view the model output, you can either open RStudio from within Pirana, or open it within Visual Studio (VS) Code.
Post-modeling you can run Xpose
commands and generate plots similar to those PsNR
allows for. The Scripts tab on the right shows a list of R scripts you can either open in RStudio, or run silently through the GUI. If you choose the latter, LibreOffice
opens and displays the diagnostic plot you chose:
Example Diagnostic Plot
Note these R plotting scripts can only execute if you captured the parameters required for the plot in your NONMEM model (e.g., in $TABLE
). If you didn't capture the required parameters, you will see an error message like this:
Parallelizing with Pirana
It is relatively straight-forward to run NONMEM in parallel with Pirana. However, there are a few key steps to ensure your model runs uses the appropriate grid resources when running in parallel. Here we illustrate some conceptual examples, and then focus on the necessary Pirana commands.
Submitting a job locally on the head node
When submitting a NONMEM model that runs on your head node via Pirana, by default, it uses only one core.
To run your model in parallel on the head node you need to pass a parafile. However, on Metworx you can select auto-MPI and have Pirana generate a parafile for you.
This auto-MPI functionality is only available on Metworx 20.12 and later blueprints. If using an older version of Metworx, you need to manually specify a .pnm
file. See Nonmem via PsN for an example.
Submitting a job to the SGE grid
To submit this NONMEM model to run on a worker node on the Sun Grid Engine (SGE). Select SGE as the job scheduler.
If you have a single NONMEM model requiring many cores, submitting to the grid is a good idea, because it auto-scales resources. Auto-scaling means a worker node launches automatically when needed to run a job, and turns itself off when the job is finished, so that you only pay for actual compute time. Use a small (2 vCPU) head node. Configure your worker nodes to be large, but do not launch any workers.
Notice:
- Initial size is set to 0, so that no worker nodes are launched until a job is submitted.
- Maintain initial size is not checked, so all worker nodes can turn off when their work is finished.
Submit your job to the grid. A worker node launches automatically and runs your job.
Important sidenote: remove -nmqual
Unfortunately, when using the SGE on Metworx 20.12 and later, Pirana adds the -nmqual
flag to the PsN command by default. This is incompatible with the default NONMEM version (7.5). To run you model on SGE, either delete -nmqual
in the command at the bottom, or select a version of NONMEM with _gf
at the end.
Bootstrapping on the grid
Bootstrapping is a good example of when you need to run a large number of models simultaneously. It's unlikely you'll want to parallelize the individual models. However, you should submit these models to the SGE grid to take advantage of auto-scaling (and its associated cost savings).
For a Pirana (or PsN) bootstrap, -samples
controls the number of replicates run, and -threads
controls how many to run simultaneously. When submitting to the SGE on Metworx these should be identical. You need to manually change these in the PsN command line at the bottom of the Pirana bootstrap dialogue screen.
The head node submits the jobs to the SGE queue, which distributes them to available worker nodes. It puts any extra models in the queue to wait for more worker nodes.
Having jobs in a queue prompts more worker nodes to launch. As they become available they begin running jobs in the queue. When the queue is empty no more workers are launched, and each worker turns off when its jobs are complete.