-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core,ffi): Add Swift tests for MSM benchmarking #56
Changes from all commits
d2911ad
ade9d91
f5afec7
565f9ac
9db7b6d
c6e8832
263f5e0
df7e981
4ddc617
aa8cd40
52b9e64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
num_msm,avg_processing_time(ms),total_processing_time(ms) | ||
1,1.224375,1.224375 | ||
500,0.36152366,180.76183 | ||
1000,0.305950039,305.950039 | ||
1500,0.3034417346666667,455.16260200000005 | ||
2000,0.309008472,618.016944 | ||
2500,0.3073222012,768.305503 | ||
3000,0.3040002196666667,912.000659 | ||
3500,0.30619671200000004,1071.688492 | ||
4000,0.3045648925,1218.2595700000002 | ||
4500,0.3030858693333333,1363.886412 | ||
5000,0.31226579120000003,1561.328956 | ||
5500,0.3099467858181818,1704.707322 | ||
6000,0.307641547,1845.8492820000001 | ||
6500,0.30413866584615384,1976.901328 | ||
7000,0.3078945885714286,2155.2621200000003 | ||
7500,0.3031438489333333,2273.5788669999997 | ||
8000,0.303863230625,2430.9058449999998 | ||
8500,0.3024968967058823,2571.223622 | ||
9000,0.3026250855555555,2723.62577 | ||
9500,0.30347056831578945,2882.970399 | ||
10000,0.30400440209999996,3040.0440209999997 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
num_msm,avg_processing_time(ms),total_processing_time(ms) | ||
1,0.956709,0.956709 | ||
500,0.428701728,214.350864 | ||
1000,0.580982619,580.982619 | ||
1500,0.37609757466666666,564.1463620000001 | ||
2000,0.363904182,727.8083640000001 | ||
2500,0.3618204652,904.5511630000001 | ||
3000,0.36476984566666665,1094.309537 | ||
3500,0.36913610714285716,1291.976375 | ||
4000,0.36055417300000003,1442.2166920000002 | ||
4500,0.3586435595555556,1613.8960180000001 | ||
5000,0.35959354720000003,1797.9677359999998 | ||
5500,0.3742771358181818,2058.524247 | ||
6000,0.3626761886666666,2176.057132 | ||
6500,0.36803800384615387,2392.247025 | ||
7000,0.371516067,2600.612469 | ||
7500,0.3678911301333333,2759.183476 | ||
8000,0.3686055185,2948.844148 | ||
8500,0.4007246014117647,3406.1591120000003 | ||
9000,0.3771045951111111,3393.941356 | ||
9500,0.37394299821052635,3552.458483 | ||
10000,0.3638388068,3638.388068 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import mopro | ||
import Foundation | ||
|
||
let path = FileManager.default.currentDirectoryPath + "/../../../../mopro-core/benchmarks/gpu_explorations/msm_bench_swift_laptop.csv" | ||
let fileURL = URL(fileURLWithPath: path) | ||
var fileContent = "num_msm,avg_processing_time(ms),total_processing_time(ms)\n" | ||
|
||
// generate trials = [1, 500, 1000, 1500, ... ,10000] | ||
let trials: [UInt32] = (0..<21).map { max($0 * 500, 1)} | ||
|
||
for each in trials { | ||
do { | ||
// for tracking the progress | ||
print("Running benchmark with \(each) MSMs...") | ||
let benchData: BenchmarkResult = try runMsmBenchmark(numMsm: each) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So for 10k MSMs it will do all these in Rust and only return results once done, right? Just trying to understand if it is going back and forth between swift and rust or something There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like the test script is running directly through |
||
fileContent += "\(benchData.numMsm),\(benchData.avgProcessingTime),\(benchData.totalProcessingTime)\n" | ||
} catch let error as MoproError{ | ||
print("Error running benchmark: \(error)") | ||
} | ||
} | ||
|
||
do { | ||
try fileContent.write(to: fileURL, atomically: true, encoding:.utf8) | ||
} catch { | ||
print("Error writing file: \(error)") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import mopro | ||
import Foundation | ||
|
||
do { | ||
let benchData: BenchmarkResult = try runMsmBenchmark(numMsm: 1000) | ||
print("\nBenchmarking \(1000) msm on BN254 curve") | ||
print("└─ Average msm time: \(benchData.avgProcessingTime) ms") | ||
print("└─ Overall processing time: \(benchData.totalProcessingTime) ms") | ||
} catch let error as MoproError{ | ||
print("Error running benchmark: \(error)") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
#[cfg(feature = "gpu-benchmarks")] | ||
uniffi::build_foreign_language_testcases!( | ||
"tests/bindings/test_mopro_gen_benchmarks_report.swift", | ||
"tests/bindings/test_mopro_gpu_benchmarks.swift", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can gate this whole block with the feature flag There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. I added a feature flag for this function. (seems like it is not allow to add a feature flag inside the function parameters) |
||
); | ||
|
||
#[cfg(not(feature = "gpu-benchmarks"))] | ||
uniffi::build_foreign_language_testcases!( | ||
"tests/bindings/test_mopro.swift", | ||
"tests/bindings/test_mopro.kts", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: on L229 num_msm should be _num_msm for lint not to complain