2 Compilation and execution (gcc/cmake)

2.1 System requirements

The library is available for Linux, Mac and Windows operating systems. In all cases, in order to use the library, one needs some building tools for c/c++ to be installed:

The folders are organized as follows.

Folders src, include, lib:

These folders should not be renamed.

Folders data, OUTPUT, VALUE: The user has to create a new model file as a C-header file, named like data_mymodel.h, that contains the definition of the drift, distributed-cost, the hamiltonian function (if known analytically), the initial conditions, the boundary conditions, the obstacle function (if any) and all the parameters that describe the model to be solved.

When the data file data_mymodel.h is created, the user should include its name in the file data/data_simulation.h as follows:

#include ”data_mymodel.h”

(The data file data_simulation.h is then included in main.cpp by an include command in the same way, so that the main file is not touched.)

Some basic knowledge of C programming syntax is necessary to describe a new problem to be solved by the HJB solver.

For the user’s convenience several models of data files are already available in the folder data. In particular:

(In this case, these two files themselves include an other data file : data_default.h with more specific parameter definitions.)

The file data_simulation.h should not be removed or renamed (this data file is included in src/main.cpp).

The solver’s executable needs two folders: OUTPUT/ and VALUE/ where the outputs of the simulation will be stored. (If these folders are removed or renamed, the program will not be able to save outputs propertly and will signal an error.)

2.2 ROC-HJ-Editor

The ROC-HJ-Editor may be available in the folder ROC-HJ-Editor. This application is designed to assist with the process of editing the template for a new data file. The application shows main possible options and helps the user to define a new data file adapted to the problem to be solved. When creating a new template model using the ROC-HJ-Editor, two files are generated: data_user_mymodel.h which contains the parameters and functions that the user has to define; data_default_mymodel.h which contains predefined parameters that the user does not need to handle (but that are mandatory for running the program). Further detailed instructions on how to construct a header file and how to compile the program are presented in the User’s Manual for ROC-HJ solver.

2.3 Compilation and execution

Once the data file is defined and declared in the file data_simulation.h (see above), the project can be compiled and executed. The compilation/execution process is composed of several steps:

Sequential execution mode Execution (basic):

./exe

Execution (with options)

./exe -nn NN -nc NC

Options :

OpenMP execution mode Some options run with OpenMP. Execution:

./exe -nt nbth

where nbth is the number of threads (typically try nbth=2 or nbth=4).

Parallel code (Parallel MPI version only): contact the ROC-HJ developpers for more info.

Execution:

mpirun -n MPI_PROCS ./exe -nn NN -nc NC -nt OMP_THREADS -nd MPI_GRID_DIM

where

Example 1 : mpirun -n 2 ./exe -nn 200 will execute the program with 2 MPI processors and 200 mesh points per dimension.

Example 2 : mpirun -n 64 ./exe -nn 500 -nc 10 -nt 4 -nd 2 will execute the program with MPI_PROCS=64 MPI processors, NN=500 points per direction, NC=10 controls per command’s dimension, OMP_THREADS=4 OpenMP threads, and MPI_GRID_DIM=2, the dimension of the MPI mesh grid decomposition.

Example 3 : mpirun -n 1 ./exe -nn 500 -nc 10 -nt 4.

The OpenMP parallelization is working for Semi Lagrangian and Finite Difference methods. When using only this method, one can indicate only one process for the mpirun command (for instance mpirun -n 1 ./exe -nt 4 for using 4 openMP threads) or, equivalently, use ./exe -nt 4

2.4 Download page

Different version of the package exist corresponding to different OS:

The distributed software ROC-HJ contains: