Giter Club home page Giter Club logo

Comments (6)

Shnatsel avatar Shnatsel commented on June 2, 2024

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.

cfkaran2 avatar cfkaran2 commented on June 2, 2024

@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.

Shnatsel avatar Shnatsel commented on June 2, 2024

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.

ronnychevalier avatar ronnychevalier commented on June 2, 2024

@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.

ronnychevalier avatar ronnychevalier commented on June 2, 2024

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.

ronnychevalier avatar ronnychevalier commented on June 2, 2024

I'm closing this one since I think everything has been answered, if not please reopen.

from cargo-multivers.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.