-
Notifications
You must be signed in to change notification settings - Fork 74
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
How to create an ocl::Program with binary files? #99
Comments
You've got the right idea... I added Example usage would be: let program = Program::builder()
.devices(device)
.binaries(binary)
.build(context)?; I'm not sure whether the method should be called The changes are on master. There are also a significant number of changes to I'd really appreciate if you could test the changes, particularly |
Thank you, these changes look great! I have to admit I am very new to OpenCL so my feedback might not be too useful. The reason I need precompiled binaries is for an Intel FPGA: https://www.altera.com/documentation/mwh1391807965224.html#ewa1411489297252 I'm in university and doing a capstone project with the FPGA and OpenCL, so can only test on the Cyclone V dev board (Dual core ARM A9 with FPGA) when I'm in the lab. I spent most of my time today getting the cross compiler working (fun times...) and have gotten the host application to start and load the binaries! I'm running into a problem with Intel's tools right now (I think I have Intel's offline compiler configured wrong) so I haven't gotten the
For the intel fpga stuff it is just a single binary file edit: now that I think about it, Here's how I'm currently calling it: let mut aocx = Vec::new();
let binary_file = File::open(binary_filename).expect("couldn't open file");
let mut buf_reader = BufReader::new(binary_file);
buf_reader.read_to_end(&mut aocx).expect("unable to read file");
// ...
let program = Program::builder()
.devices(device)
.binaries(&[&aocx])
.build(&context)
.expect("program setup failed"); |
Sounds interesting. Let me know if I can be of any help in the Rust or OpenCL department. I'm happy to answer any questions or have ideas bounced off of. |
I'll close this issue for now. Comment here or in the ocl gitter channel. |
Heh, thanks :) |
Hi, I'm trying to migrate some c++ opencl code to Rust and need to be able to create the
Program
with binary files.I found the function
create_program_with_binary
but it usesocl_core::Program
. I thought it would be possible to convert it to aocl::Program
by doing:But this gives a somewhat cryptic error:
The only thing I could find on the error is this issue: rust-lang/rust#42944
Because the tuple struct (?) is private I can't make a
Program
from aProgramCore
.I'm currently using a workaround (compiles, but untested) by making a local copy of the crate and implementing
From
for ProgramCore in the file:ocl/src/standard/program.rs
and then in my code:
I guess I'm asking if there is a better way to do this that I missed? Or maybe I didn't import the correct crates/modules hence the 'private' problem?
If not, I can make a pull request to add this in? I'm still a bit new to rust and opencl, so I'm not sure if using a trait like
From
is appropriate here.Thanks for your help!
The text was updated successfully, but these errors were encountered: