Compute resources

nextPYP can be run on either a Desktop workstation or a Compute cluster. A Desktop workstation is simpler to setup and can be used to process small to medium sized datasets. For most datasets, however, a compute cluster will enable significantly faster processing.

nextPYP autmatically detects what resources are installed locally in the server (number of CPU cores and GPU cards) and allocates jobs accordingly. No additional configuration is needed.

In this mode, resources are managed by the SLURM scheduler. Commonly managed resources include CPU threads, RAM, GPUs, and local scratch space.

Resource management

The execution of most blocks in nextPYP involves three main phases:

  • Launch: Typically a lightweigth job used to initiate data processing.

  • Split: Multiple jobs that are executed in parallel (typically one job for each micrograph/tilt-series).

  • Merge: A job that consolidates the results from the Split phase (such as combining intermediate data to generate a single 3D reconstruction).

Because each phase has distinct computational requirements, resources (i.e., number of threads, memory, etc.) are specified independently for each phase.

Tip

Real time information about jobs is available in the Jobs/Run panel.

Resource allocation

Each processing block in nextPYP includes a Resources tab where resources for each phase can be allocated.

Job submission options

The Resources tab is divided into three sections, one for each phase. Cluster submission settings (threads, memory, walltime, Gres) are listed by phase below.

Launch task
Launch, Threads

Number of threads used when launching jobs.

Default: 1

Launch, Memory per thread (GB)

Amount of memory per thread requested when launching jobs.

Default: 4

Launch, Walltime (dd-hh:mm:ss)

Set a limit on the total run time when launching jobs. When the time limit is reached, SLURM will terminate the job.

Default: 1-00:00:00

Split, Gres

