Comparison Table#
Here is a list of NumPy APIs and corresponding cuNumeric implementations.
A dot in the cunumeric column denotes that cuNumeric implementation is not provided yet. We welcome contributions for these functions.
NumPy vs cuNumeric APIs#
Module-Level#
NumPy |
cunumeric |
single-GPU/CPU |
multi-GPU/CPU |
---|---|---|---|
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
❌ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
|
✓ |
✓ |
|
✓ |
✓ |
||
✓ |
✓ |
||
|
✓ |
✓ |
|
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
|
|||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
Summary
Number of NumPy functions: 288
Number of functions covered by cunumeric: 122
Ufuncs#
NumPy |
cunumeric |
single-GPU/CPU |
multi-GPU/CPU |
---|---|---|---|
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
Summary
Number of NumPy functions: 89
Number of functions covered by cunumeric: 85
Multi-Dimensional Array#
NumPy |
cunumeric |
single-GPU/CPU |
multi-GPU/CPU |
---|---|---|---|
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
❌ |
❌ |
||
❌ |
❌ |
||
✓ |
✓ |
||
✓ |
✓ |
||
❌ |
❌ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
❌ |
❌ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
❌ |
❌ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
❌ |
❌ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
Summary
Number of NumPy functions: 53
Number of functions covered by cunumeric: 46
Linear Algebra#
NumPy |
cunumeric |
single-GPU/CPU |
multi-GPU/CPU |
---|---|---|---|
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
❌ |
||
Summary
Number of NumPy functions: 20
Number of functions covered by cunumeric: 5
Discrete Fourier Transform#
NumPy |
cunumeric |
single-GPU/CPU |
multi-GPU/CPU |
---|---|---|---|
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
||
✓ |
❌ |
Summary
Number of NumPy functions: 18
Number of functions covered by cunumeric: 14
Random Sampling#
NumPy |
cunumeric |
single-GPU/CPU |
multi-GPU/CPU |
---|---|---|---|
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
|
|||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
|
|||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
||
✓ |
✓ |
Summary
Number of NumPy functions: 53
Number of functions covered by cunumeric: 42
Measuring API coverage#
When running applications that use cunumeric, various command line options may be used to generate coverage reports.
Overall coverage report#
The command line flag -cunumeric:report:coverage
may be added to print an
overall percentage of cunumeric coverage:
legate test.py -cunumeric:report:coverage
After execution completes, the percentage of NumPy API calls that were handled by cunumeric is printed:
cuNumeric API coverage: 26/26 (100.0%)
Detailed coverage report#
The command line flag -cunumeric:report:dump-csv
may be added to save a
detailed coverage report:
legate test.py -cunumeric:report:dump-csv out.csv
After execution completes, a CSV file will be saved to the specified location
(in this case out.csv
). The file shows exactly what NumPy API functions
were called, whether the are implemented by cunumeric, and the location of
the call site:
function_name,location,implemented
numpy.array,tests/dot.py:27,True
numpy.ndarray.__init__,tests/dot.py:27,True
numpy.array,tests/dot.py:28,True
numpy.ndarray.__init__,tests/dot.py:28,True
numpy.ndarray.dot,tests/dot.py:31,True
numpy.ndarray.__init__,tests/dot.py:31,True
numpy.allclose,tests/dot.py:33,True
numpy.ndarray.__init__,tests/dot.py:33,True
Call stack reporting#
The command line flag -cunumeric:report:dump-callstack
may be added to
include full call stack information in a CSV report:
legate test.py -cunumeric:report:dump-callstack -cunumeric:report:dump-csv out.csv
After execution completes, the CSV output file have full call stack
information in the location column, with individual stack frames separated
by pipe (|
) characters:
Zero code-change patching#
The lgpatch
script in the same location as the legate
executable) can
help facilitate quick demonstrations of cunumeric
on existing codebases
that make use of numpy
.
To use this tool, invoke it as shown below, with the name of the program to patch:
lgpatch <program> -patch numpy
For example, here is a small test.py
program that imports and uses various
numpy
funtions:
# test.py
import numpy as np
input = np.eye(10, dtype=np.float32)
np.linalg.cholesky(input)
You can invoke lgpatch
to run test.py
using cunumeric
functions
instead, without any changes to the original source code. Any standard
cunumeric
runtime options (e.g. for coverage reporting) may also be added:
$ lgpatch test.py -patch numpy -cunumeric:report:coverage
cuNumeric API coverage: 4/4 (100.0%)