From f65a0c7ccc28a1dd22189c61364e048837b42c7c Mon Sep 17 00:00:00 2001 From: Sagar Dhawan Date: Mon, 16 Dec 2024 08:47:38 -0800 Subject: [PATCH] use icicle-jolt to compile cuda deps --- Cargo.lock | 17 +++++++++-------- README.md | 23 +++++++++++++++++++++++ jolt-core/Cargo.toml | 6 +++--- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18184b0b5..aefc84ab4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1557,8 +1557,8 @@ dependencies = [ [[package]] name = "icicle-bn254" -version = "3.1.0" -source = "git+https://github.com/ingonyama-zk/icicle.git?tag=v3.1.0#38712a95af4a118a124321c81383daa93f59f1e4" +version = "3.2.0" +source = "git+https://github.com/ingonyama-zk/icicle-jolt.git?rev=ed93e21#ed93e21cbb405822b0aa1b58b5dc6c7837a04108" dependencies = [ "cmake", "icicle-core", @@ -1568,8 +1568,8 @@ dependencies = [ [[package]] name = "icicle-core" -version = "3.1.0" -source = "git+https://github.com/ingonyama-zk/icicle.git?tag=v3.1.0#38712a95af4a118a124321c81383daa93f59f1e4" +version = "3.2.0" +source = "git+https://github.com/ingonyama-zk/icicle-jolt.git?rev=ed93e21#ed93e21cbb405822b0aa1b58b5dc6c7837a04108" dependencies = [ "hex", "icicle-runtime", @@ -1580,8 +1580,8 @@ dependencies = [ [[package]] name = "icicle-hash" -version = "3.1.0" -source = "git+https://github.com/ingonyama-zk/icicle.git?tag=v3.1.0#38712a95af4a118a124321c81383daa93f59f1e4" +version = "3.2.0" +source = "git+https://github.com/ingonyama-zk/icicle-jolt.git?rev=ed93e21#ed93e21cbb405822b0aa1b58b5dc6c7837a04108" dependencies = [ "cmake", "icicle-core", @@ -1591,10 +1591,11 @@ dependencies = [ [[package]] name = "icicle-runtime" -version = "3.1.0" -source = "git+https://github.com/ingonyama-zk/icicle.git?tag=v3.1.0#38712a95af4a118a124321c81383daa93f59f1e4" +version = "3.2.0" +source = "git+https://github.com/ingonyama-zk/icicle-jolt.git?rev=ed93e21#ed93e21cbb405822b0aa1b58b5dc6c7837a04108" dependencies = [ "cmake", + "once_cell", ] [[package]] diff --git a/README.md b/README.md index 4765c81f9..a76463f8d 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,29 @@ Examples in the [`examples`](./examples/) directory can be run using e.g. ```cargo run --release -p sha2-chain``` +## CUDA Support + +JOLT supports CUDA acceleration via [icicle](https://github.com/ingonyama-zk/icicle-jolt). + +Dependencies: +1. Install [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) +2. Install [CMake](https://cmake.org/) + +Now you may build Jolt with CUDA acceleration using the `--features icicle` flag. + +### Build + +```cargo build -p jolt-core --features icicle``` + +### Bench + +``` +# Set the icicle backend path - this won't be needed in the future +export ICICLE_BACKEND_INSTALL_DIR=$(pwd)/target/debug/deps/icicle/lib/backend +cargo bench --bench msm_batch --no-fail-fast -p jolt-core --features icicle +``` + +Note - NVIDIA doesn't support cross compilation on MacOS. Only Windows or Linux. ## Performance profiling diff --git a/jolt-core/Cargo.toml b/jolt-core/Cargo.toml index 7f58c5c97..0153b9dde 100644 --- a/jolt-core/Cargo.toml +++ b/jolt-core/Cargo.toml @@ -119,9 +119,9 @@ name = "jolt_core" path = "src/lib.rs" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -icicle-runtime = { git = "https://github.com/ingonyama-zk/icicle.git", tag = "v3.1.0", optional = true } -icicle-core = { git = "https://github.com/ingonyama-zk/icicle.git", tag = "v3.1.0", optional = true } -icicle-bn254 = { git = "https://github.com/ingonyama-zk/icicle.git", tag = "v3.1.0", optional = true } +icicle-runtime = { git = "https://github.com/ingonyama-zk/icicle-jolt.git", features = ["cuda_backend"], rev = "ed93e21", optional = true } +icicle-core = { git = "https://github.com/ingonyama-zk/icicle-jolt.git", rev = "ed93e21", optional = true } +icicle-bn254 = { git = "https://github.com/ingonyama-zk/icicle-jolt.git", features = ["cuda_backend"], rev = "ed93e21", optional = true } memory-stats = "1.0.0" sys-info = "0.9.1" tokio = { version = "1.38.0", optional = true, features = ["rt-multi-thread"] }