Passing structs to CUDA kernels

前端 未结 2 1403
孤独总比滥情好
孤独总比滥情好 2021-02-19 02:35

I\'m new to CUDA C, and am trying to pass a typedef\'d struct into a kernel. My method worked fine when I tried it with a struct containing only ints, but when I switch to float

2条回答
  •  旧时难觅i
    2021-02-19 03:11

    Have a look at how it's done in the vector_types.h header that comes in your CUDA include directory. That should already give you some pointers.

    However, the main problem here is the %d in your printf calls. You're trying to print floats now, not integers. So those really should use %f instead.

提交回复
热议问题