From 65b99dc5f81fa1a616bcf1ba09b709c44355fb73 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Wed, 21 Aug 2024 23:06:50 +0300 Subject: [PATCH 1/4] use ccache if available --- device_api.md | 0 icicle_v3/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 13 insertions(+) delete mode 100644 device_api.md diff --git a/device_api.md b/device_api.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/icicle_v3/CMakeLists.txt b/icicle_v3/CMakeLists.txt index 89d23255e..e0350d538 100644 --- a/icicle_v3/CMakeLists.txt +++ b/icicle_v3/CMakeLists.txt @@ -17,6 +17,19 @@ endif() # Print the selected build type message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +# Find the ccache program +find_program(CCACHE_PROGRAM ccache) +# If ccache is found, use it as the compiler launcher +if(CCACHE_PROGRAM) + message(STATUS "ccache found: ${CCACHE_PROGRAM}") + + # Use ccache for C and C++ compilers + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) +else() + message(STATUS "ccache not found") +endif() + set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Build options From f8e9f0f4a2ef04a531f240813a7b88a048cc90e2 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Thu, 22 Aug 2024 12:02:12 +0300 Subject: [PATCH 2/4] cargo features removed from icicle core --- wrappers/rust_v3/icicle-core/Cargo.toml | 3 +-- .../rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml | 5 +++-- .../rust_v3/icicle-curves/icicle-bls12-377/build.rs | 10 ++++------ .../rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml | 4 ++-- .../rust_v3/icicle-curves/icicle-bls12-381/build.rs | 1 - wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml | 4 ++-- wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs | 1 - .../rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml | 3 +-- .../rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml | 2 +- .../rust_v3/icicle-curves/icicle-grumpkin/build.rs | 1 - .../rust_v3/icicle-fields/icicle-babybear/build.rs | 1 - .../rust_v3/icicle-fields/icicle-stark252/build.rs | 1 - 12 files changed, 14 insertions(+), 22 deletions(-) diff --git a/wrappers/rust_v3/icicle-core/Cargo.toml b/wrappers/rust_v3/icicle-core/Cargo.toml index 48c869ccf..12fc197d9 100644 --- a/wrappers/rust_v3/icicle-core/Cargo.toml +++ b/wrappers/rust_v3/icicle-core/Cargo.toml @@ -19,5 +19,4 @@ serial_test = "3.0.0" once_cell = "1.10.0" [features] -no_g2 = [] -no_ecntt = [] + diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml index 6f410540f..ab21c6e42 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml @@ -21,9 +21,10 @@ cmake = "0.1.50" [features] default = [] +no_g2 = [] +no_ecntt = [] bw6-761 = [] -no_g2 = ["icicle-core/no_g2"] -no_ecntt = ["icicle-core/no_ecntt"] +no_bw6_g2 = [] cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs index 8403b29e6..dffea23ad 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs @@ -26,7 +26,6 @@ fn main() { config .define("CURVE", "bls12_377") .define("FIELD", "bls12_377") - .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); // build (or pull and build) cuda backend if feature enabled. @@ -59,7 +58,6 @@ fn main() { config_bw .define("CURVE", "bw6_761") .define("FIELD", "bw6_761") - .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); // build (or pull and build) cuda backend if feature enabled. @@ -71,12 +69,12 @@ fn main() { } // Optional Features that are default ON (so that default matches any backend) - if cfg!(feature = "no_g2") { + if cfg!(feature = "no_bw6_g2") { config_bw.define("G2", "OFF"); } - if cfg!(feature = "no_ecntt") { - config_bw.define("ECNTT", "OFF"); - } + // if cfg!(feature = "no_ecntt") { + config_bw.define("ECNTT", "OFF"); + // } // Build let _ = config_bw diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml index 33fa839d3..68446911f 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml @@ -21,8 +21,8 @@ cmake = "0.1.50" [features] default = [] -no_g2 = ["icicle-core/no_g2"] -no_ecntt = ["icicle-core/no_ecntt"] +no_g2 = [] +no_ecntt = [] cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs index 50403f4c0..91ba603e5 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs @@ -26,7 +26,6 @@ fn main() { config .define("CURVE", "bls12_381") .define("FIELD", "bls12_381") - .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); // build (or pull and build) cuda backend if feature enabled. diff --git a/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml index be6529fe6..538385447 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml @@ -21,8 +21,8 @@ cmake = "0.1.50" [features] default = [] -no_g2 = ["icicle-core/no_g2"] -no_ecntt = ["icicle-core/no_ecntt"] +no_g2 = [] +no_ecntt = [] cuda_backend = ["icicle-runtime/cuda_backend"] pull_cuda_backend = ["icicle-runtime/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs b/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs index b2542ba8d..4830ad1ef 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs @@ -25,7 +25,6 @@ fn main() { }; config .define("CURVE", "bn254") - .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); // build (or pull and build) cuda backend if feature enabled. diff --git a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml index e13159098..0ac8de931 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml @@ -21,8 +21,7 @@ cmake = "0.1.50" [features] default = [] -no_g2 = ["icicle-bls12-377/no_g2"] -no_ecntt = ["icicle-bls12-377/no_ecntt"] +no_g2 = ["icicle-bls12-377/no_bw6_g2"] cuda_backend = ["icicle-bls12-377/cuda_backend"] pull_cuda_backend = ["icicle-bls12-377/pull_cuda_backend"] diff --git a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml index d69018cef..c797f76ac 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml +++ b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml @@ -8,7 +8,7 @@ homepage.workspace = true repository.workspace = true [dependencies] -icicle-core = { workspace = true, features=["no_ecntt","no_g2"] } +icicle-core = { workspace = true } icicle-runtime = { workspace = true } # criterion = "0.3" diff --git a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/build.rs b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/build.rs index e4fd78cc6..8af4e5230 100644 --- a/wrappers/rust_v3/icicle-curves/icicle-grumpkin/build.rs +++ b/wrappers/rust_v3/icicle-curves/icicle-grumpkin/build.rs @@ -25,7 +25,6 @@ fn main() { }; config .define("CURVE", "grumpkin") - .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); // build (or pull and build) cuda backend if feature enabled. diff --git a/wrappers/rust_v3/icicle-fields/icicle-babybear/build.rs b/wrappers/rust_v3/icicle-fields/icicle-babybear/build.rs index 16aba61c4..f9c78e430 100644 --- a/wrappers/rust_v3/icicle-fields/icicle-babybear/build.rs +++ b/wrappers/rust_v3/icicle-fields/icicle-babybear/build.rs @@ -25,7 +25,6 @@ fn main() { }; config .define("FIELD", "babybear") - .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); // build (or pull and build) cuda backend if feature enabled. diff --git a/wrappers/rust_v3/icicle-fields/icicle-stark252/build.rs b/wrappers/rust_v3/icicle-fields/icicle-stark252/build.rs index aa8b0bff5..017c5a006 100644 --- a/wrappers/rust_v3/icicle-fields/icicle-stark252/build.rs +++ b/wrappers/rust_v3/icicle-fields/icicle-stark252/build.rs @@ -25,7 +25,6 @@ fn main() { }; config .define("FIELD", "stark252") - .define("CMAKE_BUILD_TYPE", "Release") .define("CMAKE_INSTALL_PREFIX", &icicle_install_dir); #[cfg(feature = "cuda_backend")] From 2ceed54a97bd96a3bd8b9b247d39ada133eaee36 Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Thu, 22 Aug 2024 12:05:59 +0300 Subject: [PATCH 3/4] ccache for cuda too --- icicle_v3/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/icicle_v3/CMakeLists.txt b/icicle_v3/CMakeLists.txt index e0350d538..0460230a5 100644 --- a/icicle_v3/CMakeLists.txt +++ b/icicle_v3/CMakeLists.txt @@ -26,6 +26,7 @@ if(CCACHE_PROGRAM) # Use ccache for C and C++ compilers set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) + set(CMAKE_CUDA_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) else() message(STATUS "ccache not found") endif() From ab740b5bcf26591e21f43a0aa7b78c9d578bc54c Mon Sep 17 00:00:00 2001 From: Yuval Shekel Date: Thu, 22 Aug 2024 12:58:56 +0300 Subject: [PATCH 4/4] removed cuda realted features from icicle core --- wrappers/rust_v3/icicle-core/build.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/wrappers/rust_v3/icicle-core/build.rs b/wrappers/rust_v3/icicle-core/build.rs index 240dee0b4..5f977a6b5 100644 --- a/wrappers/rust_v3/icicle-core/build.rs +++ b/wrappers/rust_v3/icicle-core/build.rs @@ -11,13 +11,6 @@ fn main() { // Construct the path to the deps directory let deps_dir = build_dir.join("deps"); - println!("cargo:rustc-link-arg=-Wl,-rpath,{}/icicle/lib", deps_dir.display()); // Add RPATH linker arguments - - // default backends dir - if cfg!(feature = "cuda_backend") || cfg!(feature = "pull_cuda_backend") { - println!( - "cargo:rustc-env=ICICLE_BACKEND_INSTALL_DIR={}/icicle/lib/backend", - deps_dir.display() - ); - } + // Add RPATH linker arguments + println!("cargo:rustc-link-arg=-Wl,-rpath,{}/icicle/lib", deps_dir.display()); }