Optix 6.0.0 build error with VS2017 + CUDA 10.0

I’m have trouble building the advanced samples of Optix 6.0.0.

I have Windows10 with Vs 2017 Community, CUDA 10 (driver 418.91) and a RTX 2080Ti.

The problem is very similar to the one in thread https://devtalk.nvidia.com/default/topic/1015365/optix/building-the-optix-sample-project/

however my system should satisfy the requirements.

The build output is as below

1>------ Build started: Project: sutil_sdk, Configuration: Release x64 ------
1>Building NVCC ptx file lib/ptx/cuda_compile_ptx_generated_phong.cu.ptx
1>CMake Error at cuda_compile_ptx_generated_phong.cu.ptx.cmake:245 (message):
1>  Error generating
1>  C:/Users/xxx/Optix-PathTracer/build/lib/ptx/cuda_compile_ptx_generated_phong.cu.ptx
1>
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code 1.
1>Done building project "sutil_sdk.vcxproj" -- FAILED.

And the custom build block is as follows, I have no idea how should I investigate the problem, any tips?

<Target Name="CustomBuild"
          Condition="'@(CustomBuild)' != ''"
          DependsOnTargets="SelectCustomBuild;ComputeCustomBuildOutput"
          BeforeTargets="$(CustomBuildToolBeforeTargets)"
          AfterTargets="$(CustomBuildToolAfterTargets)"
          >

    <PropertyGroup>
      <CustomBuildToolArchitecture Condition="'$(CustomBuildToolArchitecture)' == ''">Native32Bit</CustomBuildToolArchitecture>
    </PropertyGroup>

    <!-- see if items were requested to build in parallel (ignored for selected files build)-->
    <ItemGroup Condition="'$(SelectedFiles)' == ''">
      <_ItemsToBuildInParallel Include="@(CustomBuild)" Condition="'%(CustomBuild.BuildInParallel)' == 'true'" />
    </ItemGroup>

    <GetOutOfDateItems
      Condition                 ="'$(SelectedFiles)' == ''"
      Sources                   ="@(_ItemsToBuildInParallel)"
      OutputsMetadataName       ="Outputs"
      DependenciesMetadataName  ="AdditionalInputs"
      CommandMetadataName       ="Command"
      TLogDirectory             ="$(TLogLocation)"
      TLogNamePrefix            ="ParallelCustomBuild"
      CheckForInterdependencies ="true"
      >
      <Output TaskParameter="OutOfDateSources" ItemName="_ParallelCustomBuild"/>
      <Output TaskParameter="HasInterdependencies" PropertyName="_HasInterdependencies"/>
    </GetOutOfDateItems>

    <ParallelCustomBuild
      Condition       ="'@(_ParallelCustomBuild)' != ''"
      Sources         ="@(_ParallelCustomBuild)"
      MaxProcesses    ="%(_ParallelCustomBuild.MaxProcesses)"
      MaxItemsInBatch ="%(_ParallelCustomBuild.MaxItemsInBatch)"
    />

    <ItemGroup Condition="'@(_ItemsToBuildInParallel)' != ''">
      <!-- if some custol build items have dependencies on other items outputs, we will build them all sequentially -->
      <CustomBuild Remove="@(_ItemsToBuildInParallel)" Condition="'$(_HasInterdependencies)' != 'true'" />
      <_ItemsToBuildInParallel Remove="@(_ItemsToBuildInParallel)" />
      <_ParallelCustomBuild Remove="@(_ParallelCustomBuild)" />
    </ItemGroup>

    <CustomBuild
      Sources                     ="@(CustomBuild)"
      BuildSuffix                 ="$(_BuildSuffix)"

      TrackerLogDirectory         ="%(CustomBuild.TrackerLogDirectory)"
      MinimalRebuildFromTracking  ="%(CustomBuild.MinimalRebuildFromTracking)"

      TLogReadFiles               ="@(CustomBuildTLogReadFiles)"
      TLogWriteFiles              ="@(CustomBuildTLogWriteFiles)"
      TrackFileAccess             ="$(TrackFileAccess)"
      ToolArchitecture            ="$(CustomBuildToolArchitecture)"
      TrackerFrameworkPath        ="$(CustomBuildTrackerFrameworkPath)"
      TrackerSdkPath              ="$(CustomBuildTrackerSdkPath)"

      AcceptableNonZeroExitCodes  ="%(CustomBuild.AcceptableNonZeroExitCodes)"
      >
    </CustomBuild> 
  </Target>

