When One Python Process Fails, You Need to See All of Them

When One Python Process Fails, You Need to See All of Them

BackerLeader ●68 ●392 ●579
calendar_today • schedule6 min read

Python has become the front door to a lot of high-performance computing. Researchers write the simulation logic in Python, hand the heavy math to C or C++ libraries, and launch the job across hundreds or thousands of processes with mpi4py. AI training on supercomputers follows a similar pattern.

The debugging habits haven't followed. Most Python developers learned on pdb, debugpy, or an IDE like PyCharm. Those tools are built to follow one process. Put the same code on a cluster, and the bug you're chasing may live in a process you never attached to.

Perforce announced general availability of Parallel Python Debugging in TotalView on Nov. 17 at SC26. TotalView has been a fixture in HPC for C, C++, and Fortran for years. The new capability brings Python processes into the same workflow. I asked Bill Burns, Perforce's VP of Software Engineering, what that means in practice. His answers were direct about what works today and what doesn't yet.

Why single-process tools fall short

Burns says the first thing to break is the developer's view of the job.

"If you're using pdb or debugpy to inspect one process and a different rank is producing bad data, you may never see it," he said. "Even if you attach to the right rank, the value you're looking at might seem reasonable. Sometimes you only recognize the error when you compare that value with what the other ranks produced."

Print statements hold up on a small run. Burns notes you can even hand the logs to an AI tool to analyze. But at scale, the logging becomes its own problem. "At thousands of processes, though, all those processes are writing output across different nodes. You can flood the file system and I/O channels before you've even started trying to piece together what happened."

A parallel debugger adds control across the whole job. When a breakpoint hits, you decide whether to stop every process, one process, or a single thread. Stepping works the same way. You can move the whole group forward a line or follow one thread. The wider view matters for data, too. Each process might handle its own chunk correctly. The bug only shows up when you see how the chunks fit together.

What's supported today

Perforce started with mpi4py and Python's multiprocessing package. Burns says a customer survey showed mpi4py was the most common way teams run Python in parallel. Each process runs its own interpreter, so the work stays parallel even with the GIL enabled. Multiprocessing is more often used to spread work across cores on a single machine.

PyTorch distributed training and Dask aren't supported yet. Burns says the multiprocessing work lays a foundation for torchrun and Dask. Customers have asked for both, and he hopes to add them next year.

Python debugging starts at version 3.11. Formal testing of Python 3.14 is part of the next release, including 3.14 with the GIL disabled. That free-threaded build is worth watching. Once Python threads run concurrently, debugging them gets harder, and Burns says the goal is to make sure TotalView can handle those threads.

On environments, pyenv works, and Perforce uses uv in its demos. TotalView generally inherits the environment that uv or Conda sets up. For now, Perforce recommends launching parallel jobs under TotalView from the command line. Launching from the UI is planned for releases in early 2027.

The language boundary is the hard part

Most serious HPC and AI Python code isn't pure Python. It calls C or C++ modules that do the real work. TotalView has supported mixed-language debugging for Python and C or C++ for about eight years, Burns says. That work came out of Department of Energy labs whose developers wanted to know which Python calls led to a problem in their C++ code.

Hit a breakpoint in a C++ module, and TotalView builds a unified call stack that shows the Python and C++ frames together. It hides intermediate frames from tools like SWIG so you can follow the calls you actually wrote.

There's a gap, though, and Burns was upfront about it. In that mixed-language mode, you can inspect Python frames, but you can't set a Python breakpoint or step through Python code. The new Python debugging does both. The two capabilities aren't yet combined in one session.

He explained why that's tricky. "Python debugging needs the interpreter to keep running. You're interacting with it as it processes Python instructions. To inspect native C or C++ code at a breakpoint, the debugger halts the process. At that point, the Python interpreter is stopped, too."

GPU work sits in the same place. TotalView can already follow a native application from the CPU into a CUDA kernel. The goal is to start in Python and follow the work all the way into that kernel. That depends on merging the two debugging modes first. Burns says Numba hasn't been tested yet.

Where the compute hours go

