parallel

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.

nutils.parallel.fork(nprocs=None)

Returns a context manager that forks nprocs-1 times when entered.

If nprocs exceeds the configured maxprocs than it will silently be capped. 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 limiting nprocs to 1; all secondary forks will be silently ignored.

If one of nprocs or maxprocs is one, then the returned context manager is a no-op and the context manager tests false.

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

__weakref__

list of weak references to the object

nutils.parallel.ctxrange(name, nitems)

fork and yield shared range-like counter with percentage-style logging