Difference between revisions of "VisIt-tutorial-in-situ"

m (Building the example)
m (Typo)
Line 1: Line 1:
VisIt provides a library for in-situ visualization and analysis that we call libsim. Libsim lets you can use to instrument your simulation code so VisIt can connect to it and access its data directly as though the simulation was a VisIt compute engine. Trends show that as computers get faster, I/O cannot keep pace. This makes in-situ's properties appealing:
+
VisIt provides a library for in-situ visualization and analysis that we call libsim. Libsim lets you instrument your simulation code so VisIt can connect to it and access its data directly as though the simulation was a VisIt compute engine. Trends show that as computers get faster, I/O cannot keep pace. This makes in-situ's properties appealing:
  
 
*Adds visualization capabilities inside the simulation so it can visualize the data
 
*Adds visualization capabilities inside the simulation so it can visualize the data

Revision as of 21:26, 9 January 2012

VisIt provides a library for in-situ visualization and analysis that we call libsim. Libsim lets you instrument your simulation code so VisIt can connect to it and access its data directly as though the simulation was a VisIt compute engine. Trends show that as computers get faster, I/O cannot keep pace. This makes in-situ's properties appealing:

  • Adds visualization capabilities inside the simulation so it can visualize the data
  • Visualize the data using the same level of resources as are being used to calculate the data (vis often gets 1/10th the resources)
  • Writing plot dump files not required so plot images can be saved at greater frequency
  • Visualization routines get direct access to the simulation’s memory
  • Good for making canned movies

This tutorial section will consist of:

  1. Presentation slides (pdf) (powerpoint)
  2. Demonstration

Resources

Here are some resources for in-situ visualization with VisIt. The best reference is the Getting Data Into VisIt manual.

Example

While VisIt provides many example programs for in-situ visualization, we will focus on the Mandelbrot set example. This example uses adaptive mesh refinement to more finely resolve the Mandelbrot set where it provides more detail.

MandelbrotAMR.png
Mandelbrot set

Other links:


Building the example

  1. Get the source code for the Mandelbrot simulation example: mandelbrot.C,patch.C,patch.h,SimulationExample.h.
  2. Make a simulation directory on your Desktop and copy the source code files to it
  3. Copy the Makefile below to the simulation directory, adjusting the contents to provide the correct location of VisIt's SimV2 library.
  4. Type make
############## Makefile for building the simulation using libsim. ###############

############################## USER EDIT SECTION ################################

# Fill in the Path to the VisIt installation. This is the directory that contains 
# VisIt's 2.0.0, 2.0.1, 2.1.0, 2.1.1 directories
VISITHOME=/path/to/visit

# Set this to the version of VisIt that you use
VISITVERSION=2.1.1

# Choose one, depending on your system architecture
#VISITARCH=linux-intel
#VISITARCH=linux-x86_64
VISITARCH=darwin-i386

# Edit your compiler and its settings
CXX=g++
CPPFLAGS=
CXXFLAGS=-O3
LDFLAGS=
LIBS=

#################################################################################
SIMDIR=$(VISITHOME)/$(VISITVERSION)/$(VISITARCH)/libsim/V2

SIM_CXXFLAGS=-I$(SIMDIR)/include
SIM_LDFLAGS=-L$(SIMDIR)/lib
SIM_LIBS=-lsimV2

SRC=mandelbrot.C patch.C
OBJ=$(SRC:.C=.o)

all: mandelbrot

clean:
	rm -f mandelbrot $(OBJ)

mandelbrot: $(OBJ)
	$(CXX) -o mandelbrot $(OBJ) $(LDFLAGS) $(SIM_LDFLAGS) $(SIM_LIBS) $(LIBS)

.C.o:
	$(CXX) $(CXXFLAGS) $(SIM_CXXFLAGS) $(CPPFLAGS) -c $<
  • Note: if you build and make complains about missing separators, replace the spaces before $(CXX) with a tab

Additional step for MacOS X

VisIt relinks its libraries during installation so its libraries are positioned relative to @executable_path/../lib. Unfortunately, this means that when the VisIt libraries are dynamically loaded into your MacOS X simulation by libsim, it expects to find dependent libraries in ../lib relative to your application. For the time being, you will need to create a lib symbolic link to VisIt's libraries.

  1. cd ~/Desktop
  2. ln -s /path/to/visit/2.1.1/darwin-i386/lib .

Running the example

You will need 2 terminal/shell windows. In the first window you will run the simulation. In the second window, you will launch VisIt and connect to the simulation.

Terminal 1 (Run the simulation)

  1. cd ~/Desktop/simulation
  2. ./mandelbrot -trace trace.txt

Terminal 2 (Run VisIt)

  1. Run visit -small
  2. Open ~/.visit/simulations in the File Open window
  3. There should be a file ######.mandelbrot.sim2 that you'll want to open. If there are multiple files that match that pattern then open the most recent one.
  4. VisIt will try connecting to the simulation
  5. Look at terminal 1 to see if it contains VisIt connected
  6. Add a Pseudocolor plot of the mandelbrot variable
  7. Click Draw
  8. Go back to terminal 1

Terminal 1

  1. Type step at the simulation's command> prompt
  2. Type update at the simulation's command> prompt and watch the VisIt window update its plots with a different portion of the Mandelbrot set.

Within VisIt

  1. Open up VisIt's File->Simulations window
  2. Note the command buttons: halt, step, run, update
  3. The command buttons provide a limited way for VisIt to drive the simulation
  4. Click the run button and watch terminal 1 for messages
  5. Click the update button and watch VisIt recalculate the plots
  6. Click the halt button to halt the simulation
  7. Add a Subset plot of levels
  8. Open the Subset plot attributes and turn on single-color. Make it black.
  9. Turn on wireframe
  10. Click Apply and Dismiss the window
  11. Click Draw to draw the plot
  12. Click the toggleupdates button
  13. Click the run button and watch VisIt recalculate the plots as the simulation runs