"Black Box" Amdahl's Law Simulator
This Python module contains a pseudo-application that can be used as a black box to reproduce Amdahl's Law. It does not do real calculations, nor any real communication, so can easily be overloaded.
The application is installed as a Python module with a shell script wrapper. The only requirements are a Message Passing Interface (MPI) library and the MPI for Python module, mpi4py.
Background
Amdahl's Law posits that some unit of work comprises a proportion $p$ that benefits from parallel resources, and a proportion $s$ that is constrained to execute in serial. The theoretical maximum speedup achievable for such a workload is
$$ S = \frac{1}{s + p/N} $$
where $S$ is the speedup relative to performing all of the work in serial and $N$ is the number of parallel workers. A plot of $S$ vs. $N$ ought to look like this, for $p = 0.89$ (since $s = 1 - p = 0.11$):
5┬────────┼────────┼────────┼────────·────────┼────────┼────────┼────────┼────────*
│ · │
│ · * │
│ · │
│ · * │
│ · │
│ · │
│ · * │
│ · │
4┼ · ┼
│ · * │
│ · │
│ · │
│ · │
│ · * │
S │ · │
p │ · │
e │ · │
e 3┼ · * ┼
d │ · │
u │ · │
p │ · │
│ · │
│ · * |
│ · │
│ · │
│ · │
2┼ · ┼
│ · │
│ · * │
│ · │
│ · │
│ · │
│ · │
│ · │
│· │
1*────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
1 2 3 4 5 6 7 8 9 10
Workers
"Ideal scaling" ($p = 1$) is represented by the dotted line, $S = N$.
This graph shows there is a speed limit for every workload, and diminishing returns on throwing more parallel processors at a problem. It is worth running a "scaling study" to assess how far away that speed limit might be for the given task.
Setup
An external requirement is a Message Passing Interface (MPI) library, such as OpenMPI or MPICH. To check whether you have one installed, run
which mpirun
If the command returns a filesystem path, e.g. /usr/bin/mpirun, you're all
set! If not, contact an administrator or use your operating system's package
manager to install both the binaries and the development headers for either
OpenMPI or MPICH.
Once an MPI library is installed, you should be able to install the amdahl package and its dependencies using pip:
python3 -m pip install --user amdahl
Usage
Once installed, you can run the program using
mpirun -np 2 amdahl
You should see something like the following output:
Doing 30 seconds of 'work' on 2 processors, which should take 18 seconds
with 0.8 parallel proportion of the workload.
Hello, World! I am process 0 of 2. I will do all the serial 'work' for 6 seconds.
Hello, World! I am process 0 of 2. I will do parallel 'work' for 10 seconds.
Hello, World! I am process 1 of 2. I will do parallel 'work' for 14 seconds.
Total execution time (according to rank 0): 16 seconds
Metadata
Release files for amdahl 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| amdahl-0.4.1.tar.gz | 6.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| amdahl-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / amdahl-0.4.1.tar.gz
| Download URL | amdahl-0.4.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3c2a2119beee6096f954b0285b336b6c2b19ae2a24f8bbbe07d2a0805e4c825
|
|
BLAKE2b-256 checksum How to use checksums |
535d82f5a1fd67c17503d888beab3d0eba1b34ea2b92020edee01701cac75ee7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logRelease files / amdahl-0.4.1-py3-none-any.whl
| Download URL | amdahl-0.4.1-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e5425034544a20f14a824205adf5202c4e6e3d44643dc1726655566c737086d
|
|
BLAKE2b-256 checksum How to use checksums |
aa92e77bcd3e0a1d3d5dfc82a61aea9b07377e708ddc19ae961d6b2fb2685e0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logSecurity for amdahl 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for amdahl-0.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.