ISAAC
Overview :: Library Doc :: Server Doc :: JSON Commands

In Situ Animation of Accelerated Computations

ISAAC Library Documentation

This documentation is mainly for using the library than for exteding it. However there are some class diagrams and class documentations to get some deeper insight to ISAAC nevertheless.

Installation

For hints how to install the library please have a look the INSTALL.MD documentation. This also explains the requirements to use the ISAAC library.

Using ISAAC

After you managed to add ISAAC to your build process (easiest with using CMake) first you need to include ISAAC with

#include <isaac.hpp>

ISAAC is a template libary, which compiles supports for your fields (called "sources" in ISAAC) direct into its render kernel. This has the benefit, that the access of your simulation data is high optimized. However you can't add sources later, but add as many as you want and deactivate them at runtime if not needed. ISAAC is very metaprogramming based. That means, that you need to define your fields as classes and to add them to a metaprogramming list, which can be evaluated at compile time. It should not be a barrir if you never worked with C++ metaprogramming before. Most of the commands used in the interface are easy to understand resp. to copy and paste.

For every source an own class needs to be defined. This class has to implement this following things:

Everything else in the class is up to you, but keep in mind, it may be copied from time to time, so be careful with memory in constructors and destructors.

For a working example of such classes have a look at the example.cpp. If you are using CUDA™, you can ignore all ISAAC_ALPAKA ifdefs and only look at the CUDA™ else branch. I will continue explaining using the CUDA™ example code. If you are using Alpaka you should understand the Alpaka specific differences yourself.

Now you need a boost::fusion::list with all your classes like

TestSource1 testSource1;
TestSource2 testSource2;
using SourceList = boost::fusion::list
<
TestSource1,
TestSource2
>;
SourceList sources( testSource1, testSource2 );

sources is needed for the initialization of ISAAC, which is happening now with the creation of an instance of isaac::IsaacVisualization.

auto visualization = new isaac::IsaacVisualization <
SimDim,
SourceList,
std::vector<size_t>,
1024,
std::vector<float>,
> (
name,
0,
server,
port,
framebuffer_size,
global_size,
local_size,
position,
sources,
scaling
);

with the template parameters

and the contructor parameters

Now it is possible to define and describe some metadata the client shall see. It doesn't need to be defined at this point, but every here defined datum will be shown in the list of available simulations. visualization->getJsonMetaRoot() returns an instance of json_t*, a json root , where you can add more members. See the example and the Jansson documentation for more details.

After defining the metadata we can now connect to the ISAAC server with visualization->init(). If 0 is returned the connection is established.

Everytime you want to send a rendered view of your data (e.g. after ever time step of your simulation) call visualization->doVisualization(META_MASTER); META_MASTER means, that only the master rank (in most cases rank 0) will send meta data. If you choose META_MERGE the meta data of every rank is merged via MPI before. To add meta data just use visualization->getJsonMetaRoot() again before calling the isaac::IsaacVisualization::doVisualization method. After this function call the returned json root from getJsonMetaRoot is empty again.

doVisualization itself returns a json_t* root, too. Every data put into "metadata" from the client will be forwarded to every application rank. You have to call json_decref to the result of this function! Even if you don't want to use the meta data, call it at least this way:

json_decref( visualization->doVisualization( META_MASTER ) );

Otherwise you will open a memory leak.

At the end of the simulation just delete the visualization object. The connection will close and the simulation will disappear for every client of the ISAAC server.