RustaCUDA icon indicating copy to clipboard operation
RustaCUDA copied to clipboard

How to run the example with add.cubin file?

Open VariniChiara opened this issue 4 years ago • 4 comments

I'm trying to run the example with the add.cubin kernel but it seems not to work.

I've tried "... let module_data = CString::new(include_str!("../add.cubin"))?; let module = Module::load_from_string(&module_data)?; ..."

but I got error: src/../add.cubin wasn't a utf-8 file

the I've tried "... let filename = CString::new("./sub.cubin")?; let module = Module::load_from_file(&filename)?; ..." but I got Error: InvalidSouce

VariniChiara avatar Mar 06 '20 16:03 VariniChiara

That's a fair point! I don't know, I've only ever used PTX files.

include_str! won't work with binary files. I always meant to create an include_cstr! macro if I could figure out how to implement it, but never got around to it.

Using load_from_file is probably the right way to go, but you'll need to make sure your path is correct. If you're using relative paths, then I think they'll be relative to the current working directory when you run the program.

bheisler avatar Mar 07 '20 14:03 bheisler

Unfortunately even the load_from_file() doesn't work even if I set the correct path, Is there a workaround?

VariniChiara avatar Mar 09 '20 17:03 VariniChiara

I'm successfully using load_from_file to load a fatbin. You can generate a fatbin by passing '-fatbin' to nvcc.

How are you compiling the binary?

LutzCle avatar Mar 10 '20 10:03 LutzCle

I'm successfully using load_from_file to load a fatbin. You can generate a fatbin by passing '-fatbin' to nvcc.

How are you compiling the binary?

I tried to use nvcc-fatbin add.cu to compile the file using load_from_fiile to load. Error NoBinaryForGpu
Can you directly load the CU file to call

taotaolin avatar Jun 25 '21 06:06 taotaolin