Visualization: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
No edit summary
Line 32: Line 32:
<!--T:61-->
<!--T:61-->
Cedar and Graham have a number of interactive GPU nodes that can be used for remote ParaView client-server visualization.
Cedar and Graham have a number of interactive GPU nodes that can be used for remote ParaView client-server visualization.
#First, install the same ParaView version as the one available on the cluster you will be using. Log into Cedar or Graham and start a serial GPU interactive job:
1. First, install the same ParaView version as the one available on the cluster you will be using. Log into Cedar or Graham and start a serial GPU interactive job:


   <!--T:62-->
   <!--T:62-->
Line 38: Line 38:


<!--T:63-->
<!--T:63-->
::The job should automatically start on one of GPU interactive nodes.
:The job should automatically start on one of GPU interactive nodes.
# At the prompt (that is now running inside your job), load the ParaView GPU+EGL module, unset your display variable so that ParaView does not attempt to use the X11 rendering context, and start the ParaView server:
2.  At the prompt (that is now running inside your job), load the ParaView GPU+EGL module, change your display variable so that ParaView does not attempt to use the X11 rendering context, and start the ParaView server.


   <!--T:64-->
   <!--T:64-->
Line 47: Line 47:


<!--T:65-->
<!--T:65-->
Wait for the server to be ready to accept client connection.
:Wait for the server to be ready to accept client connection.


<!--T:66-->
<!--T:66-->
Line 55: Line 55:


<!--T:67-->
<!--T:67-->
#Make a note of the node (in this case cdr347) and the port (usually 11111) and in another terminal on your laptop (on Mac/Linux; in Windows use a terminal emulator), link the port 11111 on your laptop and the same port on the compute node (make sure to use the correct compute node).
3. Make a note of the node (in this case cdr347) and the port (usually 11111) and in another terminal on your laptop (on Mac/Linux; in Windows use a terminal emulator), link the port 11111 on your laptop and the same port on the compute node (make sure to use the correct compute node).


   <!--T:68-->
   <!--T:68-->
Line 61: Line 61:


<!--T:69-->
<!--T:69-->
#Start ParaView on your laptop, go to File -> Connect (or click on the green Connect button in the toolbar) and then click Add Server. You'll need to point ParaView to your local port 11111, so you can do something like name = cedar, server type = Client/Server, host = localhost, port = 11111, then click Configure, then select Manual and click Save.
4. Start ParaView on your laptop, go to ''File -> Connect'' (or click on the green ''Connect'' button on the toolbar) and then click ''Add Server''. You'll need to point ParaView to your local port 11111, so you can do something like name = cedar, server type = Client/Server, host = localhost, port = 11111, then click ''Configure'', then select ''Manual'' and click ''Save''.
Once the remote is added to the configuration, simply select the server from the list and click Connect. The first terminal window that read "Accepting connection ..." will now read "Client connected".
:Once the remote is added to the configuration, simply select the server from the list and click Connect. The first terminal window that read "Accepting connection ..." will now read "Client connected".


