Skip to content

Commit

Permalink
feat(gbench): customize batch-sizes of gbench through cli args
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvank authored and porcuquine committed Nov 2, 2020
1 parent 8a3d92d commit 15b7eac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gbench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ env_logger = "0.7.1"
ff = { version = "0.2.1", package = "fff" }
generic-array = "0.14.4"
log = "0.4.8"
structopt = { version = "0.3", default-features = false }
neptune = { path = "../", default-features = false }

[features]
default = ["pairing", "gpu"]
gpu = ["neptune/gpu"]
pairing = ["neptune/pairing", "bellperson/pairing"]
blst = ["neptune/blst", "bellperson/blst"]

9 changes: 8 additions & 1 deletion gbench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

Benchmarking tool for Neptune.

## Usage

Running gbench with customized batch sizes on the default GPU:

`RUST_LOG=info cargo run -- --max-tree-batch-size 700000 --max-column-batch-size 400000`


## Environment variables

- `NEPTUNE_GBENCH_GPUS=<bus-id1>,<bus-id2>,...` allows you to select the GPUs you want to run gbench on given a comma-separated list of bus-ids.

(Bus-id is a decimal integer that can be found through `nvidia-smi`, `rocm-smi`, `lspci` and etc.)
16 changes: 14 additions & 2 deletions gbench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use neptune::BatchHasher;
use std::result::Result;
use std::thread;
use std::time::Instant;
use structopt::StructOpt;

fn bench_column_building(
log_prefix: &str,
Expand Down Expand Up @@ -95,15 +96,26 @@ fn bench_column_building(
res[res.len() - 1]
}

#[derive(Debug, StructOpt, Clone, Copy)]
#[structopt(name = "Neptune gbench", about = "Neptune benchmarking program")]
struct Opts {
#[structopt(long = "max-tree-batch-size", default_value = "700000")]
max_tree_batch_size: usize,
#[structopt(long = "max-column-batch-size", default_value = "400000")]
max_column_batch_size: usize,
}

fn main() -> Result<(), Error> {
env_logger::init();

let opts = Opts::from_args();

let kib = 1024 * 1024 * 4; // 4GiB
// let kib = 1024 * 512; // 512MiB
let bytes = kib * 1024;
let leaves = bytes / 32;
let max_column_batch_size = 400000;
let max_tree_batch_size = 700000;
let max_column_batch_size = opts.max_column_batch_size;
let max_tree_batch_size = opts.max_tree_batch_size;

info!("KiB: {}", kib);
info!("leaves: {}", leaves);
Expand Down

0 comments on commit 15b7eac

Please sign in to comment.