Ask.Cyberinfrastructure

How do I run paraview or openfoam on an HPC resource?

research-software

#1

I want to use Paraview but the installation seems very complicated. Is there a quick or easy way to do it without asking my admin for a special installation?


#2

If you are interested in paraviewweb (meaning a server with apache), then continue reading! If you want to just use the visualizer (without apache) see this repository here.

There are two possible versions of paraview that you might be interested in:

1. ParaviewWeb

If you are interested in using the “paraviewweb,” meaning serving the applications via a browser and a container instance, see this post. This will walk you through building a container, and running it as an instance with specific binds to the host where you need to write files. It also has instructions for using the Docker image to deploy the same thing. You get a nice web interface with these applications:

If you want to run Paraview (the program) from a container continue below - that’s what the tutorial here will cover today!


2. Paraview as a Program

We can create a Singularity container to use Paraview, specifically from this Docker container. Note that there might be other versions of Paraview, you can search the openfoam Docker Hub organization to check. Let’s walk through the steps of how to do this.

Image Generation

First pull the image from Docker Hub, select the version below that is your preference.

singularity pull --name paraview.simg docker://openfoam/openfoam4-paraview50
singularity pull --name paraview.simg docker://openfoam/openfoam6-paraview54

This (50) version of the image is also provided on the Sherlock cluster by @vsoch

cp /scratch/users/vsoch/share/paraview.simg $SCRATCH

How do I know which version to use?

Another form of this question is how might performance vary on my cluster?. The answer is that the more recent version that uses OpenGL2 rendering needs some additional attention. For OpenGL2:

  • if you don’t have an nvidia card on your machine, you need to install mesa >= 17.xx.
  • The more recent mesa gives better performance (with swr or llvmpipe)

This would mean adding the --nv flag to tell the container to use the nvidia libraries on the host:

$ singularity shell --nv paraview.simg

Thanks to @trophime for this tip!


Using the image

If you need to load singularity as a module or similar, do that first (on our sherlock cluster Singularity is provided natively).

$ module load singularity

Then shell into the image

$ singularity shell paraview.simg 

The paraview executable is located at /opt/paraviewopenfoam54/bin/paraview

Singularity: Invoking an interactive shell within container...

Singularity paraview.simg:/home/vanessa/Documents/Dropbox/Code/singularity/docker/singularity> cd /opt/paraviewopenfoam54/

We can see all the binary files provided in this folder!

Singularity paraview.simg:/opt/paraviewopenfoam54> ls
bin  include  lib  share
Singularity paraview.simg:/opt/paraviewopenfoam54> ls bin
paraview	 pvrenderserver		vtkLegacyColorMapXMLToJSON  vtkWrapJava-pv5.4	     vtkkwProcessXML-pv5.4
paraview-config  pvserver		vtkParseJava-pv5.4	    vtkWrapPython-pv5.4
pvbatch		 smTestDriver		vtkParseOGLExt-pv5.4	    vtkWrapPythonInit-pv5.4
pvdataserver	 vtkEncodeString-pv5.4	vtkWrapClientServer-pv5.4   vtkWrapTcl-pv5.4
pvpython	 vtkHashSource-pv5.4	vtkWrapHierarchy-pv5.4	    vtkWrapTclInit-pv5.4

Then to run paraview, given that you have x11 display, just do it :slight_smile:

$ ./bin/paraview

It will open up the Paraview interface.

You can also interact with software by executing a command to the container with exec. For example, this
would list the content at the root of the container:

$ singularity exec paraview.simg ls /

Again, notice that we are using exec to send a command directly to the container. You can do any command that you like.


Customize the Image

If you need to make changes to the image, on your local machine, install Singularity and then create a recipe file called Singularity with the following content:

Bootstrap: docker
From: docker://openfoam/openfoam6-paraview54

%environment
   export MYVAR=MYVAL

%post
   echo "Write you changes here!"

Then build the image.

$ sudo singularity build paraview.simg Singularity

You then then transfer to the cluster as you would for any file. It’s a binary that can sit on your desktop.