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: FFI_PORTABLE to build a maximally portable binary #480

Merged
merged 1 commit into from
Sep 11, 2024
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
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ rm .install-filcrypto \
; FFI_BUILD_FROM_SOURCE=1 FFI_USE_BLST_PORTABLE=1 make
```

Alternatively, to build a maximally portable binary without optimizing for the current CPU, set `FFI_PORTABLE=1`:

```shell
rm .install-filcrypto \
; make clean \
; FFI_BUILD_FROM_SOURCE=1 FFI_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`:

```shell
Expand All @@ -44,7 +52,7 @@ rm .install-filcrypto \

#### GPU support

CUDA for GPU support is now enabled by default in the proofs library. This feature can optionally be replaced by OpenCL by using `FFI_USE_OPENCL=1` set in the environment when building from source. Alternatively, if the CUDA toolkit (such as `nvcc`) cannot be located in the environment, OpenCL support is used instead. To disable GPU support entirely, set `FFI_USE_GPU=0` in the environment when building from source.
CUDA for GPU support is now enabled by default in the proofs library. This feature can optionally be replaced by OpenCL by using `FFI_USE_OPENCL=1` set in the environment when building from source. Using `FFI_PORTABLE=1` will also enable OpenCL support. Alternatively, if the CUDA toolkit (such as `nvcc`) cannot be located in the environment, OpenCL support is used instead. To disable GPU support entirely, set `FFI_USE_GPU=0` in the environment when building from source.

There is experimental support for faster C2 named "SupraSeal". To enable it, set `FFI_USE_CUDA_SUPRASEAL=1`. It's specific to CUDA and won't work with OpenCL.

Expand Down
9 changes: 7 additions & 2 deletions install-filcrypto
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ build_from_source() {
if [ "${FFI_USE_GPU}" == "0" ]; then
gpu_flags=""
# Check if OpenCL support is specified or we're building on Darwin.
elif [ "${FFI_USE_OPENCL}" == "1" ] || [ "$(uname -s)" = "Darwin" ]; then
elif [ "${FFI_USE_OPENCL}" == "1" ] || [ "${FFI_PORTABLE}" == "1" ] || [ "$(uname -s)" = "Darwin" ]; then
gpu_flags=",opencl"
else
# If GPUs are enabled and SupraSeal is not, default to CUDA support
Expand Down Expand Up @@ -226,7 +226,7 @@ build_from_source() {

additional_flags=""
# Add feature specific rust flags as needed here.
if [ "${FFI_USE_BLST_PORTABLE}" == "1" ]; then
if [ "${FFI_USE_BLST_PORTABLE}" == "1" ] || [ "${FFI_PORTABLE}" == "1" ]; then
additional_flags="${additional_flags} --no-default-features --features ${use_multicore_sdr},blst-portable${gpu_flags}${use_fixed_rows_to_discard}"
else
additional_flags="${additional_flags} --no-default-features --features ${use_multicore_sdr}${gpu_flags}${use_fixed_rows_to_discard}"
Expand All @@ -243,6 +243,11 @@ build_from_source() {
}

get_release_flags() {
if [ "${FFI_PORTABLE}" == "1" ]; then
echo ""
return
fi

local __features=""

# determine where to look for CPU features
Expand Down
Loading