Cannot enable hardware opengl R2021b Ubuntu 20.04
Ältere Kommentare anzeigen
I have a fresh install of Ubuntu 20.04 and matlab 2021b. My machnine has a mobile RTX 3060 gpu and an 11th gen intel processor (system76 gazelle laptop). I have the latest nvidia 470 driver installed. I cannot enable hardware opengl, when I start matlab using a terminal I see this text:
MATLAB is selecting SOFTWARE OPENGL rendering.
Gtk-Message: 16:41:13.106: Failed to load module "canberra-gtk-module"
MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load driver: iris
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load swrast driver
running "opengl info" in matlab returns this:
>> opengl info
Version: '2.1 Mesa 17.1.3'
Vendor: 'Brian Paul'
Renderer: 'Mesa X11'
MaxTextureSize: 16384
Visual: 'Visual 0x290, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceleration, Double buffer, Antialias 0 samples)'
Software: 'true'
HardwareSupportLevel: 'none (known graphics driver issues)'
SupportsGraphicsSmoothing: 0
SupportsDepthPeelTransparency: 1
SupportsAlignVertexCenters: 0
Extensions: {152×1 cell}
MaxFrameBufferSize: 16384
Matlab can see that I have a gpu and I can run gpu operations (ex gpuArray) and generally have no other problems with graphics or cuda. For reference running "gpuDevice" returns this:
>> gpuDevice
ans =
CUDADevice with properties:
Name: 'NVIDIA GeForce RTX 3060 Laptop GPU'
Index: 1
ComputeCapability: '8.6'
SupportsDouble: 1
DriverVersion: 11.4000
ToolkitVersion: 11
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 6.2354e+09
AvailableMemory: 5.9395e+09
MultiprocessorCount: 30
ClockRateKHz: 1425000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
The output of my nvidia-smi
Wed Oct 6 16:53:53 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.63.01 Driver Version: 470.63.01 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A |
| N/A 56C P8 14W / N/A | 282MiB / 5946MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1075 G /usr/lib/xorg/Xorg 4MiB |
| 0 N/A N/A 3836 G /usr/lib/xorg/Xorg 4MiB |
| 0 N/A N/A 34456 C ...R2021b/bin/glnxa64/MATLAB 269MiB |
+-----------------------------------------------------------------------------+
I attempted to force hardware opengl by running "opengl("save","hardware")" and restarting matlab. After doing that and trying "opengl info" again I see this output
opengl info
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.
Version: ''
Vendor: ''
Renderer: 'None'
RendererDriverVersion: ''
RendererDriverReleaseDate: ''
MaxTextureSize: 0
Visual: ''
Software: 0
HardwareSupportLevel: 'full'
SupportsGraphicsSmoothing: 0
SupportsDepthPeelTransparency: 0
SupportsAlignVertexCenters: 0
Extensions: {}
MaxFrameBufferSize: 0
com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x331d5547, isOwner false, <9a81ff0, 27b40220>[count 0, qsz 0, owner <NULL>]]]
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.jogamp.opengl.GLException: main-SharedResourceRunner: Unable to create temp OpenGL context(1)
at jogamp.opengl.x11.glx.X11GLXContext.createImpl(X11GLXContext.java:368)
at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:759)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:642)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:580)
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:297)
... 2 more
The "file" that the error message refers to contains this information:
com.jogamp.opengl.GLException: Profile GL_DEFAULT is not available on X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x331d5547, isOwner false, <9a81ff0, 27b40220>[count 0, qsz 0, owner <NULL>]]], but: []
at com.jogamp.opengl.GLProfile.get(GLProfile.java:990)
at com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:721)
at com.jogamp.opengl.GLCapabilities.<init>(GLCapabilities.java:84)
at com.mathworks.hg.uij.OpenGLUtils$MyGLListener.getGLInformation(OpenGLUtils.java:332)
at com.mathworks.hg.uij.OpenGLUtils$MyGLListener.getGLData(OpenGLUtils.java:512)
at com.mathworks.hg.uij.OpenGLUtils.getGLData(OpenGLUtils.java:79)
I have also tried 2020b with basically the same results. I am pretty stuck at trying to figure out what to do to fix this. Software opengl is incredibly slow and spins up my processor a lot
1 Kommentar
Mark Debord
am 7 Okt. 2021
Bearbeitet: Mark Debord
am 7 Okt. 2021
Akzeptierte Antwort
Weitere Antworten (1)
Michael
am 4 Sep. 2024
I came across this answer, since I had a similar problem. I did want to keep hybrid mode enabled, though, since fully running Ubuntu on the Nvidia GPU has caused some studdering issues with X11. I am running Ubuntu 24.04, an I9 13900K, and 3090 with the Nvidia 535 drivers. In "Nvidia X Server Settings" under "PRIME Profiles", it is set to "NVIDIA On-Demand". Running Matlab 2024a from the desktop shortcut caused similar issues as in this thread:
>> opengl info
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.
Version: ''
Vendor: ''
Renderer: 'None'
RendererDriverVersion: ''
RendererDriverReleaseDate: ''
MaxTextureSize: 0
Visual: ''
Software: 0
HardwareSupportLevel: 'full'
SupportsGraphicsSmoothing: 0
SupportsDepthPeelTransparency: 0
SupportsAlignVertexCenters: 0
Extensions: {}
MaxFrameBufferSize: 0
However, executing "prime-run matlab" from a terminal yielded the following and enabled graphics to render ok (at least workable):
>> opengl info
Version: '2.1 Mesa 17.1.3'
Vendor: 'Brian Paul'
Renderer: 'Mesa X11'
MaxTextureSize: 16384
Visual: 'Visual 0x20f, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceleration, Double buffer, Antialias 0 samples)'
Software: 'true'
HardwareSupportLevel: 'none (known graphics driver issues)'
SupportsGraphicsSmoothing: 0
SupportsDepthPeelTransparency: 1
SupportsAlignVertexCenters: 0
Extensions: {152×1 cell}
MaxFrameBufferSize: 16384
Kategorien
Mehr zu Graphics Performance finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!