Skip to content

Commit

Permalink
feat: enable gpu snarks by default (#916)
Browse files Browse the repository at this point in the history
feat: enable gpu snarks by default
  • Loading branch information
dignifiedquire authored Oct 28, 2019
2 parents ca2d8a0 + 2cef3bf commit 5a2b2de
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-ci
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update && \
apt-get install -y curl file gcc g++ git make openssh-client \
autoconf automake cmake libtool libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang
xz-utils pkg-config python clang ocl-icd-opencl-dev

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

Expand Down
4 changes: 2 additions & 2 deletions fil-proofs-tooling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ human-size = "0.4"
prettytable-rs = "0.8"
regex = "1.1.6"
commandspec = "0.12.2"
bellperson = "0.3"
bellperson = "0.3.3"
chrono = { version = "0.4.7", features = ["serde"] }
fil-sapling-crypto = "0.1.2"
memmap = "0.7.0"
Expand All @@ -42,5 +42,5 @@ log = "0.4.8"
uom = "0.25.0"

[features]
default = []
default = ["gpu"]
gpu = ["storage-proofs/gpu", "filecoin-proofs/gpu", "bellperson/gpu", "fil-sapling-crypto/gpu"]
2 changes: 1 addition & 1 deletion fil-proofs-tooling/src/bin/benchy/stacked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ where
let pb = stacked::PublicInputs::<H::Domain, <Blake2sHasher as Hasher>::Domain> {
replica_id,
seed,
tau: Some(tau.clone()),
tau: Some(tau),
k: Some(0),
};

Expand Down
4 changes: 2 additions & 2 deletions filecoin-proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ regex = "1"
ff = "0.4.0"
blake2b_simd = "0.5"
phase21 = "0.3"
bellperson = "0.3"
bellperson = "0.3.3"
paired = "0.15"
fil-sapling-crypto = "0.1.2"
clap = "2"
Expand All @@ -55,7 +55,7 @@ pretty_env_logger = "0.3.1"
pretty_assertions = "0.6.1"

[features]
default = []
default = ["gpu"]
cpu-profile = []
heap-profile = ["gperftools/heap"]
simd = ["storage-proofs/simd"]
Expand Down
23 changes: 14 additions & 9 deletions filecoin-proofs/src/fr32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,20 @@ pub fn extract_bits_and_shift(
let input = &input[..BitByte::from_bits(extraction_offset + num_bits).bytes_needed()];

// (2).
let mut output = if new_offset < extraction_offset {
// Shift right.
shift_bits(input, extraction_offset - new_offset, false)
} else if new_offset > extraction_offset {
// Shift left.
shift_bits(input, new_offset - extraction_offset, true)
} else {
// No shift needed, take the `input` as is.
input.to_vec()
use std::cmp::Ordering;
let mut output = match new_offset.cmp(&extraction_offset) {
Ordering::Less => {
// Shift right.
shift_bits(input, extraction_offset - new_offset, false)
}
Ordering::Greater => {
// Shift left.
shift_bits(input, new_offset - extraction_offset, true)
}
Ordering::Equal => {
// No shift needed, take the `input` as is.
input.to_vec()
}
};

// After the shift we may not need the last byte of the `output` (either
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2019-08-09
nightly-2019-10-17
4 changes: 2 additions & 2 deletions storage-proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ blake2b_simd = "0.5"
blake2s_simd = "0.5"
toml = "0.5"
ff = "0.4.0"
bellperson = "0.3"
bellperson = "0.3.3"
paired = { version = "0.15.1", features = ["serde"] }
fil-sapling-crypto = "0.1.2"
serde_json = "1.0"
Expand All @@ -51,7 +51,7 @@ crossbeam = "0.7.2"
num_cpus = "1.10.1"

[features]
default = []
default = ["gpu"]
simd = []
asm = ["sha2/sha2-asm"]
mem-trees = []
Expand Down
6 changes: 3 additions & 3 deletions storage-proofs/src/circuit/metric/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl<E: Engine> ConstraintSystem<E> for MetricCS<E> {
AR: Into<String>,
{
let path = compute_path(&self.current_namespace, &annotation().into());
self.aux.push(path.clone());
self.aux.push(path);

Ok(Variable::new_unchecked(Index::Aux(self.aux.len() - 1)))
}
Expand All @@ -214,7 +214,7 @@ impl<E: Engine> ConstraintSystem<E> for MetricCS<E> {
AR: Into<String>,
{
let path = compute_path(&self.current_namespace, &annotation().into());
self.inputs.push(path.clone());
self.inputs.push(path);

Ok(Variable::new_unchecked(Index::Input(self.inputs.len() - 1)))
}
Expand Down Expand Up @@ -245,7 +245,7 @@ impl<E: Engine> ConstraintSystem<E> for MetricCS<E> {
{
let name = name_fn().into();
let path = compute_path(&self.current_namespace, &name);
self.set_named_obj(path.clone(), NamedObject::Namespace);
self.set_named_obj(path, NamedObject::Namespace);
self.current_namespace.push(name);
}

Expand Down
2 changes: 1 addition & 1 deletion storage-proofs/src/circuit/stacked/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<H: Hasher> InclusionPath<H> {
) -> Result<(), SynthesisError> {
let InclusionPath { auth_path, .. } = self;

let root = Root::from_allocated::<CS>(root.clone());
let root = Root::from_allocated::<CS>(root);
let value = Root::from_allocated::<CS>(leaf);
PoRCircuit::<Bls12, H>::synthesize(cs, params, value, auth_path, root, true)
}
Expand Down
2 changes: 1 addition & 1 deletion storage-proofs/src/circuit/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl<E: Engine> ConstraintSystem<E> for TestConstraintSystem<E> {
{
let name = name_fn().into();
let path = compute_path(&self.current_namespace, &name);
self.set_named_obj(path.clone(), NamedObject::Namespace);
self.set_named_obj(path, NamedObject::Namespace);
self.current_namespace.push(name);
}

Expand Down

0 comments on commit 5a2b2de

Please sign in to comment.