<!--T:70-->
<!--T:70-->
#Open a file in ParaView (it'll point you to the remote filesystem) and visualize it as usual.
5. Open a file in ParaView (it'll point you to the remote filesystem) and visualize it as usual.
An important setting in ParaView's preferences is Render View -> Remote/Parallel Rendering Options -> Remote Render Threshold. If you set it to default (20MB) or similar, small rendering will be done on your laptop's GPU, the rotation with a mouse will be fast, but anything modestly intensive (under 20MB) will be shipped to your laptop and -- depending on your connection -- visualization might be slow. If you set it to 0MB, all rendering will be remote including rotation, so you'll be really using the cluster's GPU for everything, good for large data processing but not so good for interactivity. You'll need to play with this setting to see what works best for you.
 
An important setting in ParaView's preferences is ''Render View -> Remote/Parallel Rendering Options -> Remote Render Threshold''. If you set it to default (20MB) or similar, small rendering will be done on your laptop's GPU, the rotation with a mouse will be fast, but anything modestly intensive (under 20MB) will be shipped to your laptop and -- depending on your connection -- visualization might be slow. If you set it to 0MB, all rendering will be remote including rotation, so you'll be really using the cluster's GPU for everything, which is good for large data processing but not so good for interactivity. You'll need to play with this setting to see what works best for you.


== CPU-based client-server visualization on Cedar and Graham == <!--T:43-->
== CPU-based client-server visualization on Cedar and Graham == <!--T:43-->

Revision as of 22:38, 11 August 2017

Other languages:

External documentation for popular visualization packages[edit]

ParaView[edit]

ParaView is a general-purpose 3D scientific visualization tool. It is open source and compiles on all popular platforms (Linux, Windows, Mac), understands a large number of input file formats, provides multiple rendering modes, supports Python scripting, and can scale up to tens of thousands of processors for rendering of very large datasets.

VisIt[edit]

Similar to ParaView, VisIt is an open-source, general-purpose 3D scientific data analysis and visualization tool that scales from interactive analysis on laptops to very large HPC projects on tens of thousands of processors.

VMD[edit]

VMD is an open-source molecular visualization program for displaying, animating, and analyzing large biomolecular systems in 3D. It supports scripting in Tcl and Python and runs on a variety of platforms (MacOS X, Linux, Windows). It reads many molecular data formats using an extensible plugin system and supports a number of different molecular representations.

VTK[edit]

The Visualization Toolkit (VTK) is an open-source package for 3D computer graphics, image processing, and visualization. The toolkit includes a C++ class library as well as several interfaces for interpreted languages such as Tcl/Tk, Java, and Python. VTK was the basis for many excellent visualization packages including ParaView and VisIt.

Visualization on new Compute Canada systems[edit]

GPU-based client-server visualization on Cedar and Graham[edit]

Cedar and Graham have a number of interactive GPU nodes that can be used for remote ParaView client-server visualization. 1. First, install the same ParaView version as the one available on the cluster you will be using. Log into Cedar or Graham and start a serial GPU interactive job:

 salloc --time=1:00:0 --ntasks=1 --gres=gpu:1 --account=xwp-462-aa
The job should automatically start on one of GPU interactive nodes.

2. At the prompt (that is now running inside your job), load the ParaView GPU+EGL module, change your display variable so that ParaView does not attempt to use the X11 rendering context, and start the ParaView server.

 module load paraview-offscreen-gpu/5.4.0
 unset DISPLAY
 pvserver
Wait for the server to be ready to accept client connection.

Waiting for client... Connection URL: cs://cdr347.int.cedar.computecanada.ca:11111 Accepting connection(s): cdr347.int.cedar.computecanada.ca:11111

3. Make a note of the node (in this case cdr347) and the port (usually 11111) and in another terminal on your laptop (on Mac/Linux; in Windows use a terminal emulator), link the port 11111 on your laptop and the same port on the compute node (make sure to use the correct compute node).

 ssh cedar.computecanada.ca -L 11111:cdr347:11111

4. Start ParaView on your laptop, go to File -> Connect (or click on the green Connect button on the toolbar) and then click Add Server. You'll need to point ParaView to your local port 11111, so you can do something like name = cedar, server type = Client/Server, host = localhost, port = 11111, then click Configure, then select Manual and click Save.

Once the remote is added to the configuration, simply select the server from the list and click Connect. The first terminal window that read "Accepting connection ..." will now read "Client connected".

5. Open a file in ParaView (it'll point you to the remote filesystem) and visualize it as usual.

An important setting in ParaView's preferences is Render View -> Remote/Parallel Rendering Options -> Remote Render Threshold. If you set it to default (20MB) or similar, small rendering will be done on your laptop's GPU, the rotation with a mouse will be fast, but anything modestly intensive (under 20MB) will be shipped to your laptop and -- depending on your connection -- visualization might be slow. If you set it to 0MB, all rendering will be remote including rotation, so you'll be really using the cluster's GPU for everything, which is good for large data processing but not so good for interactivity. You'll need to play with this setting to see what works best for you.

CPU-based client-server visualization on Cedar and Graham[edit]

You can also do interactive client-server ParaView rendering on cluster CPUs. For some types of rendering modern CPU-based libraries such as OSPRay and OpenSWR offer performance quite similar to GPU-based rendering. And, since ParaView server uses MPI for distributed-memory processing, for very large datasets one can do parallel rendering on a large number of CPU cores, either on a single node, or scattered across multiple nodes.

To get started, install ParaView 5.3.x (where "x" could be anything) on your laptop as you need the same version as on the cluster. Log in to Cedar or Graham and start a serial non-GPU interactive job:

 salloc --time=1:00:0 --ntasks=1 --account=xwp-462-aa

The job should automatically start on one of CPU interactive nodes. Once you get an interactive prompt (that is part of your job), load the offscreen ParaView module and start the server:

 module load paraview-offscreen/5.3.0
 pvserver --mesa-swr-avx2

The flag "--mesa-swr-avx2" is important for much faster software rendering with OpenSWR library. Wait for the server to be ready to accept client connection:

Connection URL: cs://cdr774.int.cedar.computecanada.ca:11111 Accepting connection(s): cdr774.int.cedar.computecanada.ca:11111

Take a note of the node (in this case cdr774) and the port (usually 11111) and then in another terminal on your laptop (on Mac/Linux; in Windows use a terminal emulator) link the port 11111 on your laptop and the same port on the compute node (make sure to use the correct compute node):

 ssh cedar.computecanada.ca -L 11111:cdr774:11111

Start ParaView on your laptop, go to File -> Connect (or click on the green Connect button in the toolbar) and then click Add Server. You'll need to point ParaView to your local port 11111, so you can do something like name = cedar, server type = Client/Server, host = localhost, port = 11111, then click Configure, then select Manual and click Save. Once the remote is added to the configuration, simply select the server from the list and click Connect. The first terminal window that was saying "Accepting connection ..." will now say "Client connected" and possibly "SWR detected AVX2" (or it may confirm AVX2 support when you start rendering).

Then open a file in ParaView (it'll point you to the remote filesystem) and visualize it as usual. An important setting in ParaView's preferences is Render View -> Remote/Parallel Rendering Options -> Remote Render Threshold. If you set it to default (20MB) or similar, small rendering will be done on your laptop's GPU, the rotation with a mouse will be fast, but anything modestly intensive (under 20MB) will be shipped to your laptop and -- depending on your connection -- visualization might be slow. If you set it to 0MB, all rendering will be remote including rotation, so you'll be really using the cluster's CPU for everything, good for large data processing but not so good for interactivity. You'll need to play with this setting to see what works best for you.

If you want to do parallel rendering on multiple CPUs, start a parallel job (don't forget to specify the correct maximum walltime limit):

 salloc --time=0:30:0 --ntasks=8 --account=xwp-462-aa

and then start ParaView server with "srun":

 module load paraview-offscreen/5.3.0
 srun pvserver --mesa

The flag "--mesa-swr-avx2" does not seem to have any effect when in parallel so we replaced it with the more generic "--mesa" to (hopefully) enable automatic detection of the best software rendering option.

To check that you are doing parallel rendering, you can pass your visualization through the Process Id Scalars filter and then colour it by "process id".

Client-server visualization in a cloud VM[edit]

Prerequisites[edit]

You can launch a new cloud virtual machine (VM) as described in the Cloud Quick Start Guide. Once you log into the VM, you'll need to install some additional packages to be able to compile ParaView or VisIt. For example, on a CentOS VM you can type:

 sudo yum install xauth wget gcc gcc-c++ ncurses-devel python-devel libxcb-devel
 sudo yum install patch imake libxml2-python mesa-libGL mesa-libGL-devel
 sudo yum install mesa-libGLU mesa-libGLU-devel bzip2 bzip2-libs libXt-devel zlib-devel flex byacc
 sudo ln -s /usr/include/GL/glx.h /usr/local/include/GL/glx.h

If you have your own private-public SSH key pair (as opposed to the cloud key), you may want to copy the public key to the VM to simplify logins, by issuing the following command on your laptop:

 cat ~/.ssh/id_rsa.pub | ssh -i ~/.ssh/cloudwestkey.pem centos@vm.ip.address 'cat >>.ssh/authorized_keys'

ParaView client-server[edit]

Compiling ParaView with OSMesa[edit]

Since the VM does not have access to a GPU (most Cloud West VMs don't), we need to compile ParaView with OSMesa support so that it can do offscreen (software) rendering. The default configuration of OSMesa will enable OpenSWR (Intel's software rasterization library to run OpenGL). What you'll end up with is a ParaView server that uses OSMesa for offscreen CPU-based rendering without X but with both llvmpipe (older and slower) and SWR (newer and faster) drivers built. We recommend using SWR.

Back on the VM, compile cmake::

wget https://cmake.org/files/v3.7/cmake-3.7.0.tar.gz
unpack and cd there
./bootstrap
make
sudo make install

Next, compile llvm:

cd
wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz
unpack and cd there
mkdir -p build && cd build
cmake \
 -DCMAKE_BUILD_TYPE=Release \
 -DLLVM_BUILD_LLVM_DYLIB=ON \
 -DLLVM_ENABLE_RTTI=ON \
 -DLLVM_INSTALL_UTILS=ON \
 -DLLVM_TARGETS_TO_BUILD:STRING=X86 \
 ..
make
sudo make install

Next, compile Mesa with OSMesa:

cd
wget ftp://ftp.freedesktop.org/pub/mesa/mesa-17.0.0.tar.gz
unpack and cd there
./configure \
 --enable-opengl --disable-gles1 --disable-gles2 \
 --disable-va --disable-xvmc --disable-vdpau \
 --enable-shared-glapi \
 --disable-texture-float \
 --enable-gallium-llvm --enable-llvm-shared-libs \
 --with-gallium-drivers=swrast,swr \
 --disable-dri \
 --disable-egl --disable-gbm \
 --disable-glx \
 --disable-osmesa --enable-gallium-osmesa
make
sudo make install

Next, compile ParaView server:

cd
wget http://www.paraview.org/files/v5.2/ParaView-v5.2.0.tar.gz
unpack and cd there
mkdir -p build && cd build
cmake \
     -DCMAKE_BUILD_TYPE=Release \
     -DCMAKE_INSTALL_PREFIX=/home/centos/paraview \
     -DPARAVIEW_USE_MPI=OFF \
     -DPARAVIEW_ENABLE_PYTHON=ON \
     -DPARAVIEW_BUILD_QT_GUI=OFF \
     -DVTK_OPENGL_HAS_OSMESA=ON \
     -DVTK_USE_OFFSCREEN=ON \
     -DVTK_USE_X=OFF \
     ..
make
make install

Running ParaView in client-server mode[edit]

Now you are ready to start ParaView server on the VM with SWR rendering:

./paraview/bin/pvserver --mesa-swr-avx2

Back on your laptop, organize an SSH tunnel from the local port 11111 to the VM's port 11111:

ssh centos@vm.ip.address -L 11111:localhost:11111

Finally, start the ParaView client on your laptop and connect to localhost:11111. If successful, you should be able to open files on the remote VM. During rendering in the console you should see the message "SWR detected AVX2".

VisIt client-server[edit]

Compiling VisIt with OSMesa[edit]

VisIt with offscreen rendering support can be built with a single script:

wget http://portal.nersc.gov/project/visit/releases/2.12.1/build_visit2_12_1
chmod u+x build_visit2_12_1
./build_visit2_12_1 --prefix /home/centos/visit --mesa --system-python \
   --hdf4 --hdf5 --netcdf --silo --szip --xdmf --zlib

This may take a couple of hours. Once finished, you can test the installation with:

~/visit/bin/visit -cli -nowin

This should start a VisIt Python shell.

Running VisIt in client-server mode[edit]

Start VisIt on your laptop and in Options -> Host profiles... edit the connection nickname (let's call it Cloud West), the VM host name, path to VisIt installation (/home/centos/visit) and your username on the VM, and enable tunneling through ssh. Don't forget to save settings with Options -> Save Settings. Then opening a file (File -> Open file... -> Host = Cloud West) you should see the VM's filesystem. Load a file and try to visualize it. Data processing and rendering should be done on the VM, while the result and the GUI controls will be displayed on your laptop.

Upcoming visualization events[edit]

  • "Visualization on Cedar and Graham" webinar in September 2017, exact date TBA
  • "Large-scale parallel visualization" workshop at UBC Okanagan in the fall 2017, exact date TBA

Compute Canada visualization presentation materials[edit]

Full- or half-day workshops[edit]

Webinars and other short presentations[edit]

Wherever possible, the following webinar links provide both a video recording and slides.

Tips and tricks[edit]

This section will describe visualization workflows not included into the workshop/webinar slides above. It is meant to be user-editable, so please feel free to add your cool visualization scripts and workflows here so that everyone can benefit from them.

Regional visualization pages[edit]

WestGrid[edit]

SciNet, HPC at the University of Toronto[edit]

SHARCNET[edit]

Visualization gallery[edit]

You can find a gallery of visualizations based on models run on Compute Canada systems in the visualization gallery. There you can click on individual thumbnails to get more details on each visualization.

How to get visualization help[edit]

You can contact us via email.