Skip to content

Commit

Permalink
Finalize v0.9 with secure NumPy arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
lschoe committed Feb 26, 2023
1 parent 10f7991 commit 22a437f
Show file tree
Hide file tree
Showing 26 changed files with 2,409 additions and 502 deletions.
52 changes: 25 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,46 @@ fields (using Shamir's threshold scheme as well as pseudorandom secret sharing).
The details of the secure computation protocols are mostly transparent due to the use of sophisticated operator overloading
combined with asynchronous evaluation of the associated protocols.

See the [MPyC homepage](https://www.win.tue.nl/~berry/mpyc/) for more info and background.
## Documentation

Click the "launch binder" badge above to view the entire repository and try out the Jupyter notebooks from the `demos` directory
in the cloud, without any install.
[Read the Docs](https://mpyc.readthedocs.io/) for `Sphinx`-based documentation, including an overview of the `demos`.\
[GitHub Pages](https://lschoe.github.io/mpyc/) for `pydoc`-based documentation.

## Installation:
See `demos` for Python programs and Jupyter notebooks with lots of example code. Click the "launch binder" badge above to view the entire
repository and try out the Jupyter notebooks from the `demos` directory in the cloud, without any install.

Pure Python, no dependencies.
The [MPyC homepage](https://www.win.tue.nl/~berry/mpyc/) has some more info and background.

Run `pip install .` in the root directory (containing file `setup.py`).\
Or, run `pip install -e .`, if you want to edit the MPyC source files.
## Installation

See `demos` for Python programs and Jupyter notebooks with lots of example code.
Pure Python, no dependencies. Python 3.8+ (following [NumPy's deprecation policy](https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table)).

See [Read the Docs](https://mpyc.readthedocs.io/) for `Sphinx`-based documentation, including an overview of the `demos`.\
See [GitHub Pages](https://lschoe.github.io/mpyc/) for `pydoc`-based documentation.
Run `pip install .` in the root directory (containing file `setup.py`).\
Or, run `pip install -e .`, if you want to edit the MPyC source files.

## Notes:
Use `pip install numpy` to enable support for secure NumPy arrays in MPyC, along with vectorized implementations.

1. Python 3.8+ (following NumPy's [deprecation policy](https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table)).
Use `pip install gmpy2` to run MPyC with the package [gmpy2](https://pypi.org/project/gmpy2/) for considerably better performance.

2. Installing package [gmpy2](https://pypi.org/project/gmpy2/) is optional, but will considerably enhance the performance of `mpyc`.
As of December 12, 2021 with the release of gmpy2 2.1, installation has been simplified greatly:
`pip install gmpy2` is now supported on all major Linux/MacOS/Windows platforms via prebuilt wheels.
If you use the [conda](https://docs.conda.io/) package and environment manager, `conda install gmpy2` should do the job.
### Some Tips

3. Use `run-all.sh` or `run-all.bat` in the `demos` directory to have a quick look at all pure Python demos.
- Try `run-all.sh` or `run-all.bat` in the `demos` directory to have a quick look at all pure Python demos.
Demos `bnnmnist.py` and `cnnmnist.py` require [NumPy](https://www.numpy.org/), demo `kmsurvival.py` requires
[pandas](https://pandas.pydata.org/), [Matplotlib](https://matplotlib.org/), and [lifelines](https://pypi.org/project/lifelines/),
and demo `ridgeregression.py` (and therefore demo `multilateration.py`) even require [Scikit-learn](https://scikit-learn.org/).
Also note the example Linux shell scripts and Windows batch files in the `docs` and `tests` directories.
and demo `ridgeregression.py` (and therefore demo `multilateration.py`) even require [Scikit-learn](https://scikit-learn.org/).\
Try `np-run-all.sh` or `np-run-all.bat` in the `demos` directory to run all Python demos employing MPyC's secure arrays.
Major speedups are achieved due to the reduced overhead of secure arrays and vectorized processing throughout the
protocols.

4. Directory `demos\.config` contains configuration info used to run MPyC with multiple parties. Also, Windows batch
file `gen.bat` shows how to generate fresh key material for SSL. To generate SSL key material of your own, first run
`pip install cryptography` (alternatively, run `pip install pyOpenSSL`, which will also install the `cryptography` package).

5. To use the [Jupyter](https://jupyter.org/) notebooks `demos\*.ipynb`, you need to have Jupyter installed,
- To use the [Jupyter](https://jupyter.org/) notebooks `demos\*.ipynb`, you need to have Jupyter installed,
e.g., using `pip install jupyter`. An interesting feature of Jupyter is the support of top-level `await`.
For example, instead of `mpc.run(mpc.start())` you can simply use `await mpc.start()` anywhere in
a notebook cell, even outside a coroutine.

6. For Python, you also get top-level `await` by running `python -m asyncio` to launch a natively async REPL.
a notebook cell, even outside a coroutine.\
For Python, you also get top-level `await` by running `python -m asyncio` to launch a natively async REPL.
By running `python -m mpyc` instead you even get this REPL with the MPyC runtime preloaded!

- Directory `demos\.config` contains configuration info used to run MPyC with multiple parties.
The file `gen.bat` shows how to generate fresh key material for SSL. To generate SSL key material of your own, first run
`pip install cryptography` (alternatively, run `pip install pyOpenSSL`).

Copyright © 2018-2023 Berry Schoenmakers
Loading

0 comments on commit 22a437f

Please sign in to comment.