The parallel module provides tools aimed at parallel computing. At this point all parallel solutions use the fork system call and are supported on limited platforms, notably excluding Windows. On unsupported platforms parallel features will disable and a warning is printed.


continue as nprocs parallel processes by forking nprocs-1 times

It is up to the user to prepare shared memory and/or locks for inter-process communication. As a safety measure nested forks are blocked by setting the global procid variable; all secondary forks will be silently ignored.

nutils.parallel.shempty(shape, dtype=<class 'float'>)

create uninitialized array in shared memory

nutils.parallel.shzeros(shape, dtype=<class 'float'>)

create zero-initialized array in shared memory

class nutils.parallel.range(stop)

Bases: object

a shared range-like iterable that yields every index exactly once


list of weak references to the object (if defined)

nutils.parallel.pariter(items, nprocs)

iterate in parallel

Fork into nprocs subprocesses, then yield items from iterable such that all processes receive a nonoverlapping subset of the total.

NOTE: Pariter is deprecated because a child proces may not be ended if it forcably breaks out of the loop. Instead a fork context should be used in combination with a shared range interator.

  • iterable – The collection of items to be distributed over processors
  • nprocs (int) – Maximum number of processers to use

Items from iterable, distributed over at most nprocs processors.