From f02db165f4000d6576686b0e38a9f6085f3045b1 Mon Sep 17 00:00:00 2001 From: Admin AWS GPU Date: Thu, 29 Feb 2024 09:47:04 +0000 Subject: [PATCH 1/3] Fix bugs --- field/Cargo.toml | 2 +- plonky2/src/fri/oracle.rs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/field/Cargo.toml b/field/Cargo.toml index 2eeafc0454..a0f377107b 100644 --- a/field/Cargo.toml +++ b/field/Cargo.toml @@ -32,7 +32,7 @@ proc-macro2 = "1" quote = "1" [features] -default = ["no_cuda"] +default = [] cuda = ["cryptography_cuda"] precompile = [] no_cuda = ["cryptography_cuda/no_cuda"] \ No newline at end of file diff --git a/plonky2/src/fri/oracle.rs b/plonky2/src/fri/oracle.rs index 927128c8d8..479d490b4e 100644 --- a/plonky2/src/fri/oracle.rs +++ b/plonky2/src/fri/oracle.rs @@ -141,11 +141,7 @@ impl, C: GenericConfig, const D: usize> ) -> Self { let degree = polynomials[0].len(); let log_n = log2_strict(degree) + rate_bits; - let num_gpus: usize = std::env::var("NUM_OF_GPUS") - .expect("NUM_OF_GPUS should be set") - .parse() - .unwrap(); - + #[cfg(feature = "cuda")] if(log_n > 10 && polynomials.len() > 0){ let lde_values = Self::from_coeffs_gpu( @@ -159,6 +155,12 @@ impl, C: GenericConfig, const D: usize> degree ); + let num_gpus: usize = std::env::var("NUM_OF_GPUS") + .expect("NUM_OF_GPUS should be set") + .parse() + .unwrap(); + + if num_gpus != 1 { let mut leaves = timed!(timing, "transpose LDEs", transpose(&lde_values)); reverse_index_bits_in_place(&mut leaves); @@ -314,12 +316,12 @@ impl, C: GenericConfig, const D: usize> id as i32, device_transpose_data.as_mut_ptr(), device_output_data.as_mut_ptr(), - log2_strict(degree), + log_n, cfg_trans ); let start = std::time::Instant::now(); - let nums: Vec = (0..poly_chunk.len()).collect(); + let nums: Vec = (0..(1< Date: Thu, 29 Feb 2024 10:03:19 +0000 Subject: [PATCH 2/3] Add timing for transpose --- plonky2/src/fri/oracle.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plonky2/src/fri/oracle.rs b/plonky2/src/fri/oracle.rs index 479d490b4e..ae657eebb4 100644 --- a/plonky2/src/fri/oracle.rs +++ b/plonky2/src/fri/oracle.rs @@ -312,6 +312,8 @@ impl, C: GenericConfig, const D: usize> cfg_trans.batches = per_device_batch as u32; cfg_trans.are_inputs_on_device = true; cfg_trans.are_outputs_on_device = true; + + let start = std::time::Instant::now(); transpose_rev_batch( id as i32, device_transpose_data.as_mut_ptr(), @@ -320,6 +322,8 @@ impl, C: GenericConfig, const D: usize> cfg_trans ); + println!("real transpose_rev_batch elapsed: {:?}", start.elapsed()); + let start = std::time::Instant::now(); let nums: Vec = (0..(1< Date: Thu, 29 Feb 2024 11:03:24 +0000 Subject: [PATCH 3/3] Update Cargo.toml --- field/Cargo.toml | 2 +- rust-toolchain | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 rust-toolchain diff --git a/field/Cargo.toml b/field/Cargo.toml index a0f377107b..2eeafc0454 100644 --- a/field/Cargo.toml +++ b/field/Cargo.toml @@ -32,7 +32,7 @@ proc-macro2 = "1" quote = "1" [features] -default = [] +default = ["no_cuda"] cuda = ["cryptography_cuda"] precompile = [] no_cuda = ["cryptography_cuda/no_cuda"] \ No newline at end of file diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 07ade694b1..0000000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly \ No newline at end of file