Comments (6)
There is no need for cargo multivers
when using it for development. RUSTFLAGS=-Ctarget-cpu=native cargo test
will be as fast as cargo multivers
or even slightly faster. It will also result in much faster build times than cargo multivers
.
from cargo-multivers.
@Shnatsel Is there a section in the docs that state that explicitly? I'm reading https://doc.rust-lang.org/rustc/codegen-options/index.html#target-cpu and https://doc.rust-lang.org/rustc/codegen-options/index.html#target-feature, and while the former does mention the native
target, I don't see anything that states it will automatically active all of the features of the native
target. Is that implied, or am I just misunderstanding what the docs are saying?
Put another way, I'm not sure if the native
target will activate the features on my CPU, or if it will go for the intersection of the features of all CPUs with similar architectures.
from cargo-multivers.
native
not only activates all features of your CPU specifically, but also uses the instruction cost model for your CPU for instruction selection. cargo multivers
uses a generic cost model instead, resulting in slightly lower performance than -Ctarget-cpu=native
.
See https://rust-lang.github.io/packed_simd/perf-guide/target-feature/rustflags.html for documentation on this.
from cargo-multivers.
@cfkaran2 I just released the version 0.7.0, it contains small fixes so that cargo multivers
can build tests or benchmarks, not only binaries anymore. However, it does not work directly with other commands like cargo criterion
, you need to call cargo multivers -- --bench mybenchmark
for instance to build a benchmark called mybenchmark
.
I don't think we should improve more than that the support of such use cases.
But as mentioned by @Shnatsel, if you really want to run tests or benchmarks on your machine with optimizations made specifically for you CPU, you should use RUSTFLAGS=-Ctarget-cpu=native
directly, and do not use cargo multivers
. The idea behind cargo multivers
is to build a binary that can be distributed to users with different microarchitecture, but if you only have one microarchitecture to target, there is no need to build your projects for N different microarchitectures.
I hope it answers your question, and if it does feel free to close this issue!
from cargo-multivers.
For future reference, I added a small paragraph to remind people that -Ctarget-cpu=native
can be used instead of cargo multivers
when they only want to optimize for their CPU.
from cargo-multivers.
I'm closing this one since I think everything has been answered, if not please reopen.
from cargo-multivers.
Related Issues (7)
- Add a friendly error message when rustc --print target-cpus is not supported
- 10x higher startup time if debug info is not stripped HOT 8
- cargo multivers not working properly HOT 2
- Define good defaults to limit build times
- Difficult/confusing to use -Zbuild-std with cargo-multivers HOT 13
- Integration with cargo-chef
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-multivers.