widgg
widgg

Reputation: 1428

adding functions in a CUDA program

So, I think I have a very weird question.

So, let say that I already have a program put on my GPU and in that program I call a function X. But that function X is not declared yet.

I want to be able, dynamically, to modify that function X, by completely changing the code and put it in the program without recompiling the rest or losing any pointers whatsoever.

To compare it with something that most of us know, I want to be able to do like the shaders in OpenGL. In the middle of the execution, I can change the code of one shader, only recompile that shader, activate the program and now I used this one.

So, is it possible. Or do I need to recompile the whole thing all the time. And if I have to recompile, do I lose the various arrays that I created in global memory ?

Thanks

W

Upvotes: 0

Views: 183

Answers (1)

Patrick87
Patrick87

Reputation: 28302

If you compile with the -cuda flag using nvcc, you can get the intermediate C++ source that streams PTX to the processor. In theory, you could post-process this intermediate output to dynamically generate PTX on the fly and send it over. You might even be able to have PTX be self modifying, but that's way out of my league.

Upvotes: 1

Related Questions