Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Building CUDA (nvcc) code in UE4 Build System

Hi, so I have had no trouble building cuda static libraries in separate projects and then copying over the static library and headers into UE4 project and then linking it up. The directions in this link worked no problem: http://www.sciement.com/tech-blog/c/cuda_in_ue4/ (google translate)

Now I would like to instead include my cuda code directly into my plugin and build it with the rest of the system. I tried naively adding my code and adding the cuda build customizations to my project and flagging the CU kernel file as using cuda.

This results in several errors. Typical linking errors to unresolved symbols in the cuda object. Trying to clean results in new errors as well related to cuda.

I am sure my naive approach is missing much considering ue's build ecosystem. I am still learning the UE4 build system and any guidance would be appreciated. If I was in linux I could just script around this having decades of experience there but for Windows I feel woefully inadequate.

Ultimately, I am trying to avoid needing to open two separate .sln files and have two separate VS instances running when working, then having to build and copy the separate cuda static lib and headers. Instead I want to have one VS instance, click one build button and not manually copy things. Any guidance would be much appreciated.

I am guessing this is going to have to do with Build.cs, anyway to use the nvcc compiler for the cu file or something?

I looked at: https://answers.unrealengine.com/questions/411431/prepost-build-step-in-ubt.html https://answers.unrealengine.com/questions/844018/view.html but don't completely understand all this yet. Also, the whole can't add nvcc or cuda tags due to reputation is annoying.

Edit: Adding another thought here. Could I take my standalone vs project that is creating the static libraries currently and somehow import this into my UE4 project, then add like some pre-build instructions to compile and use this project?

Product Version: UE 4.18
more ▼

asked Dec 02 '18 at 06:16 PM in C++ Programming

avatar image

11 2 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I solved this ages ago for myself so I might as well post the answer. What I did in the end which worked a treat was create a project for my cuda code inside of the main UE4 solution I was working in. This project used the cuda compiler etc and compiled the libraries to some place relevant in my greater UE4 solution. I compiled the libraries and added them to my version control for convenience.

Then if someone else cloned my code, IF, they wanted to edit the cuda code all they needed to do was add the project.

more ▼

answered Feb 23 '19 at 05:33 PM

avatar image

11 2 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question