risc0 / zeth

A "Type 0" zkEVM. Prove validity of Ethereum blocks using RISC Zero's zkVM
Apache License 2.0
381 stars 68 forks source link

How to speed up zeth compilation efficiency? #116

Open RuiQi857 opened 2 weeks ago

RuiQi857 commented 2 weeks ago

We are running cargo build -F cuda --release on Ubuntu 22.04.4 LTS. This command takes too long, more than 30 minutes. especially on the last few risc0 related packages.

Do you have any good suggestions to optimize the efficiency of the entire compilation? Express my gratitude in advance~

Our environmental information is as follows:

Ubuntu 22.04.4 LTS

Architecture:             x86_64
  CPU op-mode(s):         32-bit, 64-bit
  Address sizes:          46 bits physical, 48 bits virtual
  Byte Order:             Little Endian
CPU(s):                   8
  On-line CPU(s) list:    0-7
Vendor ID:                GenuineIntel
  Model name:             Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
    CPU family:           6
    Model:                85
    Thread(s) per core:   2
    Core(s) per socket:   4
    Socket(s):            1
    Stepping:             4
    BogoMIPS:             5000.00

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.90.07              Driver Version: 550.90.07      CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  Tesla T4                       On  |   00000000:00:07.0 Off |                    0 |
| N/A   29C    P8              9W /   70W |       1MiB /  15360MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+
linear[bot] commented 2 weeks ago

ZETH-28 How to speed up zeth compilation efficiency?

flaub commented 2 weeks ago

The first time doing a compilation for CUDA is expected to take a long time. It varies based on the GPU architecture and even version of the GPU drivers. I install and use sccache which makes subsequent builds go much faster.

RuiQi857 commented 2 weeks ago

Thank you for your guidance! After using sccache, my compilation time was reduced to about 11mins.

image

But I want to further shorten the time, because after we develop locally, we need to push it to the remote server for debugging, and the long compilation time is unacceptable to us; For example, we often only modify the code under guests folder. Under this condition, is there any way to speed up compilation?