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

Configure cargo to use -Ctarget-cpu=native #432

Closed
wants to merge 1 commit into from
Closed

Conversation

rj00a
Copy link
Member

@rj00a rj00a commented Aug 2, 2023

Objective

Tell rustc to use native CPU features when building the project. Especially useful for the benchmarks.

Solution

Add a .cargo/config.toml with the following contents:

[build]
rustflags = ["-Ctarget-cpu=native"]

@dyc3
Copy link
Collaborator

dyc3 commented Aug 2, 2023

This makes it so that built binaries can possibly be not portable. Eg. you build a docker image on your dev machine, and you try to run it on a CPU that doesn't have all the features your dev machine has, it will crash and burn.

@rj00a
Copy link
Member Author

rj00a commented Aug 2, 2023

True, but I didn't think it would matter since the config only applies to those building valence from the repo AFAIK. But I can still see that coming back to bite us.

@rj00a rj00a closed this Aug 2, 2023
@rj00a rj00a deleted the target-cpu-native branch August 6, 2023 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants