Visualization: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 2: Line 2:
[[Category:Software]]
[[Category:Software]]
<translate>
<translate>
= External documentation for popular visualization packages = <!--T:1-->
= Popular visualization packages = <!--T:1-->


=== ParaView === <!--T:2-->
=== ParaView === <!--T:2-->
[http://www.paraview.org 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.
[http://www.paraview.org 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.
* [[ParaView|Using ParaView on Compute Canada systems]]
* [http://www.paraview.org/documentation ParaView official documentation]
* [http://www.paraview.org/documentation ParaView official documentation]
* [http://www.paraview.org/gallery ParaView gallery]
* [http://www.paraview.org/gallery ParaView gallery]
Line 13: Line 15:
=== VisIt === <!--T:3-->
=== VisIt === <!--T:3-->
Similar to ParaView, [https://wci.llnl.gov/simulation/computer-codes/visit/ 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.
Similar to ParaView, [https://wci.llnl.gov/simulation/computer-codes/visit/ 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.
* [[VisIt|Using VisIt on Compute Canada systems]]
* [https://wci.llnl.gov/simulation/computer-codes/visit/manuals VisIt manuals]
* [https://wci.llnl.gov/simulation/computer-codes/visit/manuals VisIt manuals]
* [https://wci.llnl.gov/simulation/computer-codes/visit/gallery VisIt gallery]
* [https://wci.llnl.gov/simulation/computer-codes/visit/gallery VisIt gallery]
Line 20: Line 24:
=== VMD === <!--T:4-->
=== VMD === <!--T:4-->
[http://www.ks.uiuc.edu/Research/vmd 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.
[http://www.ks.uiuc.edu/Research/vmd 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.
* [[VMD|Using VMD on Compute Canada systems]]
* [http://www.ks.uiuc.edu/Research/vmd/current/ug VMD User's Guide]
* [http://www.ks.uiuc.edu/Research/vmd/current/ug VMD User's Guide]


=== VTK === <!--T:5-->
=== VTK === <!--T:5-->
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.
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.
* [[VTK|Using VTK on Compute Canada systems]]
* [https://itk.org/Wiki/VTK/Tutorials VTK tutorials]
* [https://itk.org/Wiki/VTK/Tutorials VTK tutorials]


=== 3D Slicer === <!--T:139-->
=== YT ===
3D Slicer is an open source software platform for medical image informatics, image processing, and three-dimensional visualization. Built over two decades through support from the National Institutes of Health and a worldwide developer community, Slicer brings free, powerful cross-platform processing tools to physicians, researchers, and the general public.
YT is a Python library for analyzing and visualizing volumetric, multi-resolution data. Initially developed for astrophysical simulation data, it can handle any uniform and multiple-resolution data on Cartesian, curvilinear, unstructured meshes and on particles.
* [https://www.slicer.org/wiki/Documentation/4.10 3D Slicer user manual]
 
* [[Slicer]]
* [[yt|Using YT on Compute Canada systems]]


= Visualization on Compute Canada systems = <!--T:6-->
= Visualization on Compute Canada systems = <!--T:6-->


== Start a remote desktop via VNC == <!--T:92-->
There are many options for remote visualization on Compute Canada systems. In general, whenever possible, for interactive rendering we recommend '''client-server visualization''' on interactive nodes, and for non-interactive visualization we recommend '''off-screen batch jobs''' on regular compute nodes.
 
<!--T:93-->
Frequently, it may be useful to start up graphical user interfaces for various software packages like MATLAB, but doing so over X-forwarding can result in a very slow connection to the server. One useful alternative to X-forwarding is to use VNC to start and connect to a remote desktop.
 
<!--T:94-->
For more information, please see the article on [[VNC]].
 
== GPU-based ParaView client-server visualization on general purpose clusters == <!--T:60-->
<span style="color:red">The GPU-based Paraview has an issue on Graham, please use the CPU-based Paraview before we fix the issue.</span>
 
<!--T:61-->
General purpose Compute Canada clusters have a number of interactive GPU nodes that can be used for remote ParaView client-server visualization.
 
<!--T:72-->
1. First, install on your laptop the same ParaView version as the one available on the cluster you will be using; log into the cluster and start a serial GPU interactive job.
 
  <!--T:62-->
salloc --time=1:00:0 --ntasks=1 --gres=gpu:1 --account=def-someprof
 
<!--T:63-->
:The job should automatically start on one of the 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.
 
  <!--T:64-->
module load paraview-offscreen-gpu/5.4.0
  unset DISPLAY
  pvserver
 
<!--T:65-->
:Wait for the server to be ready to accept client connection.
 
  <!--T:66-->
Waiting for client...
  Connection URL: cs://cdr347.int.cedar.computecanada.ca:11111
  Accepting connection(s): cdr347.int.cedar.computecanada.ca:11111
 
<!--T:67-->
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-->
ssh <username>@cedar.computecanada.ca -L 11111:cdr347:11111
 
<!--T:69-->
4. Start ParaView on your laptop, go to ''File -> Connect'' (or click on the green ''Connect'' button on the toolbar) and click ''Add Server''. You will 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'', 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''.
 
<!--T:70-->
5. Open a file in ParaView (it will point you to the remote filesystem) and visualize it as usual.
 
<!--T:73-->
'''NOTE:''' 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 will be really using the cluster's GPU for everything, which is good for large data processing but not so good for interactivity. Experiment with the threshold to find a suitable value.
 
== CPU-based ParaView client-server visualization on general purpose clusters == <!--T:43-->


<!--T:44-->
Other, ''less efficient'' options are X11-forwarding and VNC. For some packages these are the only available remote GUI options.
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. Also, since the 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.


<!--T:71-->
=== Client-server interactive visualization ===
1. First, install on your laptop the same ParaView version as the one available on the cluster you will be using; log into the cluster and start a serial CPU interactive job.


  <!--T:45-->
In the client-server mode, supported by both ParaView and VisIt, all data will be processed remotely on the cluster, using either CPU or GPU rendering, while you interact with your visualization through a familiar GUI client on your laptop. You can find the details of setting up client-server visualization in [[ParaView]] and [[VisIt]] pages.
salloc --time=1:00:0 --ntasks=1 --account=def-someprof


<!--T:46-->
=== Remote windows with X11-forwarding ===
:The job should automatically start on one of the CPU interactive nodes.


<!--T:76-->
In general, X11-forwarding should be avoided for any heavy graphics, as it requires many round trips and is much slower than VNC (below). However, in some cases you can connect via ssh with X11. Below we show how you would do this on Niagara. We assume you have an X-server installed on your laptop.
2. At the prompt that is now running inside your job, load the offscreen ParaView module and start the server.


  <!--T:47-->
Since runtime is limited on the login nodes, you might want to request a testing job in order to have more time for exploring and visualizing your data. On the plus side, you will have access to 40 cores on each of the nodes requested. For performing an interactive visualization session in this way please follow these steps:
module load paraview-offscreen/5.5.2
  pvserver --mesa-swr-avx2 --force-offscreen-rendering


<!--T:48-->
:The '''--mesa-swr-avx2''' flag is important for much faster software rendering with the OpenSWR library.
<!--T:50-->
:Wait for the server to be ready to accept client connection.
  <!--T:49-->
Waiting for client...
  Connection URL: cs://cdr774.int.cedar.computecanada.ca:11111
  Accepting connection(s): cdr774.int.cedar.computecanada.ca:11111
<!--T:77-->
3. Make a note of the node (in this case cdr774) 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:51-->
ssh <username>@cedar.computecanada.ca -L 11111:cdr774:11111
<!--T:52-->
4. Start ParaView on your laptop, go to ''File -> Connect'' (or click on the green ''Connect'' button in the toolbar) and click ''Add Server''. You will 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'', 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''.
<!--T:53-->
5. Open a file in ParaView (it will point you to the remote filesystem) and visualize it as usual.
<!--T:74-->
'''NOTE:''' 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 CPU, 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 will be really using the cluster's CPU for everything, which is good for large data processing but not so good for interactivity. Experiment with the threshold to find a suitable value.
<!--T:54-->
If you want to do parallel rendering on multiple CPUs, start a parallel job; don't forget to specify the correct maximum walltime limit
  <!--T:55-->
salloc --time=0:30:0 --ntasks=8 --account=def-someprof
<!--T:56-->
and then start ParaView server with "srun":
  <!--T:57-->
module load paraview-offscreen/5.5.2
  srun pvserver --mesa --force-offscreen-rendering
<!--T:58-->
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.
<!--T:59-->
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".
== CPU-based VisIt client-server visualization on general purpose clusters == <!--T:78-->
<!--T:79-->
On general purpose Compute Canada clusters we have two versions of VisIt installed: visit/2.12.3 and visit/2.13.0. To use remote VisIt in client-server mode, on your laptop you need the matching major version, either 2.12.x or 2.13.x, respectively. Before starting VisIt, download the Host Profile XML file [https://owncloud.westgrid.ca/index.php/s/HGxHPO2fPspdb0O/download host_cedar.xml]. On Linux/Mac copy it to ~/.visit/hosts/, and on Windows to "My Documents\VisIt 2.13.0\hosts\". Start VisIt on your laptop, and in its main menu in Options - Host Profiles you should see a host profile called ''cedar''. If you want to do remote rendering for example on Graham, set
<!--T:80-->
Host nickname = graham
Remote host name = graham.computecanada.ca
<!--T:81-->
For any cluster, set your CCDB username
<!--T:82-->
Username = yourOwnUserName
<!--T:83-->
With the exception of your username, your settings should be similar to the ones shown below:
<!--T:84-->
[[File:HostSetting.png]]
<!--T:85-->
In the same setup window select the Launch Profiles tab. You should see two profiles (''login'' and ''slurm''):
<!--T:86-->
[[File:LaunchProfiles.png]]
<!--T:87-->
''Login'' profile is for running VisIt's engine on a cluster's login node, which we do not recommend for heavy visualizations. ''Slurm'' profile is for running VisIt's engine inside an interactive job on a compute node. If you are planning to do the latter, select the ''slurm'' profile and then click on Parallel tab and below it on the Advanced tab and change Launcher arguments from ''--account=def-someuser'' to your default allocation, as shown below:
<!--T:88-->
[[File:LauncherArguments.png]]
<!--T:89-->
Save settings with Options - Save Settings and then restart VisIt on your laptop for settings to take effect. Start the file-open dialogue and switch the Host from localhost to ''cedar'' (or ''graham''). Hopefully, the connection is established, the remote VisIt Component Launcher gets started on the cluster's login node, and you should be able to see the cluster's filesystem, navigate to your file and select it. You will be prompted to select between ''login'' (rendering on the login node) and ''slurm'' (rendering inside an interactive Slurm job on a compute node) profiles, and additionally for ''slurm'' profile you will need to specify the number of nodes and processors and the maximum time limit:
<!--T:90-->
[[File:SelectProfile.png]]
<!--T:91-->
Click Ok and wait for VisIt's engine to start. If you selected rendering on a compute node, it may take some time for your job to get started. Once your dataset appears in the Active source in the main VisIt window, the VisIt's engine is running, and you can proceed with creating and drawing your plot.
== Visualization on Niagara == <!--T:95-->
=== Available software===
We have installed the latest versions of the open source visualization suites: VMD, VisIt and ParaView.
<!--T:96-->
Notice that for using ParaView you need to explicitly specify one of the mesa flags in order to avoid trying to use openGL, i.e.,
after loading the paraview module, use the following command:
  <!--T:97-->
paraview --mesa-swr
<!--T:98-->
Notice that Niagara does not have specialized nodes nor specially designated hardware for visualization, so if you want to perform interactive visualization or exploration of your data you will need to submit an interactive job (debug job, see [https://docs.scinet.utoronto.ca/index.php/Niagara_Quickstart#Testing_and_Debugging Testing and Debugging]).
For the same reason you won't be able to request or use GPUs for rendering as there are none!
=== Interactive visualization === <!--T:99-->
Runtime is limited on the login nodes, so you will need to request a testing job in order to have more time for exploring and visualizing your data.
Additionally by doing so, you will have access to the 40 cores of each of the nodes requested.
For performing an interactive visualization session in this way please follow these steps:
<ol>
<ol>
<li> ssh into niagara.scinet.utoronto.ca with the -X/-Y flag for x-forwarding
<li> ssh into niagara.scinet.utoronto.ca with the -X/-Y flag for X11-forwarding
 
<!--T:100-->
<li> request an interactive job, ie.</li>
<li> request an interactive job, ie.</li>
   debugjob
   debugjob
this will connect you to a node, let's say for the argument "niaXYZW"
this will connect you to a node, let's say for the argument "niaXYZW"
<li> run your visualization program, eg. VMD </li>


<!--T:101-->
  module load vmd
<li> run your favourite visualization program, eg. VisIt/ParaView </li>
  vmd


  <!--T:102-->
module load visit
  visit
  <!--T:103-->
module load paraview
  paraview --mesa-swr
<!--T:104-->
<li> exit the debug session.
<li> exit the debug session.
</ol>
</ol>


=== Remote visualization -- client-server mode === <!--T:105-->
=== Start a remote desktop via VNC === <!--T:92-->
You can use any of the remote visualization protocols supported for both VisIt and ParaView.


<!--T:106-->
<!--T:93-->
Both, VisIt and ParaView, support "remote visualization" protocols.
Frequently, it may be useful to start up graphical user interfaces for various software packages like Matlab. Doing so over X11-forwarding can result in a very slow connection to the server. Instead, we recommend using VNC to start and connect to a remote desktop. For more information, please see [[VNC|the article on VNC]].
This includes:
<ul>
<li>  accessing data remotely, ie. stored on the cluster
<li> rendering visualizations using the compute nodes as rendering engines
<li> or both
</ul>
 
==== VisIt client-server configuration ==== <!--T:107-->
For allowing VisIt connect to the Niagara cluster you need to set up a "Host Configuration".
 
<!--T:108-->
Choose *one* of the methods bellow:
 
====Niagara host configuration file==== <!--T:109-->
You can just download the Niagara host file, right click on the following link [https://support.scinet.utoronto.ca/~mponce/viz/host_niagara.xml host_niagara.xml] and select save as...
Depending on the OS you are using on your local machine:
<ul>
<li> on a Linux/Mac OS place this file in <code>~/.visit/hosts/</code>
<li> on a Windows machine, place the file in  <code>My Documents\VisIt 2.13.0\hosts\</code>
</ul>
 
<!--T:110-->
Restart VisIt and check that the niagara profile should be available in your hosts.
 
====Manual Niagara host configuration==== <!--T:111-->
If you prefer to set up the server yourself, instead of the configuration file from the previous section, just follow along these steps.
Open VisIt in your computer, go to the 'Options' menu, and click on "Host profiles..."
Then click on 'New Host' and select:
 
<!--T:112-->
Host nickname = niagara
Remote host name = niagara.scinet.utoronto.ca
Username = Enter_Your_OWN_username_HERE
Path to VisIt installation = /scinet/niagara/software/2018a/opt/base/visit/2.13.1
 
<!--T:113-->
Click on the "<code>Tunnel data connections through SSH</code>", and then hit Apply!
 
<!--T:114-->
{| align="center"
| [[File:Visit_niagara-01.png|480px|]]
|}
 
 
<!--T:115-->
Now on the top of the window click on 'Launch Profiles' tab.
You will have to create two profiles:
<ol>
<li> <code>login</code>: for connecting through the login nodes and accessing data </li>
<li> <code>slurm</code>: for using compute nodes as rendering engines </li>
</ol>
For doing so, click on 'New Profile', set the corresponding profile name, ie. login/slurm.
Then click on the Parallel tab and set the "Launch parallel engine"
 
<!--T:116-->
For the slurm profile, you will need to set the parameters as seen below:
 
<!--T:117-->
<br style="clear:both" />
{| align="center"
| [[File:Visit_niagara-02.png|400px|]]
| [[File:Visit_niagara-03.png|400px|]]
|}
<br style="clear:both" />
 
<!--T:118-->
Finally, after you are done with these changes, go to the "Options" menu and select "Save settings", so that your changes are saved and available next time you relaunch VisIt.
 
==== ParaView client-server configuration ==== <!--T:119-->
Similarly to VisIt you will need to start a <code>debugjob</code> in order to use a compute node to files and compute resources.
Here are the steps to follow:
<ol>
<li> Launch an interactive job (debugjob) on Niagara,</li>
 
  <!--T:120-->
debugjob
 
<!--T:121-->
<li> After getting a compute node, let's say niaXYZW, load the ParaView module and start a ParaView server,</li>
 
  <!--T:122-->
module load paraview-offscreen/5.6.0
  pvserver --mesa-swr-avx2
 
<!--T:123-->
The <code>--mesa-swr-avx2</code> flag has been reported to offer faster software rendering using the OpenSWR library.
 
<!--T:124-->
<li> Now, you have to wait a few seconds for the server to be ready to accept client connections.</li>
 
  <!--T:125-->
Waiting for client...
  Connection URL: cs://niaXYZW.scinet.local:11111
  Accepting connection(s): niaXYZW.scinet.local:11111


<!--T:126-->
= Visualization training = <!--T:7-->
<li> Open a new terminal without closing your debugjob, and ssh into Niagara using the following command,</li>
 
  <!--T:127-->
ssh YOURusername@niagara.scinet.utoronto.ca -L11111:niaXYZW:11111 -N
 
<!--T:128-->
this will establish a tunnel mapping the port 11111 in your computer (<code>localhost</code>) to the port 11111 on the Niagara's compute node, <code>niaXYZW</code>, where the ParaView server will be waiting for connections.
 
<!--T:129-->
<li> Start ParaView (version 5.6.0) on your local computer, go to "File -> Connect" and click on 'Add Server'.
You will need to point ParaView to your local port <code>11111</code>, so you can do something like</li>
name = niagara
server type = Client/Server
host = localhost
port = 11111
then click Configure, select <code>Manual</code> and click Save.
 
<!--T:130-->
<li> Once the remote server is added to the configuration, simply select the server from the list and click Connect.
The first terminal window that read <code>Accepting connection...</code> will now read <code>Client connected</code>.
 
<!--T:131-->
<li> Open a file in ParaView (it will point you to the remote filesystem) and visualize it as usual.
 
<!--T:132-->
</ol>
 
====Multiple CPUs==== <!--T:133-->
For performing parallel rendering using multiple CPUs, <code>pvserver</code> should be run using <code>mpiexec</code>, ie. either submit a job script or request a job using
 
<!--T:134-->
<source lang="bash"> salloc --ntasks=N*40 --nodes=N --time=1:00:00</source>
 
  <!--T:135-->
module load paraview-offset/5.6.0
  mpirun pvserver --mesa-swr-avx2
 
==== Final considerations ==== <!--T:136-->
Usually both VisIt and ParaView require to use the same version between the local client and the remote host, please try to stick to that to avoid having incompatibility issues, which might result in potential problems during the connections.
 
=== Other versions === <!--T:137-->
Alternatively you can try to use the visualization modules available on the CCEnv stack, for doing so just load the CCEnv module and select your favourite visualization module.
 
== Client-server visualization in a cloud VM == <!--T:20-->
 
=== Prerequisites === <!--T:21-->
 
<!--T:22-->
You can launch a new cloud virtual machine (VM) as described in the [[Cloud Quick Start|Cloud Quick Start Guide]]. Once you log into the VM, you will need to install some additional packages to be able to compile ParaView or VisIt. For example, on a CentOS VM you can type:
 
</translate>
  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
<translate>
 
<!--T:23-->
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:
 
</translate>
  cat ~/.ssh/id_rsa.pub | ssh -i ~/.ssh/cloudwestkey.pem centos@vm.ip.address 'cat >>.ssh/authorized_keys'
<translate>
 
=== ParaView client-server === <!--T:40-->
 
==== Compiling ParaView with OSMesa ==== <!--T:24-->
 
<!--T:25-->
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 will 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.
 
<!--T:26-->
Back on the VM, compile cmake::
</translate>
wget https://cmake.org/files/v3.7/cmake-3.7.0.tar.gz
unpack and cd there
./bootstrap
make
sudo make install
<translate>
<!--T:27-->
Next, compile llvm:
</translate>
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
<translate>
<!--T:28-->
Next, compile Mesa with OSMesa:
</translate>
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
<translate>
<!--T:29-->
Next, compile ParaView server:
</translate>
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
<translate>
 
==== Running ParaView in client-server mode ==== <!--T:30-->
 
<!--T:31-->
Now you are ready to start ParaView server on the VM with SWR rendering:
</translate>
./paraview/bin/pvserver --mesa-swr-avx2
<translate>
<!--T:32-->
Back on your laptop, organize an SSH tunnel from the local port 11111 to the VM's port 11111:
</translate>
ssh centos@vm.ip.address -L 11111:localhost:11111
<translate>
<!--T:33-->
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 === <!--T:41-->
 
==== Compiling VisIt with OSMesa ==== <!--T:42-->
 
<!--T:35-->
VisIt with offscreen rendering support can be built with a single script:
</translate>
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
<translate>
<!--T:36-->
This may take a couple of hours. Once finished, you can test the installation with:
</translate>
~/visit/bin/visit -cli -nowin
<translate>
<!--T:37-->
This should start a VisIt Python shell.
 
==== Running VisIt in client-server mode ==== <!--T:38-->
 
<!--T:39-->
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.
 
== yt rendering on clusters == <!--T:140-->
 
<!--T:141-->
To install [http://yt-project.org yt] for CPU rendering on a cluster in your own directory, please do
$ module load python
$ virtualenv astro    # install Python tools in your $HOME/astro
$ source ~/astro/bin/activate
$ pip install cython
$ pip install numpy
$ pip install yt
$ pip install mpi4py
 
<!--T:142-->
Then, in normal use, simply load the environment and start python
$ source ~/astro/bin/activate  # load the environment
$ python
...
$ deactivate
 
<!--T:143-->
We assume that you have downloaded the sample dataset Enzo_64 from http://yt-project.org/data. Start with the following script `grids.py` to render 90 frames rotating the dataset around the vertical axis
import yt
from numpy import pi
yt.enable_parallelism()  # turn on MPI parallelism via mpi4py
ds = yt.load("Enzo_64/DD0043/data0043")
sc = yt.create_scene(ds, ('gas', 'density'))
cam = sc.camera
cam.resolution = (1024, 1024)  # resolution of each frame
sc.annotate_domain(ds, color=[1, 1, 1, 0.005])  # draw the domain boundary [r,g,b,alpha]
sc.annotate_grids(ds, alpha=0.005)  # draw the grid boundaries
sc.save('frame0000.png', sigma_clip=4)
nspin = 90
for i in cam.iter_rotate(pi, nspin):  # rotate by 180 degrees over nspin frames
    sc.save('frame%04d.png' % (i+1), sigma_clip=4)
 
<!--T:144-->
and the job submission script `yt-mpi.sh`
#!/bin/bash
#SBATCH --time=0:30:00  # walltime in d-hh:mm or hh:mm:ss format
#SBATCH --ntasks=4      # number of MPI processes
#SBATCH --mem-per-cpu=3800
#SBATCH --account=...
source $HOME/astro/bin/activate
srun python grids.py
 
<!--T:145-->
Then submit the job with `sbatch yt-mpi.sh`, wait for it to finish, and then create a movie at 30fps
$ ffmpeg -r 30 -i frame%04d.png -c:v libx264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" grids.mp4
 
= Visualization events = <!--T:7-->


<!--T:138-->
<!--T:138-->
Please contact [[technical support]] if you would like to hold a visualization workshop at your institution.
Please [mailto:support@computecanada.ca let us know] if you would like to see a visualization workshop at your institution.
 
= Compute Canada visualization presentation materials = <!--T:8-->


=== Full- or half-day workshops === <!--T:9-->
=== Full- or half-day workshops === <!--T:9-->
Line 580: Line 86:
=== Webinars and other short presentations === <!--T:10-->
=== Webinars and other short presentations === <!--T:10-->


<!--T:146-->
[https://westgrid.github.io/trainingMaterials/tools/visualization/ WestGrid's visualization training materials page] has embedded video recordings and slides from the following webinars:
[https://westgrid.github.io/trainingMaterials/tools/visualization/ WestGrid's visualization training materials page] has embedded video recordings and slides from the following webinars:


<!--T:147-->
* “Using YT for analysis and visualization of volumetric data”
* “Using YT for analysis and visualization of volumetric data”
* “Scientific visualization with Plotly”
* “Scientific visualization with Plotly”
Line 594: Line 98:
* “Graph visualization with Gephi”
* “Graph visualization with Gephi”


<!--T:75-->
Other visualization presentations:
Other visualization presentations:


Line 610: Line 113:
= Regional visualization pages = <!--T:12-->
= Regional visualization pages = <!--T:12-->
== [http://www.westgrid.ca WestGrid] ==
== [http://www.westgrid.ca WestGrid] ==
* [https://westgrid.github.io/trainingMaterials/tools/visualization/ WestGrid's visualization training materials: recording, slides, notes]
* [https://www.westgrid.ca/support/visualization/vis_quickstart visualization quickstart guide]
* [https://www.westgrid.ca/support/visualization/vis_quickstart visualization quickstart guide]
* [https://www.westgrid.ca/support/visualization/remote_visualization remote visualization]
* [https://www.westgrid.ca/support/visualization/remote_visualization remote visualization]
cc_staff
287

edits

Navigation menu