CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] Using offscreen rendering (https://www.cfd-online.com/Forums/paraview/105105-using-offscreen-rendering.html)

JPW July 23, 2012 08:53

Using offscreen rendering
 
I have create some scripts for producing images and animations of data rendered in ParaView. I run these scripts in pvbatch, but a window opens in the top left when the script is ran, and closes at the end.

How can I achieve total off-screen rendering?

I have also used the flag --use-offscreen-rendering, but I still get the same result.

The help for --use-offscreen-rendering says :"This option only works with software rendering or mangled mesa on Unix". I am using Red Hat Linux. How can I enable this?


Thanks for any help
James

wyldckat July 24, 2012 15:07

Hi James,

OK, here there are (at least) two possibilities:
  1. You might have to install the "mesa utils" system package. This one I can't confirm myself before the end of this week.
  2. You might need to build your own version of ParaView!
    If you were using OpenFOAM, it should or would be as simple as using the right options in makeParaView... if not, then again only at the end of this week would I be able to look deeper into this.
Best regards,
Bruno

JPW July 25, 2012 04:19

Hi Bruno,

if you could let me know the results that would be great!

At the moment I am using Xvfb (X virtual framebuffer) so that nothing is shown to the screen.


Thanks
James

wyldckat July 30, 2012 17:02

Hi James,

OK, the test machine (virtual in fact) was an Ubuntu 11.10 x86_64. The test script I used was this:
Code:

from paraview.simple import *
cone = Cone(Resolution=32)
cone.Center = [1, 2, 3]
shrinkFilter = Shrink(cone)
shrinkFilter.UpdatePipeline()
Show(shrinkFilter)
Render()
WriteImage('test2.png')

The command line, directly from ParaView's "bin" folder was:
Code:

./pvbatch --use-offscreen-rendering
With or without the command "Render()", it still opens an X window, but nothing is rendered inside that window. This might be because of the mesa drivers that I had installed on the test system.

As for RHEL, it looks like you need to install the package "mesa-libOSMesa" (and maybe "mesa-libOSMesa-devel" as well). The "OSMesa" stands for:
Quote:

Originally Posted by http://www.xfree86.org/4.8.0/DRI8.html#16
OSMesa (Off-Screen Mesa) is an interface and driver for rendering 3D images into a user-allocated block of memory rather than an on-screen window.

Last but not least, you can also try this:
Quote:

Originally Posted by preichl (Post 279104)
Setting the environment variable via the command below worked for me.

export LIBGL_ALWAYS_INDIRECT=y

With this option, the window was only opened very briefly!

Best regards,
Bruno

aerogt3 July 11, 2014 10:07

I have a cluster on which I am trying to run, but keep getting the following errors:

Quote:

ERROR: In /depot/ParaView-v4.1.0-src/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 531
vtkXOpenGLRenderWindow (0x3497320): bad X server connection. DISPLAY=:0. Aborting.
I am able to run a python script which writes images using pvbatch. I am able to do so by manually launching pvbatch on one of the cluster nodes, and the images are properly written and the --use-offscreen-rendering flag seems to work as intended (the cluster has no graphics cards anywhere.)

However, as soon as I run on multiple nodes via submit script, I get the above errors. Here are the relevant parts of my submit script:

Quote:

module load openmpi/1.6.5

/usr/mpi/gcc/openmpi-1.6.5/bin/mpiexec -n 128 /opt/paraview/4.1.m/bin/pvbatch --mpi --use-offscreen-rendering script.py script_args

wyldckat August 17, 2014 11:56

Greetings aerogt3,

Only today did I finally managed to give a quick look into this.
Quote:

Originally Posted by aerogt3 (Post 501152)
I am able to run a python script which writes images using pvbatch. I am able to do so by manually launching pvbatch on one of the cluster nodes, and the images are properly written and the --use-offscreen-rendering flag seems to work as intended (the cluster has no graphics cards anywhere.)

According to my searches online and the test I made on my machine, it seems that we are able to use the "offscreen" option when there is a valid setting in "DISPLAY". In other words, if you run the following commands on your local machine or on the target node:
Code:

pvbatch --use-offscreen-rendering test.py
unset DISPLAY
pvbatch --use-offscreen-rendering test.py

The first command will work just fine, without any windows appearing, but the second command will give the same complaint.

Therefore, either you used "ssh -X" or a VNC connection to access the cluster node, so that there was a valid display ready to be used for off-screen rendering.

The solution seems to be to build ParaView with OSMesa: http://www.paraview.org/Wiki/Setting...OSMesa_support - which means OSMesa will then have to be installed on all cluster nodes and the same ParaView build will also have to be installed on them.

Best regards,
Bruno


All times are GMT -4. The time now is 13:45.