Skip to content
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 run the example with add.cubin file? #47

Open
VariniChiara opened this issue Mar 6, 2020 · 4 comments
Open

How to run the example with add.cubin file? #47

VariniChiara opened this issue Mar 6, 2020 · 4 comments

Comments

@VariniChiara
Copy link

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

@bheisler
Copy link
Owner

bheisler commented Mar 7, 2020

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.

@VariniChiara
Copy link
Author

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

@LutzCle
Copy link
Contributor

LutzCle commented Mar 10, 2020

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?

@taotaolin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants