How could i start learning for Optix6 with Windows CUDA10.1?

I read a lot of official sample programs and successfully migrated the project to the windows system using Cmake, but I don’t know how to start creating my own project to learn the Optix engine.
Because it will always appear various errors and unrecognized functions. After I have prepared the header files and reference libraries, I still cannot use Optix correctly.
I am anxious to ask the developers. Are there good manuals and learning materials for Windows, which can quickly enter the process of learning to write code like cuda. Anxiously looking forward to receiving a reply from senior engineers, thank you!

Hi qrb195217, welcome!

In my opinion, the easiest way to learn OptiX is to duplicate one of the SDK samples, and modify it heavily. That way you start from something that works and you don’t have to struggle with setting up the build system part of it.

What are the errors and unrecognized functions you mentioned? Are you getting errors building the samples, or are you trying to make an OptiX project without using Cmake, or structuring it very differently from the samples?

I would recommend if you’re new to OptiX that you start with OptiX 7. It’s just as easy to modify OptiX 7 sample programs, and OptiX 7 is newer and more flexible.

Either way, here are some resources to help you learn:

OptiX 7:

https://devblogs.nvidia.com/how-to-get-started-with-optix-7/
https://gitlab.com/ingowald/optix7course
https://raytracing-docs.nvidia.com/optix7/index.html
https://developer.nvidia.com/siggraph/2019/video/sig911-vid
https://developer.nvidia.com/siggraph/2019/video/sig915-vid

OptiX 6:

https://raytracing-docs.nvidia.com/optix6/index.html
https://github.com/nvpro-samples/optix_advanced_samples

These links can also be found in the pinned messages at the top of the OptiX forum as well as by going to the bottom of the OptiX home page https://developer.nvidia.com/optix and clicking the “documentation” link near the bottom.


David.

First of all, thank you for your reply. Both versions are installed on my current computer.
The problem I am experiencing now is not that I cannot run the official sample program, I can run the sample program and see the correct effect.
I would like to ask your question: I want to create a new VS project like a CUDA program, add some library directories, and then I can start writing correct RT code that can be compiled. However, the environment of OptiX is relatively complicated and there is no learning method used in windows. Is there a detailed study manual for using OptiX under Windows?
Thank you again, and we look forward to hearing from you!

We don’t really have any Windows specific guides for setting up a new OptiX project in Visual Studio from scratch. It’s a good idea, but because your project structure depends almost entirely on what 3rd party dependencies you want, it might be hard for us to make something useful to many people that is different from the Cmake examples we already provide.

The OptiX dependencies are very simple: include the OptiX header file. As far as OptiX is concerned, that’s all there is, the driver automatically provides the rest. All of the complexity in our Cmake setup is to handle compiling CUDA files, manage the SDK project structure, and include 3rd party dependencies. None of those things are required for a brand new Windows project, but you will need to decide how to compile your OptiX CUDA programs.

Maybe it could help to check out resources for setting up projects using the CUDA toolkit, to understand the toolchain and how to use NVCC. For example:

https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#build-customizations

https://stackoverflow.com/a/53209411/1424242

Unless you need to start developing a new application that you’re going to ship to customers, I would still recommend learning OptiX and the OptiX build process by duplicating samples inside the Cmake SDK framework. It’s easy to add a new “sample” program if you modify the sample/CMakeLists.txt file, and all the dependencies and the Visual Studio project are then taken care of.


David.

I understand what you mean.
I have particularly strange file dependencies in Samples in Cmake, and I use OpenGL to show the results.
Then I just need to build a new project to do this procedure.
For example, in the include directory under the VS2017 environment, I used the following include files:include files:

C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\include;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;
C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\SDK\support\freeglut\include;
$(ProjectDir)

My library directory is:
C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\lib64;
C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\SDK\support\freeglut\win64\Release;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64;

Just like the Sample program, I also use OpenGL to display the results, so I used the header file“C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\SDK\sutil”.

What I want to say is that all the header file references are no longer reported as errors, but they were not recognized when compiling the OptiX CUDA file. A simple plain-color hello code has as many as 55 errors, all here.

Thank you for your reply. I really find it difficult to write a new project from Cmake, and version 7 is more complicated than the Samples program in version 6, and some of the files I rely on do n’t understand what the function is, so I ’m learning and using All need to create new engineering projects separately! In your experience, where does this problem lie?

It is legitimately difficult to create new projects, and build systems in general seem to always be complicated and painful, that’s the main thing I’ve learned over the years.

The OptiX sutil library could be part of the problem you’re seeing. Generally speaking, you might not want to use our sutil library for a new project if you don’t also want to use our Cmake infrastructure. The goal is to make sure you understand the dependencies for every line of code you’re using, and if you borrow from the SDK samples, and that code borrows from sutil, then you have a transitive dependency on sutil that is going to be difficult to understand how to build outside our Cmake examples.

I believe the main problem lies in code re-use: the tension between wanting to get something up and running in a reasonable amount of time and also, in your case, needing to understand all the transitive dependencies. It will take longer to start from true scratch and write/build your own version of sutil along the way, but it will also be easier to control the build system and dependencies that way.


David.

Thank you very much for your previous answer, it has helped me a lot!
Now, I downloaded a helloword program under OptiX written by a blogger. The content and method of this program are almost the same as Helloword in Samples.
So I deployed all the required environment and header files under windows2017. This time I finally compiled and passed, but when running I was prompted that I didn’t find the file optix.6.0.0.dll. I can only go to Copy the helloworld related dlls under the official Samples. At this time, it continues to prompt that there are no other dll files. Finally, I can only run a colored image when I copy all the dlls in the official helloworld to my project directory.
But in the subsequent projects, I need to use other calculations and functions. I do n’t know if those dll files will be missing and doing so is not the final solution. So I want to ask the engineer why this compile Passed, but what about missing dll files when running?

DLLs can be a little tricky to manage. So if you’re creating an application outside of the OptiX SDK then it becomes your responsibility to put the DLLs that the application needs somewhere that the application can access, and then also have the application tell the system where to find the DLLs. Copying the DLLs you need so that they’re in the same folder as your executable is one way, as you discovered. Microsoft has documentation on how you can control where an application looks for DLLs: https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

I’ll put in another plug for OptiX 7 – with OptiX 7 there are no OptiX DLLs to manage because they are inside the driver, so that’s one less complication you have to deal with as an application developer.


David.

Thank you for your reply.
I just remember that when I write cuda or other C # programs in the VS2017 platform, some lib and dll files are automatically generated when I compile and run. I don’t need to find them myself. In other words: In the future, I will create a new OptiX project written program under VS2017. I may need to go to the OptiX SDK folder and find the relevant dlls in the project directory, right?

Are you there?

Hi, yes, still here! The answer to your question is that you get to choose how to handle DLLs when you make a brand new application. You can choose to package the OptiX DLLs with your application, bundle them internally, and have the application find them inside your application’s bundle and/or project structure. You can also make it a pre-requisite that any user who builds or runs your application has the OptiX SDK installed, and you can set your application to find the OptiX DLLs under the OptiX SDK folder. You can always manually copy the DLLs as needed, but that is something you should only do for testing, not as a permanent method of running or distributing your application.


David.