Skip to content

Commit 41eacc3

Browse files
authored
Merge pull request #132 from IntelPython/chore/patch-readme
chore: update README for patch method
2 parents 801aa76 + 82b5f38 commit 41eacc3

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,32 @@ The list of supported by `mkl_random.RandomState` constructor `brng` keywords is
6868

6969
---
7070

71+
# Patching Mechanisms
72+
73+
`mkl_random` provides a convenient programmatic patch method to enable MKL-accelerated random operations in NumPy.
74+
75+
## Programmatic Quickstart
76+
77+
```python
78+
import mkl_random
79+
import numpy
80+
81+
mkl_random.patch_numpy_random()
82+
print(mkl_random.is_patched())
83+
# run your accelerated numpy workloads here!
84+
mkl_random.restore_numpy_random()
85+
```
86+
87+
```python
88+
import mkl_random
89+
import numpy
90+
with mkl_random.mkl_random():
91+
# run your accelerated workloads here!
92+
pass
93+
```
94+
95+
---
96+
7197
To build `mkl_random` from sources on Linux:
7298
- install a recent version of MKL, if necessary;
7399
- execute `source /path_to_oneapi/mkl/latest/env/vars.sh`;

0 commit comments

Comments
 (0)