Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc edits: Statistics and Progressbar #1017

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions docs/compilation/statistics.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Statistics
This document provides an overview of how to analyze compiled circuits and extract statistical data for performance evaluation in **Concrete**. These statistics help identify bottlenecks and compare circuits.

Concrete analyzes all compiled circuits and calculates some statistics. These statistics can be used to find bottlenecks and compare circuits. Statistics are calculated in terms of basic operations. There are 6 basic operations in Concrete:
## Basic operations
Concrete calculates statistics based on the following six basic operations:

* **clear addition:** x + y where x is encrypted and y is clear
* **encrypted addition:** x + y where both x and y are encrypted
* **clear multiplication:** x \* y where x is encrypted and y is clear
* **encrypted negation:** -x where x is encrypted
* **key switch:** building block for table lookups
* **packing key switch:** building block for table lookups
* **programmable bootstrapping:** building block for table lookups
* **Clear addition:** `x + y` where `x` is encrypted and `y` is clear
* **Encrypted addition:** `x + y` where both `x` and `y` are encrypted
* **Clear multiplication:** `x * y` where `x` is encrypted and `y` is clear
* **Encrypted negation:** `-x` where `x` is encrypted
* **Key switch:** A building block for table lookups
* **Packing key switch:** A building block for table lookups
* **Programmable bootstrapping:** A building block for table lookups

## Displaying statistics
You can print all statistics using the `show_statistics` configuration option:

```python
Expand Down Expand Up @@ -67,9 +70,9 @@ Each of these properties can be directly accessed on the circuit (e.g., `circuit

## Tags

Circuit analysis also considers [tags](../core-features/tagging.md)!
You can also use tags to analyze specific sections of your circuit. See more detailed explanation in [tags documentation](../core-features/tagging.md).

Imagine you have a neural network with 10 layers, each of them tagged. You can easily see the number of additions and multiplications required for matrix multiplications per layer:
Imagine you have a neural network with 10 layers, each of them tagged, you can easily see the number of additions and multiplications required for matrix multiplications per layer:

```
Statistics
Expand Down
9 changes: 5 additions & 4 deletions docs/execution-analysis/progressbar.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Progressbar
This document introduces the progressbar feature that provides visual feedback on the execution progress of large circuits, which can take considerable time to execute.

Big circuits can take a long time to execute, and waiting for execution to finish without having any indication of its progress can be frustrating. For this reason, progressbar feature is introduced:
The following Python code demonstrates how to enable and use the progressbar:

```python
import time
Expand Down Expand Up @@ -88,14 +89,14 @@ axs[1].axis("off")
plt.show()
```

When you run this code, you will see a progressbar like:
When you run this code, you will see a progressbar like this one:
```
Evaluation: 10% |█████.............................................| 10% (scaling.r)
^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^
Title Progressbar Tag
```

And as the circuit progresses, this progressbar would fill:
As the execution proceeds, the progress bar updates:
```
Evaluation: 30% |███████████████...................................| 30% (scaling.g)
```
Expand All @@ -104,7 +105,7 @@ Evaluation: 50% |████████████████████
```

{% hint style="info" %}
It is not a uniform progressbar. For example, when the progressbar shows 50%, this does not mean that half of the execution is performed in terms of seconds. Instead, it means that half of the nodes in the graph have been calculated. Since different node types can take a different amount of time, this should not be used to get an ETA.
The progress bar does not measure time. When it shows 50%, it indicates that half of the nodes in the computation graph have been processed, not that half of the time has elapsed. The duration of processing different node types may vary, so the progress bar should not be used to estimate the remaining time.
{% endhint %}

Once the progressbar fills and execution completes, you will see the following figure:
Expand Down
Loading