Thanks in advance.

You need to explicitly set the CUDA_HOST_COMPILER inside the CMake GUI with MSVS 2017.
See this thread a the bottom:
https://devtalk.nvidia.com/default/topic/1048819/optix/hdr-denoising-variable-has-no-effect/

Make sure to always pick the “Win64” compiler versions in the CMake GUI.

Thanks for the solution! I think I’m close to successfully running the program but there are still problems.

When I run the program, it crashed and gave error:

GLFW Error 65542: WGL: The driver does not appear to support OpenGL
OptiX Error: 'GLFW window or GL context creation failed.'

I’ve ran into a similar error before but that was because of the hardware incompatibility.

Unlike stated before, I’m using a GTX 980Ti now, so I’m not sure if this is caused by the poor GPU…

Have you ever ran into this before? (I think I’d better not start a new thread…)

A GTX 980Ti is a Maxwell board which is supported by OptiX 6.0.0.
You need at least 418.81 to support OptiX 6.0.0 under Windows 10.

The error “WGL: The driver does not appear to support OpenGL” should not happen if you run on a local system with a properly installed NVIDIA display driver.
Do you connect via remote desktop?
That won’t support hardware OpenGL on a GeForce board. Run the executable locally on the system or use VNC.

Mind that the OptiX Advanced Samples are written against OptiX 5.1.0 and do not use the GeometryTriangles added in OptiX 6.0.0 to make use of the hardware triangle intersection of the RT cores on RTX boards.
Means once they run on your GTX 2080Ti, they could get even faster after some changes.

Thanks for the reply!
I’m using 418.96 and CUDA 10.0, on my Windows 10. No I’m not connecting via remote desktop…

So the thing is I use a 980Ti at home, so I haven’t tested on my working desktop with 2080Ti but I think that shouldn’t make a difference since Optix support Maxwell architecture.

EDIT
I just found my OpenGL version dropped to 1.1, and I think this is the reason. I suppose this is caused by my reinstalling the driver…

My concerns are:

  1. When I generate solution files using CMake, some of the entries related with GLFW and CUDA seems to be not checked and I don’t know if that is important. Here’s a screenshot

https://imgur.com/y9s41Hp

  1. I installed different versions of display driver and CUDA many times before, due to other applications, and I don’t know if this would cause some problems.

Again there’s a screenshot of what I have on my machine… https://imgur.com/RmQKdsB

  1. Windows 10 version and Windows SDK version… Do they have particular requirements?

If all the above are not the reason of crash, do you have any other advice to debug this?

Many thanks!

The CMake settings look fine.

Since your main problem is that GLFW can’t initialize OpenGL on your system, OptiX isn’t even involved at that point.
If you say OpenGL and GLFW applications are otherwise running fine on your system, have you used the same GLFW version for the OptiX examples?
Can you build the everything including GLFW as debug version and simply step into glfwInit() to see what exactly it complains about and then repeat the same thing in another GLFW program?

It’s straightforward to remove any OptiX usage from the first of my OptiX Introduction samples and make it an empty GLFW shell with just init and terminate calls.
Just comment out everything from g_app = new Application(); to delete g_app;

If that doesn’t work then I don’t know. You’re either not using the correct GLFW 64-bit libraries or have a screwed up system installation.

I’m using just the original GLFW 3.2.1 https://www.glfw.org/ and DevIL 1.8.0 http://openil.sourceforge.net/ versions.

I’m unable to reproduce such OpenGL error on my system and don’t know why that could happen on yours. I’m currently running 419.17 display drivers on a Quadro RTX 6000 though.

Maybe try to deinstall your current display driver via “Add or Remove Programs”, reboot, then install the 419.17 by using the “Custom” path in the NVIDIA installer and select “Clean Install”. (That’s what I’m always doing.)

Reinstalling the driver and CUDA solved the problem. Thank you!