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

[Help]How to include <cuda_fp16.h> in jitify? #116

Open
FdyCN opened this issue May 4, 2023 · 3 comments
Open

[Help]How to include <cuda_fp16.h> in jitify? #116

FdyCN opened this issue May 4, 2023 · 3 comments

Comments

@FdyCN
Copy link

FdyCN commented May 4, 2023

I tried to include in my kernel string like: "#include <cuda_fp16.h>" or make a header named "JITFP16.cuh" and pass into jitify::Program::program() functions. can't work.

so how can i include these standard header like cuda_fp16.h ???

Please help!

@FdyCN
Copy link
Author

FdyCN commented May 4, 2023

i know it can be added in this way:

jitify::Program program = kernel_cache.program(
      program1,                          // Code string specified above
      {example_headers_my_header1_cuh},  // Code string generated by stringify
      {"--use_fast_math", "-I" ${where cuda_fp16.h is}}, file_callback);

howerver, i want to include in "my_header.cuh" because i need to add some operator overloading in my_header.cuh
but when i add like this:

#pragma once
// JITFP16_cuh.cuh
const char *const JITFP16_cuh =
    "JITFP16.cuh\n"
    "#pragma once\n"
    "#include \"cuda_fp16.h\"\n"
    "..... some codes";

// called in jitify:
jitify::Program program = kernel_cache.program(
      program1,                          // Code string specified above
      {JITFP16_cuh},  // Code string generated by stringify
      {"--use_fast_math", "-I" ${where cuda_fp16.h is}}, file_callback);

it will come this error :

my_program(2): warning: cuda_fp16.h: [jitify] File not found
---------------------------------------------------
--- JIT compile log for my_program ---
---------------------------------------------------
JITFP16.cuh(4): error: identifier "half" is undefined
JITFP16.cuh(5): error: identifier "half" is undefined
JITFP16.cuh(6): error: identifier "half" is undefined
JITFP16.cuh(7): error: identifier "half" is undefined
JITFP16.cuh(9): error: identifier "half" is undefined
JITFP16.cuh(9): error: identifier "half" is undefined

i don't know how to include in my header and include my header when creating jitify program??or it's impossible?

Please take a look, thanks so much. @benbarsdell

@benbarsdell
Copy link
Member

I think this should work, as long as the -I option has the correct path (e.g., "/usr/local/cuda/include"). If it's still not working for you, could you provide a full reproducer for me to try out.

@FdyCN
Copy link
Author

FdyCN commented May 22, 2023

I think this should work, as long as the -I option has the correct path (e.g., "/usr/local/cuda/include"). If it's still not working for you, could you provide a full reproducer for me to try out.

i found out the reason. when i add a space before I like this: " -I", then it works. Without the space like "-I", it will be wrong.

@benbarsdell thank you for your reply. BTW, Is jitify still on updating?

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

2 participants