Parallel Execution

About Parallel Execution

Building large networks is a computationally intensive and time-consuming operation. Like BMTK, bionetlite supports parallel execution.

Basic Usage

Parallel execution is automatically performed by running network construction code that imports bionetlite with commands like mpirun.

# Run in parallel with 4 processes
mpirun -n 4 python build_network.py
# Run in parallel with 16 processes
mpirun -n 16 python build_network.py

No Code Changes Required

No special code changes are needed for parallel execution. Like bionet, simply run with mpirun:

# build_network.py
from bionetlite import NeuliteBuilder as NetworkBuilder

# Normal code
net = NetworkBuilder('v1')
net.add_nodes(...)
net.add_edges(...)
net.build()
net.save_nodes(output_dir='network')
net.save_edges(output_dir='network')

Run this file with mpirun:

mpirun -n 8 python build_network.py

How Parallel Execution Works

bionetlite uses bionet’s parallel execution mechanism as is:

  1. Each MPI process handles part of the network

  2. Generation of nodes and edges is distributed

  3. Results are finally integrated and output to files

Next Steps