CUDA Integration In UE4 NEXT STEP?

So i was successful in integrating the cuda static lib file in ue4 with the help of an article by http://www.sciement.com . I also asked a question there but no reply . So i just want to know , once i had made the static lib file and i am able to use cuda functions in my actor class in ue4 but where do i have to define the threads from this cuda function “global” . Do i have to define number of threads or write my logic ,then i have to make a static lib out of it and again integrate in ue4? or is there a easy way?

I’m afraid that link is of no value. Do you have a more direct download link? Where did you get this "cuda static lib file in ue4 ".

The thing about cuda is it takes a decent engineer to write cuda code. and get an actual advantage out of it.

If you give me more information I will attempt to integrate some basic cuda functionality for UE4 with you.

yeah sure http://www.sciement.com/tech-blog/c/cuda_in_ue4/ . I had tried cuda without ue4 but i was thinking about putting it in ue4. There is also a cool marching cube project these guys have done with the help of cuda in ue4

tx. I’ll pull it down and check it out. Do you have a link that is not in some multibyte asian codepage?

The global function gets launched from the CPU thread and at that time the GPU threads are set up. In this example with the size variable in the CPU code, which is passed in.

addKernel2 <<<1, size>>> (dev_c, dev_a, dev_b);

where size comes from function parameters:

cudaError_t addWithCuda(int *c, const int *a, const int b, unsigned int size, std::string error_message)

And the calling code passes in arraySize:

cudaError_t cuda_status = addWithCuda(c, a, b, arraySize, &error_message);

AS far as this example goes, yes. You have to edit the lib source code, RE-compile, RE-integrate, and rebuild unreal.

A better solution would be to go into the engine, and learn it how to generate and compile CUDA only modules. Then you could use the UnrealBuidTool to generate the new target type, kick off the cuda compiler, and turn the lib into a dll, (module), that can be used by other C++ modules.

And this is something I will be exploring this weekend if time permits.

I also have to do some time test . I need to see if CUDA is really making any changes , also i have learnt that for some code which is not that heavy its not making any difference . The big ones need to be optimized. Thanks for the reply though and if you found something do let me know . :slight_smile:

I have the loose VCXPRoj building and working. And yes the sample code, would be a waste of time to push to the GPU for more than just being an example. I also found a bug, maybe VS. But if you dont hit rebuild if you just hit build then it does not re-compile the Device Code. I’m currently setting up UE 4.19 preview to start integrating changes.