Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dloghin committed Nov 21, 2024
1 parent 44af8be commit 9692bc3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 27 deletions.
6 changes: 3 additions & 3 deletions wrappers/rust/benches/gpu_fft_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

extern crate criterion;
use criterion::{criterion_group, criterion_main, Criterion};
use zeknox::{
device::memory::HostOrDeviceSlice, init_twiddle_factors_rs, ntt_batch, types::NTTConfig,
};
use plonky2_field::{
fft::fft,
goldilocks_field::GoldilocksField,
polynomial::PolynomialCoeffs,
types::{Field, PrimeField64},
};
use rand::random;
use zeknox::{
device::memory::HostOrDeviceSlice, init_twiddle_factors_rs, ntt_batch, types::NTTConfig,
};

const DEFAULT_GPU: usize = 0;

Expand Down
8 changes: 4 additions & 4 deletions wrappers/rust/benches/lde_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ extern crate criterion;
use std::env;

use criterion::{criterion_group, criterion_main, Criterion};
use zeknox::{
device::memory::HostOrDeviceSlice, get_number_of_gpus_rs, init_coset_rs,
init_twiddle_factors_rs, lde_batch_multi_gpu, types::NTTConfig,
};
use plonky2_field::{
goldilocks_field::GoldilocksField,
types::{Field, PrimeField64},
};
use rand::random;
use zeknox::{
device::memory::HostOrDeviceSlice, get_number_of_gpus_rs, init_coset_rs,
init_twiddle_factors_rs, lde_batch_multi_gpu, types::NTTConfig,
};

fn random_fr() -> u64 {
let fr: u64 = random();
Expand Down
11 changes: 2 additions & 9 deletions wrappers/rust/benches/transpose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
extern crate criterion;
use criterion::{criterion_group, criterion_main, Criterion};
#[cfg(not(feature = "no_cuda"))]
use zeknox::{
device::memory::HostOrDeviceSlice, transpose_rev_batch,
types::TransposeConfig,
};
use zeknox::{device::memory::HostOrDeviceSlice, transpose_rev_batch, types::TransposeConfig};

use rand::random;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
Expand Down Expand Up @@ -94,11 +91,7 @@ pub fn transpose<T: Send + Sync + Copy>(matrix: &Vec<Vec<T>>, len: usize) -> Vec
}

#[cfg(not(feature = "no_cuda"))]
criterion_group!(
benches,
bench_transpose_gpu,
bench_transpose_cpu
);
criterion_group!(benches, bench_transpose_gpu, bench_transpose_cpu);
#[cfg(feature = "no_cuda")]
criterion_group!(benches, bench_transpose_cpu);
criterion_main!(benches);
11 changes: 5 additions & 6 deletions wrappers/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ fn build_device_wrapper() {
println!("cargo:rustc-link-search=native={}", "/usr/local/cuda/lib64");
println!("cargo:rustc-link-lib=cudart");
println!("cargo:rerun-if-changed={}", cuda_runtime_api_path);
println!("cargo:rerun-if-changed={}", binding_path.to_string_lossy().to_string());
println!(
"cargo:rerun-if-changed={}",
binding_path.to_string_lossy().to_string()
);

let bindings = bindgen::Builder::default()
.header(cuda_runtime_api_path)
Expand Down Expand Up @@ -69,11 +72,7 @@ fn build_device_wrapper() {
.generate()
.expect("Unable to generate bindings");

fs::write(
binding_path,
bindings.to_string(),
)
.expect("Couldn't write bindings!");
fs::write(binding_path, bindings.to_string()).expect("Couldn't write bindings!");
}

#[cfg(not(feature = "no_cuda"))]
Expand Down
2 changes: 1 addition & 1 deletion wrappers/rust/examples/ntt_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#[allow(dead_code)]
#[allow(unused_imports)]
extern crate criterion;
use rand::random;
use zeknox::{
device::memory::HostOrDeviceSlice, init_twiddle_factors_rs, ntt_batch, types::NTTConfig,
};
use rand::random;

const DEFAULT_GPU: usize = 0;
fn random_fr() -> u64 {
Expand Down
8 changes: 4 additions & 4 deletions wrappers/rust/tests/merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
use core::mem::MaybeUninit;
use core::slice;

use zeknox::{
device::{memory::HostOrDeviceSlice, stream::CudaStream},
fill_digests_buf_linear_gpu_with_gpu_ptr, fill_digests_buf_linear_multigpu_with_gpu_ptr,
};
use plonky2::{
hash::{
hash_types::{RichField, NUM_HASH_OUT_ELTS},
Expand All @@ -20,6 +16,10 @@ use plonky2::{
},
};
use plonky2_field::types::Field;
use zeknox::{
device::{memory::HostOrDeviceSlice, stream::CudaStream},
fill_digests_buf_linear_gpu_with_gpu_ptr, fill_digests_buf_linear_multigpu_with_gpu_ptr,
};

fn random_data<F: RichField>(n: usize, k: usize) -> Vec<Vec<F>> {
(0..n).map(|_| F::rand_vec(k)).collect()
Expand Down

0 comments on commit 9692bc3

Please sign in to comment.