Pvbatch/pvpython can't find valid OpenGL context, while ParaView GUI can
On a Linux 3.10.0 compute node with two Tesla K40m's, with an X server running:
paulm@gcn4 17:07 ~$ nvidia-smi
Tue Jun 25 17:07:31 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.39 Driver Version: 418.39 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla K40m On | 00000000:02:00.0 Off | 0 |
| N/A 32C P8 19W / 235W | 6MiB / 11441MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 1 Tesla K40m On | 00000000:82:00.0 Off | 0 |
| N/A 27C P8 19W / 235W | 6MiB / 11441MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 54980 G /usr/bin/X 5MiB |
| 1 54980 G /usr/bin/X 5MiB |
+-----------------------------------------------------------------------------+
paulm@gcn4 17:07 ~$ DISPLAY=:0.0 glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Tesla K40m/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 418.39
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 418.39
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 418.39
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Tesla K40m/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 418.39
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 418.39
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 418.39
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
With ParaView 5.6.0 compiled against real NVIDIA OpenGL (i.e. not Mesa). If I run the ParaView GUI directly on the X server it seems to work (can't check as it's a headless node). Glxgears also reports good framerates, so I assume the OpenGL drivers and access through X are working (if I use the same node through VNC and VirtualGL all is fine with the ParaView GUI and its rendering, same for Blender, etc):
paulm@gcn4 17:09 ~$ DISPLAY=:0.0 paraview
<no errors>...
paulm@gcn4 17:08 ~$ DISPLAY=:0.0 glxgears
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
73762 frames in 5.0 seconds = 14752.353 FPS
74113 frames in 5.0 seconds = 14822.405 FPS
However, using pvpython and pvbatch fail to allocate an OpenGL context:
paulm@gcn4 17:11 ~$ cat pvbatch_test.py
from paraview.simple import *
cone = Cone(Resolution=32)
cone.Center = [1, 2, 3]
shrinkFilter = Shrink(cone)
shrinkFilter.UpdatePipeline()
Show(shrinkFilter)
Render()
WriteImage('test2.png')
paulm@gcn4 17:11 ~$ DISPLAY=:0.0 pvbatch pvbatch_test.py > out 2>&1
Aborted (core dumped)
paulm@gcn4 17:11 ~$ cat out
ERROR: In /tmp/pma55/ParaView/5.6.0/foss-2017b-mpi-nvidia/ParaView-v5.6.0/VTK/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 749
vtkXOpenGLRenderWindow (0x4f1a600): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue.
ERROR: In /tmp/pma55/ParaView/5.6.0/foss-2017b-mpi-nvidia/ParaView-v5.6.0/VTK/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 796
vtkXOpenGLRenderWindow (0x4f1a600): failed to create offscreen window
ERROR: In /tmp/pma55/ParaView/5.6.0/foss-2017b-mpi-nvidia/ParaView-v5.6.0/VTK/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 736
vtkXOpenGLRenderWindow (0x4f1a600): GLEW could not be initialized.
...
See attached log file for full error trace.