-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a flag to make lighthouse portable across machines (#1423)
## Issue Addressed Closes #1395 ## Proposed Changes * Add a feature to `lighthouse` and `lcli` called `portable` which enables the `portable` feature on our fork of BLST. This feature turns off the `-march=native` C compiler flag that produces binaries highly targeted to the host CPU's instruction set. * Tweak the `Makefile` so that when the `PORTABLE` environment variable is set to `true`, it compiles with this feature. * Temporarily enable `PORTABLE=true` in the Docker build so that the image on Docker Hub is portable. Eventually I think we should enable `PORTABLE=true` _only on Docker Hub_, so that users building locally can take advantage of the tasty compiler magic. This seems to be possible by setting a Docker Hub environment variable: https://docs.docker.com/docker-hub/builds/#environment-variables-for-builds ## Additional Info Tested by compiling on a very new CPU (Intel Core i7-8550U) and copying the binary to a very old CPU (Intel Core i3 530). Before the portability fix, this produced the SIGILL crash described in #1395, and after the fix, it worked smoothly. I'm in the process of testing the Docker build and running some benches to confirm that the performance penalty isn't too severe.
- Loading branch information
1 parent
2ede9ca
commit 7d8acc2
Showing
8 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
# Build hook to run on Docker Hub to ensure that the image is built with `PORTABLE=true`. | ||
docker build --build-arg PORTABLE=true -f $DOCKERFILE_PATH -t $IMAGE_NAME . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,11 @@ version = "0.2.0" | |
authors = ["Paul Hauner <[email protected]>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[features] | ||
portable = ["bls/supranational-portable"] | ||
|
||
[dependencies] | ||
bls = { path = "../crypto/bls" } | ||
clap = "2.33.0" | ||
hex = "0.4.2" | ||
log = "0.4.8" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,18 @@ authors = ["Sigma Prime <[email protected]>"] | |
edition = "2018" | ||
|
||
[features] | ||
write_ssz_files = ["beacon_node/write_ssz_files"] # Writes debugging .ssz files to /tmp during block processing. | ||
# Writes debugging .ssz files to /tmp during block processing. | ||
write_ssz_files = ["beacon_node/write_ssz_files"] | ||
# Compiles the BLS crypto code so that the binary is portable across machines. | ||
portable = ["bls/supranational-portable"] | ||
|
||
[dependencies] | ||
beacon_node = { "path" = "../beacon_node" } | ||
tokio = "0.2.21" | ||
slog = { version = "2.5.2", features = ["max_level_trace"] } | ||
sloggers = "1.0.0" | ||
types = { "path" = "../consensus/types" } | ||
bls = { path = "../crypto/bls" } | ||
clap = "2.33.0" | ||
env_logger = "0.7.1" | ||
logging = { path = "../common/logging" } | ||
|