Trying Numpy code without changes#

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 Measure API coverage) may also be used:

$ CUNUMERIC_REPORT_COVERAGE=1 LEGATE_CONFIG="--cpus 4"  lgpatch test.py -patch numpy
cuNumeric API coverage: 4/4 (100.0%)