rust-opencl icon indicating copy to clipboard operation
rust-opencl copied to clipboard

Compiling with stable Rust

Open IT302 opened this issue 9 years ago • 5 comments

I am evaluating writing a project in Rust instead of C++. I am not sure if rust-opencl works with the stable Rust compilers. I have tried compiling rust-opencl with rustc 1.1.0 but I am getting "unstable feature" error.

Thanks,

Geoffrey

IT302 avatar Jun 27 '15 15:06 IT302

+1

[warezovvv@atlas rust-opencl]$ cargo build
   Compiling opencl v0.3.0-dev (file:///home/warezovvv/Documents/Work/Projects/Robotics/rust-opencl)
src/lib.rs:5:1: 5:22 error: unstable feature
src/lib.rs:5 #![feature(std_misc)]
             ^~~~~~~~~~~~~~~~~~~~~
note: this feature may not be used in the stable release channel
error: aborting due to previous error
Could not compile `opencl`.

To learn more, run the command again with --verbose.

krupitskas avatar Jul 17 '15 10:07 krupitskas

If you want to be more efficient you can install (from brew for example) multirust github, brew formula. Don't forget too uninstall rust previously, (multirust installation is really fast), it install cargo too With this formula you will be capable to use any version of rust you want in all your computer (default rust) and another version for the directories you want (override) (for example nightly version).

rust-opencl compile with nightly version (cf. 60d5956c9cbe32b422ea0d760a82a38515619ac6)

Kerollmops avatar Jul 24 '15 00:07 Kerollmops

I'd really like to see this in stable rust :)

Razican avatar Sep 16 '15 21:09 Razican

One thing holding this back right now is needing static mutexes. It looks like some OpenCL implementations do not properly handle multiple calls into the API, so we use a mutex to work around this. https://github.com/luqmana/rust-opencl/blob/282293c4babb41d87ad17bf0aee4e00112b95298/src/hl.rs#L134

It may be that OpenCL implementations are better now than when we added that code, or maybe we can just decide not to support broken implementations. I'm not sure whether calling clGetPlatformsIDs from multiple threads at once is in spec.

eholk avatar Sep 17 '15 13:09 eholk

I just started a branch that compiles on stable Rust: https://github.com/eholk/rust-opencl/tree/rust-stable

I removed the platform lock, so we'll need some testing and experimentation to see if that was safe. Also, I commented out the memory tests because they use slice_bytes. We should see if we can rewrite the tests not to use slice_bytes.

eholk avatar Sep 17 '15 13:09 eholk