Skip to content

Commit

Permalink
use ccache if available (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
yshekel authored Aug 22, 2024
1 parent 0d447c9 commit a62ab2e
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 31 deletions.
Empty file removed device_api.md
Empty file.
14 changes: 14 additions & 0 deletions icicle_v3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ 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})
set(CMAKE_CUDA_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
else()
message(STATUS "ccache not found")
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Build options
Expand Down
3 changes: 1 addition & 2 deletions wrappers/rust_v3/icicle-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ serial_test = "3.0.0"
once_cell = "1.10.0"

[features]
no_g2 = []
no_ecntt = []

11 changes: 2 additions & 9 deletions wrappers/rust_v3/icicle-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
5 changes: 3 additions & 2 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-377/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
10 changes: 4 additions & 6 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-381/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
1 change: 0 additions & 1 deletion wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions wrappers/rust_v3/icicle-curves/icicle-bn254/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
1 change: 0 additions & 1 deletion wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions wrappers/rust_v3/icicle-curves/icicle-bw6-761/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion wrappers/rust_v3/icicle-curves/icicle-grumpkin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion wrappers/rust_v3/icicle-curves/icicle-grumpkin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion wrappers/rust_v3/icicle-fields/icicle-babybear/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion wrappers/rust_v3/icicle-fields/icicle-stark252/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit a62ab2e

Please sign in to comment.