C/C++ Ask

Help me please.

I have some cuda_kernel, where are such code:

__global__ void integral_kernel ( float * result_array )


 // ...

 func_value = x*y;


I need to change x*y on function that user typed.

How do I do it?


That’s not a trivial problem, as C/C++ is a static language which only parse your expression at compile time. But there is some technique for that. Just look into the key word “expression template”. I believe that’s what you want. However, it takes advantage the advanced template features of C++, not sure the current CUDA 4.0 supports them.