Debugging on a supercomputer isn't free. Stopping a job to examine its state still burns allocation time, and Burns notes some labs restrict interactive debugging for that reason.

TotalView's answer is unattended debugging. The application runs under the debugger in a headless mode. The developer specifies what to collect. If the job fails, TotalView records the failure information and core files, and the developer reviews them afterward without holding the allocation open.

Queue waits are another drag. With a feature called Reverse Connect, a developer starts TotalView on the cluster's head node and leaves it listening. When the Slurm or PBS job finally starts, it connects back, and debugging begins. For containers, Perforce has worked with HPE on a setup using Podman, Pyxis, and Slurm, where TotalView attaches to processes running inside containers across the cluster.

Burns also flagged a Python startup problem that's easy to miss. When thousands of processes import modules from a shared file system at the same time, the I/O traffic can slow the launch considerably. One fix is to stage libraries and files on each node so every process reads a local copy. NERSC covers the issue in its documentation.

An honest read on the competition

I asked how TotalView compares with Linaro DDT. Burns called DDT the closest competitor in parallel debugging and said there's considerable overlap. Then he said something vendors rarely say.

"For a single Python process, I think PyCharm offers a better experience," he said. "When you need to control and inspect a parallel job as a whole, that's where I'd look at TotalView or DDT."

He points to reverse debugging as a TotalView advantage. It lets developers trace execution backward, which helps with bugs that are hard to reproduce. It's available for native code today. Perforce is researching it for Python.

Advice for teams moving from C++ to Python

Burns' advice for developers porting an MPI workload starts before any debugging. "Python makes it relatively easy to write code and start multiple processes. The harder part is deciding how to split the dataset, what each process should do, and how you'll know the pieces fit back together correctly."

He flagged two more things. First, understand processes versus threads. Separate Python processes give you parallelism even with the GIL. Threads running Python code are harder. If you mix the two, test that combination carefully. Second, know which Python calls lead into native libraries. Those libraries are often optimized and built without debug symbols, so a bad result can be hard to trace.

On AI coding assistants, Burns says he hasn't seen enough to know whether they're changing the bugs in parallel Python. But the discipline doesn't change. "If you're not careful, you can end up with what people call 'AI slop.' You still have to test the code."

What comes next

The roadmap is focused on machine learning. PyTorch and torchrun are first, then Dask. Burns also wants to bring a feature called View Across to Python. In C++, you select a variable and see its value across every process. If one rank produced an odd value, it stands out. That's exactly the comparison single-process tools can't make.

He described the national lab applications as "tool breakers," with large codebases, large datasets, and jobs running across a huge number of nodes. That's a useful frame for this release. Python made it easy to launch a lot of processes. The tools to see what those processes are doing are still catching up. TotalView now covers mpi4py and multiprocessing. Stepping from Python into C++, GPU visibility from Python, and PyTorch support are still ahead.

If your team runs parallel Python on mpi4py and already uses TotalView for C++, this is worth an evaluation now. If you're on torchrun, watch the 2027 releases. Perforce is hosting a technical webinar with Burns and Jasmit Singh, senior manager of software engineering, on Dec. 2: Parallel Python Debugging in HPC: Challenges, Approaches, and Real-World Lessons.

Want more #python & #python deep dives?

Join 6,181+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

Dashboard Operasional Armada Rental Mobil dengan Python + FastAPI

Masbadar - Mar 12

Stop trusting verdicts your policy no longer supports

VEACESLAV - Dec 1

Stop invoking the whole graph to test one node: unit tests and checkpoints for my LangGraph agent

VEACESLAV - Nov 10

What Security Teams Want From AI Agents Before They Let Them Act Alone

Tom Smithverified - Nov 18

3.5 best practices on how to prevent debugging

Codeac.io - Dec 18, 2025
chevron_left
21.8k Points • 1k Badges
304Posts
177Comments
155Connections
LLM Training & Evaluation Specialist with hands-on experience building major AI models. As one of th... Show more

Related Jobs

View all jobs →

Commenters (This Week)

16 comments
5 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!