List of Generic resources (Gres) to request for the split job. This option can be used to request specific resources available in your SLURM instance, for example, lscratch:500,shrd=64`, which requests 500 GB of local scratch space and 64 GB of shared memory. The lscratch resource is typically used for temporary storage, while the shrd resource is used for shared memory. To check the available resources in your SLURM instance, run the command: sinfo -o "%100N  %30G". If you are unsure about this, please contact your system administrator.

Default: None

Split task
Split, Threads

Number of threads used to process a micrograph or tilt-series.

Default: 1

Split, Total threads

Maximum number of threads to run simultaneously. Setting it to 0 removes any limits, deferring entirely to SLURM’s limits. This option can help manage how resources are distributed between multiple nextPYP jobs. For example, if the number of threads is set to 7 and the total number of threads is set to 21, then 3 jobs will be run simultaneously, each using 7 threads. If the total number of threads is set to 0, then SLURM will determine how many jobs to run simultaneously based on the available resources and any account quotas.

Default: 0

Split, Memory per thread (GB)

Amount of memory per thread requested for each split task.

Default: 4

Split, Walltime (dd-hh:mm:ss)

Set a limit on the total run time for each split task. When the time limit is reached, SLURM will terminate the job.

Default: 1-00:00:00

Split, Bundle size

Number of tasks to group into a bundle. Tasks within a bundle are processed one after the other, sequentially. For example, if there are 100 tasks and the bundle size is set to 10, then 10 jobs with 10 tasks each will be processed in parallel. This option can help manage how resources are distributed and potentially reduce storage utilization.

Default: 1

Split, Gres

List of Generic resources (Gres) to request for the split job.

Default: None

Merge task
Merge, Threads

Number of threads used to run the merge task.

Default: 1

Merge, Memory per thread (GB)

Amount of memory per thread used to run the merge task.

Default: 4

Merge, Walltime (dd-hh:mm:ss)

Set a limit on the total run time for the merge task. When the time limit is reached, SLURM will terminate the job.

Default: 1-00:00:00

Split, Gres

List of Generic resources (Gres) to request for the merge task.

Default: None

Warning

Users are responsible for ensuring that the requested combination of resources is available in the HPC environment where nextPYP is running. If the requested resource combination is unavailable, the job will be left in a PENDING state, potentially indefinitely. To fix this, users can cancel the job and resubmit it with a different combination of resources.

Tip

To check the status of a job, go to the Jobs tab, click on the icon next to the job, and select the Launch tab.

Limits on shared sites

An administrator can limit how many threads and GPUs each job uses, in the [web] section of config.toml. Users with the Admin permission are not limited.

The limits can also be set on the Setup tab of the administration page, under Resource limits. Leave a number empty for no limit. The values are saved for review rather than applied straight away: run nextpyp config apply, then nextpyp restart.

[web]
maxProjectsPerUser = 1        # one project per user
allowParallelJobRuns = false  # one block at a time in that project
maxCpusPerJob = 64            # threads one job may hold at once
maxGpusPerJob = 2             # GPUs one job may hold at once
maxCpusPerGpu = 12            # threads a GPU job may ask for, per GPU
maxMemoryGiBPerCpu = 8        # memory a job may ask for, in GB per thread

With these limits:

  • A job that asks for more than the limits on its own is refused, and the job’s log names the limit. For example: This job asks for 16 threads, but this site allows 8 per job. The thread fields in the Resources tab stop at maxCpusPerJob.

  • A Split job runs only as many tasks at once as fit within maxCpusPerJob and maxGpusPerJob. Split, Total threads can still set a lower limit.

  • A job that uses GPUs may ask for at most maxCpusPerGpu threads for each GPU, so it cannot book all the cores of a server with several cards.

  • A job may ask for at most maxMemoryGiBPerCpu GB of memory for each thread. The memory-per-thread fields in the Resources tab stop at this value, and 0 (all the memory of a node) is refused.

Together with one project per user and one block at a time, these act as a limit per user. Each key is optional and is described in maxCpusPerJob and the entries after it.

Logging

Every message pyp writes carries a level saying how important it is: INFO for ordinary progress, DEBUG for diagnostic detail, and TRACE for exhaustive internal detail. The levels are a scale rather than independent choices, so asking for DEBUG also gives you INFO, and TRACE gives you everything — a diagnostic message rarely means much without the progress messages around it. Errors and warnings are always shown, whatever level they were logged at.

What differs between the website and the command line is when you choose: the website records everything and lets you filter while reading, whereas the command line has to be told in advance.

Jobs launched from the website always record every level, so there is nothing to decide before a run. The Logging level parameter no longer applies and is hidden in the Resources tab.

Choose how much to see when you read the log instead. Every log panel has a control that shows or hides the DEBUG and TRACE records already in it:

  • Info — standard progress and status messages (default)

  • Debug — extra diagnostic detail useful when debugging a run

  • Trace — the most verbose output; typically only for deep troubleshooting

Switching level takes effect immediately and can be done as often as you like, including while the job is still running, so asking for more detail never means running anything again. Your choice is remembered for the next log you open.

Only the levels a log actually contains are offered. Logs written by earlier versions of nextPYP recorded less — often nothing below INFO — so for those the control offers fewer levels, or does not appear at all.

Tip

See the Jobs/Run panel for how to open logs.

There is no log viewer on the command line, so pyp writes only the messages at or above the level it was given, and asking for more detail afterwards means running the job again.

Set the level with -slurm_verbose_level:

pyp -slurm_verbose_level debug
  • info — standard progress and status messages (default)

  • debug — extra diagnostic detail useful when debugging a run

  • trace — the most verbose output; typically only for deep troubleshooting

The value is saved with the rest of the project parameters, so it applies to subsequent runs in the same directory until you change it.

Note

The older -slurm_verbose flag is still accepted, and is equivalent to -slurm_verbose_level debug. Higher levels produce larger log files.

GPU resources

Although the core functionality of nextPYP operates exclusively on CPUs, certain operations do require GPU access. In most cases, users cannot choose between running jobs on CPUs or GPUs, this is determined by the specific requirements of each job. Only a few exceptions exist, and in those cases, a checkbox will be available to enable or disable GPU usage.

List of programs and operations that require GPUs:

  • Particle picking: Neural network-based article picking (training and inference)

  • MiLoPYP: Cellular pattern mining and localization (training and inference)

  • MotionCor3: Motion correction of micrographs or tilt movies

  • AreTomo2: Tilt-series alignment and tomographic reconstruction

  • Membrain-seg: Tomogram segmentation using pre-trained neural networks

  • Topaz: Tomogram denoising using pre-trained neural networks

  • IsoNet: Tomogram denoising using neural networks (training and inference)

  • CryoCARE: Tomogram denoising using neural networks (training and inference)

  • Pytom-match-pick: Particle picking using template matching

  • tomoDRGN: Heterogeneity analysis using neural networks (training and inference)

Jobs that use any of the above programs will run using 1 GPU by default. You don’t need to set any additional parameters to enable GPUs for these jobs.

Jobs that use any of the above programs will be submitted to the SLURM scheduler using the --gres=gpu:1 option. This means that one GPU will be requested for each job.

To run a job on a specific GPU resource, users can set the Split, Gres parameter in the Resources tab of a block. For example, to use an H100 card, set Split, Gres to gpu:H100:1.

Note

For this to work, your SLURM instance must have a generic resource (Gres) named H100 defined. To check the available resources in your SLURM instance, run the command: sinfo -o "%100N  %30G". If you are unsure about this, please contact your system administrator.

Multiple GPUs

Some of the programs listed above (e.g., IsoNet) support multi-GPU execution. To allocate more than one GPU for a job, set the Split, Gres option to gpu:n where n is the number of GPUs you want to request, for example, gpu:2.

Troubleshooting GPU issues

How many GPUs are available to nextPYP in my workstation computer?

nextPYP detects NVIDIA GPUs and AMD GPUs. Intel GPUs are not detected. MotionCor3, AreTomo2, AreTomo3, the CUDA Relion build, and the CUDA PyTorch steps remain NVIDIA-only. On an AMD-only machine those programs stop with is a CUDA build and cannot run on an AMD GPU.

To see how many GPUs were detected by nextPYP, head to the administration page in your web browser and navigate to the “Standalone Jobs” tab. At the top of that tab is a “Resources” section that shows the total number of GPUs detected, as well as how many are currently being used, or available for use.

Alternatively, nextPYP prints GPU diagnostic information to the website log file during startup. Find the <local>/logs/micromon log file in your filesystem, where <local> is the web.localDir path defined in your config.toml file. A link to the config.toml file can be found in your installation folder.

During startup, nextPYP will print the number of automatically-detected GPUs to the log file. Look for a section like this:

[standalone]
     available cpus:  2
   available memory:  6 GiB
     available gpus:  1

You can find the number of GPUs that were detected in the available gpus line in the log.

Launched GPU jobs get stuck waiting for resources on my workstation computer

Does your GPU-enabled job get stuck waiting to start with the following reason:

The job is waiting for more resources to become available

but you know no other jobs are using your GPUs? It’s possible nextPYP failed to detect your GPUs correctly.

nextPYP detects NVIDIA and AMD GPUs and makes them available for jobs. Detection can still fail, for example when an NVIDIA driver is newer than the libraries used to count CUDA devices. Intel GPUs are not detected. MotionCor3, AreTomo, Relion’s CUDA build, and the CUDA PyTorch steps stay NVIDIA-only even when the AMD device is visible.

First, see how many GPUs nextPYP was able to detect. nextpyp doctor does this check for you on a standalone install: when this machine has a GPU but the website counted none, it prints PROBLEM: This machine has a GPU, but the website counted 0 GPUs along with the fix. When the count is not zero it prints standalone GPUs: N.

If you know your machine has NVidia GPUs, but nextPYP only detected zero GPUs, then the GPUs could not automatically be detected by our software.

The first thing to check is whether the website container was started with the GPU libraries at all. nextpyp start passes Apptainer’s --nv flag when it finds nvidia-smi on PATH, /dev/nvidia0, or /proc/driver/nvidia. It passes --rocm when it finds rocm-smi on PATH, /dev/kfd, or an AMD /dev/dri/renderD* node (sysfs vendor 0x1002). The installer records PYP_NV=true or PYP_ROCM=true in install.env when it finds that GPU, so the flag does not depend on what the service sees at boot. A machine with both records both. An AMD cluster login node often has no /dev/kfd; set PYP_ROCM=true there the same way. If none of that happened on your machine, add the line yourself and restart:

echo 'PYP_NV=true' | sudo tee -a /opt/nextpyp/install.env   # your installation folder
sudo nextpyp restart

For an AMD GPU, use PYP_ROCM=true instead. PYP_NV=false and PYP_ROCM=false turn each flag off. The service reads install.env through systemd; for a manual nextpyp start or nextpyp doctor --smoke from your shell, set it in the environment: PYP_NV=true nextpyp doctor --smoke. nextpyp doctor --smoke checks an AMD GPU by running the container with --rocm and looking for /dev/kfd. When that device is missing it prints PROBLEM: The compute container did not see the AMD GPU

If the count is still zero after that, the CUDA libraries are present but detection itself failed.

To see what went wrong with automatic detection, you can look for errors in the website log file. Find the <local>/logs/micromon log file in your filesystem, where <local> is the web.localDir path defined in your config.toml file. A link to the config.toml file can be found in your installation folder.

Try searching for a line in the log file like this one:

Failed to count CUDA GPUs, assuming no GPUs

If you find that line in your log, it means nextPYP definitely failed to automatically detect your GPUs. There should also be a more detailed error message directly after this line in the log. Feel free to send us the detailed error message so we can tell what went wrong and hopefully fix the issue in a newer release of nextPYP.

The most common reason for detection failure at this step is your computer may have a newer NVidia driver that breaks compatibility with the older NVidia runtime libraries used by our detection software.

Even though automatic detection failed, you can still configure your number of GPUs manually by editing the config.toml file. Under the [standalone] section, add a line that looks like this:

availableGpus = 4

If the comfig.toml file doesn’t yet have a [standalone] section, add a new one to the bottom of the file. If the number of NVidia GPUs you have is 4, then you’re all set. Otherwise, change the 4 to the number of NVidia GPUs you have.

When you’re done, the bottom of your config.toml file should look something like this:

[standalone]
availableGpus = 4

After making changes to your config.toml file, restart nextPYP to apply the changes. nextpyp restart checks the configuration first and leaves the website running if the check fails.

nextpyp restart

Then, check the total number of GPUs available to nextPYP again. If you see more tham one GPU there, then the next time you run a GPU-enabled job, it shouldn’t get stuck waiting for resources anymore.