OpenCAL is an Open Source, multi-platform parallel software library for performing fast and reliable simulations of numerical models based on the Cellular Automata computational paradigm. It also supports eXtended Cellular Automata (XCA), the Finite Differences method and, in general, all numerical methods based on uniform computational grids.
OpenCAL is written in C and supports the majority such as Linux and FreeBSD out of the box. It also supports Microsoft Windows through MinGW.
#Requirements and dependencies
- CMake 2.8 (CMake 3.1 is needed to complile OpenCAL-CL).
- A quite recent C compiler (Full support to OpenMP 4 is needed to compile OpenCAL-OMP).
- OpenGL/GLUT is also needed to compile OpenCAL-GL, which provides a minimal User Interface and visualization system to OpenCAL applications.
- Doxygen and Graphviz to build documentation.
#Making and installing
user@machine:~/git/opencal-1.0$ mkdir build user@machine:~/git/opencal-1.0$ cd build user@machine:~/git/opencal-1.0/build$ cmake ../ [-DBUILD_OPENCAL_SERIAL=ON|OFF] [-DBUILD_OPENCAL_OMP=ON|OFF] [-DBUILD_OPENCAL_CL=OFF|ON] [-DBUILD_OPENCAL_GL=OFF|ON] [-DBUILD_DOCUMENTATION=OFF|ON] [-DCMAKE_INSTALL_PREFIX:PATH=/usr/local | custom_install_path] user@machine:~/git/opencal-1.0/build$ make | tee make.log user@machine:~/git/opencal-1.0/build$ make install | tee install.log
Arguments in square brackets are optional. Default value is shown first, other possible values are separated by pipes.
To change compiler use the following CMake variables:
For example, order to compile using clang
cmake -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DEXAMPLES:STRING=ON ... ```
Developers only In order to generate an eclipse makefile project run CMake using (x.y are major and minor version of eclipse. Use 4.3 for instance)
-G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_ECLIPSE_VERSION=x.y
For example this:
cmake -G "Eclipse CDT4 - Unix Makefiles" -DEXAMPLES=ON -DBUILD_DOCUMENTATION=OFF ..
generates an eclipse project into the eclipse project folder. Import it using the eclipse import menu.
In oder to generate dependencies list (internal and to external libraries) use
cmake --graphviz=deps.dot .. && dot -Tps peds.dot -o deps.ps
For example in order to generate deps.ps postscript image that shows dependencies (inside build directory)
rm -rf * && cmake --graphviz=deps.dot .. -DEXAMPLES:STRING=ON -DBUILD_DOCUMENTATION=OFF -DBUILD_OPENCL:STRING=ON -DBUILD_GL:STRING=ON -DBUILD_OMP:STRING=ON .. && dot -Tps deps.dot -o deps.ps
The CMake option ENABLE_SHARED is used to switch from static and shared object output for the library. Default value is ON.
TESTING THE LIBRARY The library comes with a series of performance and correctness tests based on the running of various models with the different implementation of the library. All the test files are located in the test directory. In order to run the tests do the following.
- Configure using the options: -DBUILD_OPENCAL_TESTS (example: cd build && rm -rf * && cmake -DBUILD_EXAMPLES=ON -DBUILD_OPENCAL_PP=ON -DBUILD_OPENCAL_SERIAL=ON -DBUILD_OPENCAL_TESTS=ON -DBUILD_OPENCAL_OMP=ON )
- cd ../tests && bash runTests.sh
#fixme In order to add a new tests one should first create a new folder into opencal/tests. Into this folder then create a number of directories each containing a particular implementation of the test. For instance, in the life2D test there is an implementation for the serial version of the test (that is the reference output), and an OpenMP implementation plus all the CMake files needed to compile the tests. Tests executable should output the result of the model run into the testsout folder using the convention that filenames are just incremental number.