Skip to content

Commit 674f2e5

Browse files
committed
update rust msm example
1 parent 307f24b commit 674f2e5

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

examples/rust/msm/Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@ edition = "2018"
77
icicle-runtime = { path = "../../../wrappers/rust/icicle-runtime" }
88
icicle-core = { path = "../../../wrappers/rust/icicle-core" }
99
icicle-bn254 = { path = "../../../wrappers/rust/icicle-curves/icicle-bn254" }
10-
icicle-bls12-377 = { path = "../../../wrappers/rust/icicle-curves/icicle-bls12-377" }
1110
clap = { version = "<=4.4.12", features = ["derive"] }
1211

1312
[features]
1413
cuda = ["icicle-runtime/cuda_backend",
1514
"icicle-bn254/cuda_backend",
1615
"icicle-bn254/no_ecntt",
17-
"icicle-bls12-377/cuda_backend",
18-
"icicle-bls12-377/no_ecntt"
1916
]
2017

2118
metal = ["icicle-runtime/metal_backend",
2219
"icicle-bn254/metal_backend",
2320
"icicle-bn254/no_ecntt",
24-
"icicle-bls12-377/metal_backend",
25-
"icicle-bls12-377/no_ecntt"
2621
]

examples/rust/msm/src/main.rs

-41
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ use icicle_runtime::{
33
stream::IcicleStream,
44
};
55

6-
// Using both bn254 and bls12-377 curves
7-
use icicle_bls12_377::curve::{
8-
CurveCfg as BLS12377CurveCfg, G1Projective as BLS12377G1Projective, ScalarCfg as BLS12377ScalarCfg,
9-
};
106
use icicle_bn254::curve::{CurveCfg, G1Projective, G2CurveCfg, G2Projective, ScalarCfg};
117

128
use clap::Parser;
@@ -53,10 +49,6 @@ fn main() {
5349
let g2_upper_points = G2CurveCfg::generate_random_affine_points(upper_size);
5450
let upper_scalars = ScalarCfg::generate_random(upper_size);
5551

56-
println!("Generating random inputs on host for bls12377...");
57-
let upper_points_bls12377 = BLS12377CurveCfg::generate_random_affine_points(upper_size);
58-
let upper_scalars_bls12377 = BLS12377ScalarCfg::generate_random(upper_size);
59-
6052
for i in lower_bound..=upper_bound {
6153
let log_size = i;
6254
let size = 1 << log_size;
@@ -70,10 +62,6 @@ fn main() {
7062
let g2_points = HostSlice::from_slice(&g2_upper_points[..size]);
7163
let scalars = HostSlice::from_slice(&upper_scalars[..size]);
7264

73-
// Setting bls12377 points and scalars
74-
let points_bls12377 = HostSlice::from_slice(&upper_points_bls12377[..size]);
75-
let scalars_bls12377 = HostSlice::from_slice(&upper_scalars_bls12377[..size]);
76-
7765
println!("Configuring bn254 MSM...");
7866
let mut msm_results = DeviceVec::<G1Projective>::device_malloc(1).unwrap();
7967
let mut g2_msm_results = DeviceVec::<G2Projective>::device_malloc(1).unwrap();
@@ -86,30 +74,13 @@ fn main() {
8674
g2_cfg.stream_handle = *g2_stream;
8775
g2_cfg.is_async = true;
8876

89-
println!("Configuring bls12377 MSM...");
90-
let mut msm_results_bls12377 = DeviceVec::<BLS12377G1Projective>::device_malloc(1).unwrap();
91-
let mut stream_bls12377 = IcicleStream::create().unwrap();
92-
let mut cfg_bls12377 = msm::MSMConfig::default();
93-
cfg_bls12377.stream_handle = *stream_bls12377;
94-
cfg_bls12377.is_async = true;
95-
9677
println!("Executing bn254 MSM on device...");
9778
msm::msm(scalars, points, &cfg, &mut msm_results[..]).unwrap();
9879
msm::msm(scalars, g2_points, &g2_cfg, &mut g2_msm_results[..]).unwrap();
9980

100-
println!("Executing bls12377 MSM on device...");
101-
msm::msm(
102-
scalars_bls12377,
103-
points_bls12377,
104-
&cfg_bls12377,
105-
&mut msm_results_bls12377[..],
106-
)
107-
.unwrap();
108-
10981
println!("Moving results to host...");
11082
let mut msm_host_result = vec![G1Projective::zero(); 1];
11183
let mut g2_msm_host_result = vec![G2Projective::zero(); 1];
112-
let mut msm_host_result_bls12377 = vec![BLS12377G1Projective::zero(); 1];
11384

11485
stream
11586
.synchronize()
@@ -127,14 +98,6 @@ fn main() {
12798
.unwrap();
12899
println!("G2 bn254 result: {:#?}", g2_msm_host_result);
129100

130-
stream_bls12377
131-
.synchronize()
132-
.unwrap();
133-
msm_results_bls12377
134-
.copy_to_host(HostSlice::from_mut_slice(&mut msm_host_result_bls12377[..]))
135-
.unwrap();
136-
println!("bls12377 result: {:#?}", msm_host_result_bls12377);
137-
138101
println!("Cleaning up bn254...");
139102
stream
140103
.destroy()
@@ -143,10 +106,6 @@ fn main() {
143106
.destroy()
144107
.unwrap();
145108

146-
println!("Cleaning up bls12377...");
147-
stream_bls12377
148-
.destroy()
149-
.unwrap();
150109
println!("");
151110
}
152111
}

0 commit comments

Comments
 (0)