Skip to content

Commit

Permalink
update colab
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonHibnik committed Nov 7, 2024
1 parent 8b3492c commit 9bf3108
Showing 1 changed file with 42 additions and 18 deletions.
60 changes: 42 additions & 18 deletions docs/docs/icicle/colab-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,48 @@ Now we are ready to clone ICICE repository,
!git clone https://github.com/ingonyama-zk/icicle.git
```

We now can browse the repository and run tests to check the runtime environment:
We can browse the repository and run tests to check the runtime environment:

```sh
!ls -la
%cd icicle
%cd /content/icicle
```

## Download CUDA backend

First let's create a backend directory

```sh
%cd /content
!rm -rf cuda_backend/
!mkdir cuda_backend
%cd cuda_backend
```

Download and extract a backend from [ICICLE released](https://github.com/ingonyama-zk/icicle/releases) backends
In this example we are using [ICICLE Cuda backend v3.1.0](https://github.com/ingonyama-zk/icicle/releases/download/v3.1.0/icicle_3_1_0-ubuntu22-cuda122.tar.gz)

```sh
!curl -O -L https://github.com/ingonyama-zk/icicle/releases/download/v3.1.0/icicle_3_1_0-ubuntu22-cuda122.tar.gz
!tar -xvf icicle_3_1_0-ubuntu22-cuda122.tar.gz
```

## Setting CUDA backend installation directory
Point colab to the extracted cuda backend using an [environment variable](https://github.com/ingonyama-zk/icicle/blob/f638e9d3056d2a5d6271a67ba4f63973a2ba2c1a/docs/docs/icicle/getting_started.md#backend-loading)

```sh
import os
os.envvar["ICICLE_BACKEND_INSTALL_DIR"] = "/content/cuda_backend/icicle"
```

## Fun with ICICLE

Let's run a test!
Navigate to icicle/wrappers/rust/icicle-curves/icicle-bn254 and run cargo test:

```sh
%cd wrappers/rust/icicle-curves/icicle-bn254/
!cargo test --release
%cd /content/icicle/wrappers/rust/icicle-curves/icicle-bn254/
!cargo test --release -- ntt
```

:::note
Expand All @@ -114,25 +143,20 @@ Compiling the first time may take a while
Test run should end like this:

```sh
running 15 tests
test curve::tests::test_ark_point_convert ... ok
test curve::tests::test_ark_scalar_convert ... ok
test curve::tests::test_affine_projective_convert ... ok
test curve::tests::test_point_equality ... ok
test curve::tests::test_field_convert_montgomery ... ok
test curve::tests::test_scalar_equality ... ok
test curve::tests::test_points_convert_montgomery ... ok
test msm::tests::test_msm ... ok
test msm::tests::test_msm_skewed_distributions ... ok
running 9 tests
[WARNING] Defaulting to Ingonyama icicle-cuda-license-server at `[email protected]`. For more information about icicle-cuda-license, please contact [email protected].
[INFO] ICICLE backend loaded from $ICICLE_BACKEND_INSTALL_DIR=/content/cuda_backend/icicle
test ecntt::tests::test_ecntt::test_ecntt_batch ... ok
test ntt::tests::test_ntt ... ok
test ntt::tests::test_ntt_arbitrary_coset ... ok
test msm::tests::test_msm_batch has been running for over 60 seconds
test msm::tests::test_msm_batch ... ok
test ntt::tests::test_ntt_batch ... ok
test ntt::tests::test_ntt_coset_from_subgroup ... ok
test ntt::tests::test_ntt_coset_interpolation_nm ... ok
test ecntt::tests::test_ecntt::test_ecntt ... ok
test ntt::tests::test_ntt_device_async ... ok
test ntt::tests::test_ntt_batch ... ok
test ntt::tests::test_ntt_release_domain ... ok

test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 99.39s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 36 filtered out; finished in 42.71s
```

Viola, ICICLE in Colab!

0 comments on commit 9bf3108

Please sign in to comment.