I just created a fresh install of Ubuntu 1804 with Cuda 10.1 from the local runfile installation. I also let it bring in the desired driver that comes with the CUDA installation. I did not get any errors from the installation.
I then started to try out the Nvidia sample code that installed right off of my home directory. I typed the “make” command right off of the root directory. All of the examples compiled except for “2_Graphics/marchingCubes”.
It would not compile with this message:
make: Entering directory ‘/home/devmachine/NVIDIA_CUDA-10.1_Samples/2_Graphics/marchingCubes’
/usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o marchingCubes marchingCubes.o marchingCubes_kernel.o -lGL -lGLU -lglut
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
Makefile:314: recipe for target ‘marchingCubes’ failed
make: *** [marchingCubes] Error 1
make: Leaving directory ‘/home/devmachine/NVIDIA_CUDA-10.1_Samples/2_Graphics/marchingCubes’
Makefile:51: recipe for target ‘2_Graphics/marchingCubes/Makefile.ph_build’ failed
make: *** [2_Graphics/marchingCubes/Makefile.ph_build] Error 2
I notice the line “/usr/bin/ld: cannot find -lGL”. I thought this was strange considering OpenGL should come installed when I install CUDA and the correct graphics driver.
I then found that I can check to see what version of OpenGL I am using from the command “glxinfo | grep “OpenGL version””.
On my machine that is not working, I get this output:
OpenGL version string: 3.0 Mesa 19.0.8
I thought that is strange since I am supposed to be using Nvidia drivers.
I tried this on a machine with different problems (but OpenGL did not appear to be one of them) and it gave me this output:
OpenGL version string: 4.6.0 NVIDIA 410.48
This started me wondering: what is different? Well, the driver 410 corresponds with CUDA 10.0, but I do not think a slightly different version of CUDA and driver should prevent OpenGL from loading.
I then had the idea to try installing the CUDA 10.1 revision 1 installer (10.1.168 I believe) since I don’t know what else to install.
I installed 10.1 revision 1 without a hitch. I am now able to compile all of the CUDA examples. I go tro try the same Cuba example and now I get this error:
[./marchingCubes] - Starting…
GPU Device 0: “GeForce GTX 1050 Ti” with compute capability 6.1
grid: 32 x 32 x 32 = 32768 voxels
max verts = 102400
Read ‘./data/Bucky.raw’, 32768 bytes
CUDA error at marchingCubes.cpp:485 code=999(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&cuda_posvbo_resource, posVbo, cudaGraphicsMapFlagsWriteDiscard)”
I am not sure exactly what this means since the error literally says “cudaErrorUnknown”.
In fact, whenever I try to run any of the Cuda examples, I get just about the exact same error message, save for the executable name and the extra info sent to “std::cout” before the graphics loading happens.
I have been trying to run code from this git repository that focuses on OpenGL
and all of the code compiles, but when I try to run the code, I get the same error:
“Unable to create OpenGL context.”
I have been looking around on the internet, and it looks like I need to just change from the Mesa OpenGL loader to the Nvidia loader OpenGL loader. The question is:
How do I switch to the Nvidia OpenGL loader?
I am happy to provide more information on the issue if necessary.
I ran the command
startx – -logverbose 6
because the Nvidia post mentions this. This command crashes with this output:
startx – -logverbose 6
xauth: file /home/devmachine/.Xauthority does not exist
/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Couldn’t get a file descriptor referring to the console
This is starting to look like an Xorg issue too, but I am not sure what to focus on.
I have also created a log by running
So hopefully that helps.
Oh, and one more thing: when I try to go to Nvidia x settings from the GUI, the option shows up, but when I click it, nothing happens.
All of the errors I experienced above were when I was logged into a regular GUI.
I also have provided the nvidia-installer.log file to help out.