jitify icon indicating copy to clipboard operation
jitify copied to clipboard

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

Open FdyCN opened this issue 2 years ago • 3 comments

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 avatar May 04 '23 07:05 FdyCN

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

FdyCN avatar May 04 '23 09:05 FdyCN

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.

benbarsdell avatar May 21 '23 00:05 benbarsdell

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?

FdyCN avatar May 22 '23 08:05 FdyCN