-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(frontend): adding a Game of Life example
closes #457
- Loading branch information
1 parent
6df3b94
commit 7991881
Showing
4 changed files
with
606 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Game of Life | ||
|
||
In the associated [Python file](https://github.com/zama-ai/concrete/blob/main/docs/application-tutorial/game_of_life.py), you can run the Game of Life, written in Concrete Python. | ||
|
||
![ Game of Life](game_of_life.gif) | ||
|
||
### Installation | ||
|
||
You can install as follows: | ||
|
||
- `python3 -m venv .venv` | ||
- `source .venv/bin/activate` | ||
- `pip3 install -U pip wheel setuptools --ignore-installed` | ||
- `pip3 install -r docs/application-tutorial/game_of_life.requirements.txt --ignore-installed` | ||
|
||
Once done, `python docs/application-tutorial/game_of_life.py --help` should give you the manpage: | ||
|
||
``` | ||
Game of Life in Concrete Python. | ||
options: | ||
-h, --help show this help message and exit | ||
--dimension DIMENSION | ||
Dimension of the grid | ||
--refresh_every REFRESH_EVERY | ||
Refresh the grid every X steps | ||
--method {method_3b,method_4b,method_5b,method_basic} | ||
Method for refreshing the grid | ||
--log2_global_p_error LOG2_GLOBAL_P_ERROR | ||
Probability of correctness issue (full circuit) | ||
--log2_p_error LOG2_P_ERROR | ||
Probability of correctness issue (individual TLU) | ||
--simulate Simulate instead of running computations in FHE | ||
--show_mlir Show the MLIR | ||
--stop_after_compilation | ||
Stop after compilation | ||
--text_output Print a text output of the grid | ||
``` | ||
|
||
### Running | ||
|
||
Then, you can play with the different options, and in particular: | ||
|
||
- `dimension`, to chose the size of the grid; the larger, the slower | ||
- `method`, to chose which implementation is used for the grid update | ||
- `log2_global_p_error` and `log2_p_error`, to chose the probability of correctness issue (see the Concrete documentation for more information) | ||
- `simulate`, to do computations only in simulation, i.e., not in FHE | ||
|
||
### Typical Executions | ||
|
||
In simulation: `python3 docs/application-tutorial/game_of_life.py --dimension 100 --refresh_every 50 --simulate` | ||
|
||
In FHE: `python3 docs/application-tutorial/game_of_life.py --dimension 6 --refresh_every 8 --log2_p_error -40 --method method_4b` |
Oops, something went wrong.