Skip to content
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: enable multicore-sdr by default; allow env var to disable #182

Merged
merged 3 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
command: cd rust && cargo +$(cat rust-toolchain) clippy --all-targets -- -D warnings
- run:
name: Run cargo clippy (blst)
command: cd rust && cargo +$(cat rust-toolchain) clippy --all-targets --no-default-features --features blst -- -D warnings
command: cd rust && cargo +$(cat rust-toolchain) clippy --all-targets --no-default-features --features multicore-sdr --features blst -- -D warnings

workflows:
version: 2
Expand Down Expand Up @@ -262,7 +262,7 @@ commands:
RELEASE_NAME="${CIRCLE_PROJECT_REPONAME}-$(uname)-standard-pairing"

# Note: the blst dependency uses the portable configuration for maximum compatibility
./scripts/build-release.sh filcrypto $(cat ./rust-toolchain) --verbose --locked --no-default-features --features pairing,gpu --features blst-portable
./scripts/build-release.sh filcrypto $(cat ./rust-toolchain) --verbose --locked --no-default-features --features multicore-sdr --features pairing,gpu --features blst-portable
./scripts/package-release.sh $TARBALL_PATH
./scripts/publish-release.sh $TARBALL_PATH $RELEASE_NAME
- run:
Expand All @@ -274,7 +274,7 @@ commands:
RELEASE_NAME="${CIRCLE_PROJECT_REPONAME}-$(uname)-standard-blst"

# Note: the blst dependency uses the portable configuration for maximum compatibility
./scripts/build-release.sh filcrypto $(cat ./rust-toolchain) --verbose --locked --no-default-features --features blst,gpu --features blst-portable
./scripts/build-release.sh filcrypto $(cat ./rust-toolchain) --verbose --locked --no-default-features --features multicore-sdr --features blst,gpu --features blst-portable
./scripts/package-release.sh $TARBALL_PATH
./scripts/publish-release.sh $TARBALL_PATH $RELEASE_NAME
- run:
Expand All @@ -285,7 +285,7 @@ commands:
TARBALL_PATH="/tmp/${CIRCLE_PROJECT_REPONAME}-$(uname)-optimized.tar.gz"
RUSTFLAGS="-C target-feature=$(cat rustc-target-features-optimized.json | jq -r '.[].rustc_target_feature' | tr '\n' ',')"

./scripts/build-release.sh filcrypto $(cat ./rust-toolchain) --verbose --locked --no-default-features --features pairing,gpu
./scripts/build-release.sh filcrypto $(cat ./rust-toolchain) --verbose --locked --no-default-features --features multicore-sdr --features pairing,gpu
./scripts/package-release.sh $TARBALL_PATH
- run:
name: Build the optimized release (blst)
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ all: $(DEPS)
$(DEPS): .install-filcrypto ;

.install-filcrypto: rust
go clean -cache -testcache .
./install-filcrypto
@touch $@

clean:
go clean -cache -testcache .
rm -rf $(DEPS) .install-filcrypto
rm -f ./runner
cd rust && cargo clean && cd ..
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,20 @@ rm .install-filcrypto \
; FFI_BUILD_FROM_SOURCE=1 FFI_USE_BLST_PORTABLE=1 make
```

By default, a 'gpu' option is used in the proofs library. This feature is also used in FFI unless explicitly disabled. . To disable building with the 'gpu' dependency, set `FFI_USE_GPU=0`:
By default, a 'gpu' option is used in the proofs library. This feature is also used in FFI unless explicitly disabled. To disable building with the 'gpu' dependency, set `FFI_USE_GPU=0`:

```shell
rm .install-filcrypto \
; make clean \
; FFI_BUILD_FROM_SOURCE=1 FFI_USE_BLST=1 make
; FFI_BUILD_FROM_SOURCE=1 FFI_USE_BLST=1 FFI_USE_GPU=0 make
```

By default, a 'multicore-sdr' option is used in the proofs library. This feature is also used in FFI unless explicitly disabled. To disable building with the 'multicore-sdr' dependency, set `FFI_USE_MULTICORE_SDR=0`:

```shell
rm .install-filcrypto \
; make clean \
; FFI_BUILD_FROM_SOURCE=1 FFI_USE_MULTICORE_SDR=0 make
```

## Updating rust-fil-proofs (via rust-filecoin-proofs-api)
Expand Down
11 changes: 8 additions & 3 deletions install-filcrypto
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,19 @@ build_from_source() {
if [ "${FFI_USE_GPU}" == "0" ]; then
gpu_flags=""
fi
# Default to use multicore_sdr flags, unless specified to disable
use_multicore_sdr="--features multicore-sdr"
if [ "${FFI_USE_MULTICORE_SDR}" == "0" ]; then
use_multicore_sdr=""
fi

# Add feature specific rust flags as needed here.
if [ "${FFI_USE_BLST_PORTABLE}" == "1" ]; then
additional_flags="--no-default-features --features blst --features blst-portable${gpu_flags}"
additional_flags="--no-default-features ${use_multicore_sdr} --features blst --features blst-portable${gpu_flags}"
elif [ "${FFI_USE_BLST}" == "1" ]; then
additional_flags="--no-default-features --features blst${gpu_flags}"
additional_flags="--no-default-features ${use_multicore_sdr} --features blst${gpu_flags}"
else
additional_flags="--no-default-features --features pairing${gpu_flags}"
additional_flags="--no-default-features ${use_multicore_sdr} --features pairing${gpu_flags}"
fi

if [ -n "${__release_flags}" ]; then
Expand Down
50 changes: 44 additions & 6 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ rand = "0.7"
rand_chacha = "0.2.1"
rayon = "1.2.1"
anyhow = "1.0.23"
bellperson = { version = "0.14.0", default-features = false }
bellperson = { version = "0.14.1", default-features = false }
serde_json = "1.0.46"
rust-gpu-tools = "0.3.0"
storage-proofs-porep = { version = "~8.0.1", default-features = false }

[dependencies.filecoin-proofs-api]
package = "filecoin-proofs-api"
version = "8.0"
version = "8.0.1"
default-features = false

[build-dependencies]
Expand All @@ -48,8 +49,9 @@ cbindgen = "= 0.14.0"
tempfile = "3.0.8"

[features]
default = ["pairing", "gpu"]
pairing = ["filecoin-proofs-api/pairing", "bellperson/pairing"]
blst = ["filecoin-proofs-api/blst", "bellperson/blst"]
default = ["pairing", "gpu", "multicore-sdr" ]
pairing = ["filecoin-proofs-api/pairing", "bellperson/pairing", "storage-proofs-porep/pairing"]
blst = ["filecoin-proofs-api/blst", "bellperson/blst", "storage-proofs-porep/blst"]
blst-portable = ["bls-signatures/blst-portable", "blstrs/portable"]
gpu = ["filecoin-proofs-api/gpu", "bellperson/gpu"]
gpu = ["filecoin-proofs-api/gpu", "bellperson/gpu", "storage-proofs-porep/gpu"]
multicore-sdr = ["storage-proofs-porep/multicore-sdr"]