Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
A NEW LIBRARY FOR
COMPUTATIONAL SCIENCE
ON PARALLEL COMPUTERS
BASED ON THE CELLULAR
AUTOMATA PARADIGM
Workshop on coupled ...
What is OpenCAL?
q  OpenCAL (Open Cellular Automata Library) is a new Open
Source parallel software library for Complex C...
OpenCAL serial and
OMP developing model
OpenCAL is written in the C programming language and is
cross-platform
E.g.: the u...
Cellular Automata (CA)
q  Cellular Automata are discrete parallel computational models, widely
utilized for modeling and ...
Complex Cellular Automata (CCA)
A = (Ed, X, Q, P, σ)
• Ed set of cells where the phenomenon evolves
• X neighborood
• Q ca...
Complex Cellular Automata (CCA)
Mendicino et al., 2006, WRR, for further details
q  The discrete formulation of any field...
OpenCAL serial and
OMP developing model
In order to define the CCA, the user needs to:
q  Define a CA object and initiali...
OpenCAL example
3D test based on Smyth et al. (1989) benchmark, involving
transient, two-dimensional infiltration of water...
OpenCAL example
#include <cal3D.h>
//snip
struct mymodelSubstates {
struct CALSubstate3Dr *teta;
struct CALSubstate3Dr *mo...
OpenCAL example
Q.teta = calAddSubstate3Dr(mymodel);
Q.moist_cont = calAddSubstate3Dr(mymodel);
Q.psi = calAddSubstate3Dr(...
OpenCAL example
void mymodelTransitionFunction(struct CALModel3D* ca, int _i, int _j, int _k)
{
//snip
h = calGet3Dr(ca, Q...
OpenCAL example
¨  One day simulation, preliminary tests on Intel Core
i7-4702HQ CPU and nVidia GTX 680 GPU
Version Time ...
Active cells optimization
and stream compaction
In order to speed-up the simulation, computation can be restricted
to a su...
Another example:
SciddicaT for debris flow simulation
Parallel runs Quantization
Preliminary tests on Intel Core i7-4702HQ...
OpenCAL development state
q  OpenCAL version 1.0 is going to be released within this
year; source code is already freely ...
OpenCAL development state
q  Currently we are migrating a CA-based eco-hydrological model
from CAMELot (the previous CCA ...
OpenCAL development state
q  Huge potential with GPU parallelization (OpenCL)!!!
Several optimization
steps performed ove...
OpenCAL future developments
q  OpenCAL-cuda parallel GPGPU version
q  OpenCAL-MPI parallel message passing version
q  B...
Alfonso Senatore
Upcoming SlideShare
Loading in …5
×

Alfonso Senatore

204 views

Published on

OpenCAL: a new library for computational science on parallel computers based on cellular automata paradigm

Published in: Science
  • Be the first to comment

  • Be the first to like this

Alfonso Senatore

  1. 1. A NEW LIBRARY FOR COMPUTATIONAL SCIENCE ON PARALLEL COMPUTERS BASED ON THE CELLULAR AUTOMATA PARADIGM Workshop on coupled hydrological modeling 23-24 September 2015 Centre of Hydrology “Dino Tonini”, University of Padua, Italy Donato D’Ambrosio, William Spataro Dept. of Mathematics and Computer Science, University of Calabria Giuseppe Mendicino, Alfonso Senatore Dept. of Environmental and Chemical Engineering, University of Calabria OpenCAL
  2. 2. What is OpenCAL? q  OpenCAL (Open Cellular Automata Library) is a new Open Source parallel software library for Complex Cellular Automata (CCA), designed and developed at the Department of Mathematics and Computer Science at UniCAL q  Provides data structures, functions and algorithms both for 2D/3D CCA q  Parallelism is quasi-transparent to the user, i.e. the user does not require in depth knowledge of Parallel Computing q  Different versions for different computing devices have been implemented: ¤  OpenCAL, for serial execution on CPUs ¤  OpenCAL-OMP, based on OpenMP, for parallel execution on CPUs ¤  OpenCAL-CL, based on OpenCL, for parallel execution on GPUs ¤  OpenCAL-GL, based on OpenGL compatibility profile, for interactive 2D/3D visualization
  3. 3. OpenCAL serial and OMP developing model OpenCAL is written in the C programming language and is cross-platform E.g.: the user can develop the application under Windows using Visual Studio, also exploiting its debug facilities, and run it under Linux
  4. 4. Cellular Automata (CA) q  Cellular Automata are discrete parallel computational models, widely utilized for modeling and simulating complex systems q  CA are composed of a n-dimensional grid of simple computing units called cells q  At time t = 0 cells’ states define the initial condition of the CA q  Cells change state simultaneously (i.e. in parallel) at discrete time steps by means of the cell state transition function q  State transition function takes as input the states of the cell’s neighborhood
  5. 5. Complex Cellular Automata (CCA) A = (Ed, X, Q, P, σ) • Ed set of cells where the phenomenon evolves • X neighborood • Q cartesian product of the set of the values of the substates, e.g. • P CA global parameters (e.g. cell dimension, time step), can also vary in time • σ Qn → Q transition function, split in p elementary processes. E.g. σ1 – K, θ updating through charac- teristic equations θ = θ (ψ), K = K(ψ) σ2 – h, ψ updating through the unsaturated soil flux equation h KQ Q Q Q Q Qψ θ ∂= × × × × Mendicino et al., 2006, WRR, for further details
  6. 6. Complex Cellular Automata (CCA) Mendicino et al., 2006, WRR, for further details q  The discrete formulation of any field equation can be modeled through the CA (CCA) paradigm q  The Computing Space hypothesis: “The physical behavior of the entire universe is being computed on a basic level, possibly on CA, by the universe itself” (K. Zuse) 1c c c c m S t α α Δ Φ + =∑ ρ Δ c c c c m v t t θ ρ Δ Δ = Δ Δ c c c c c c h h C t h t t θ θΔ Δ Δ Δ = = Δ Δ Δ Δ c c c c h h K A K i A l α α α α α α α α ⎛ ⎞− Φ = − = −⎜ ⎟ ⎝ ⎠ Discrete 3D mass balance equation Unsaturated soil flux equation ( ) c c c c c c c h h h K A v C S l t α α α α α ψ ⎛ ⎞− Δ − + =∑ ⎜ ⎟ Δ⎝ ⎠
  7. 7. OpenCAL serial and OMP developing model In order to define the CCA, the user needs to: q  Define a CA object and initialize its parameters q  Cellular space dimensions q  Type of neighborhood q  Cellular space boundary conditions q  Type of optimization (if any) q  Define a simulation object and initialize its parameters q  The cellular automaton to use q  The initial and final computational steps q  Define CCA substates q  Define transition function’s elementary processes q  Optionally, the user can define some global functions q  initialization function q  Steering function (operations over the CA space or given sub- regions)
  8. 8. OpenCAL example 3D test based on Smyth et al. (1989) benchmark, involving transient, two-dimensional infiltration of water into an extremely dry heterogeneous soil, structured by four soil types with different hydraulic properties Folino et al., 2006, Parallel Computing
  9. 9. OpenCAL example #include <cal3D.h> //snip struct mymodelSubstates { struct CALSubstate3Dr *teta; struct CALSubstate3Dr *moist_cont; struct CALSubstate3Dr *psi; struct CALSubstate3Dr *k; struct CALSubstate3Dr *h; struct CALSubstate3Dr *dqdh; } Q; int main ( ) { struct CALModel3D* mymodel; mymodel = calCADef3D (ROWS, COLS, LAYERS, CAL_VON_NEUMANN_NEIGHBORHOOD_3D, CAL_SPACE_TOROIDAL, CAL_NO_OPT); OpenCAL library Defining the CA object and initializing its parameters
  10. 10. OpenCAL example Q.teta = calAddSubstate3Dr(mymodel); Q.moist_cont = calAddSubstate3Dr(mymodel); Q.psi = calAddSubstate3Dr(mymodel); Q.k = calAddSubstate3Dr(mymodel); Q.h = calAddSubstate3Dr(mymodel); Q.dqdh = calAddSubstate3Dr(mymodel); struct CALRun3D* mymodelSimulation; mymodelSimulation = calRunDef3D(mymodel, 1, CAL_RUN_LOOP, CAL_UPDATE_IMPLICIT); calAddElementaryProcess3D(mymodel, mymodelTransitionFunction); calRunAddInitFunc3D(mymodelSimulation, mymodelSimulationInit); calRunAddSteeringFunc3D(mymodelSimulation, mymodelSimulationSteering); calRunAddStopConditionFunc3D(mymodelSimulation, mymodelSimulationStopCondition); //snip } Defining CA substates Defining the simulation object and initializing its parameters Calling transition function Global functions
  11. 11. OpenCAL example void mymodelTransitionFunction(struct CALModel3D* ca, int _i, int _j, int _k) { //snip h = calGet3Dr(ca, Q.h, _i, _j, _k); //-------------------------------- Unsaturated soil flux equation for (i=0;i<mymodel->sizeof_X;i++) { Delta_h = h-calGetX3Dr(mbusu, Q.h, _i, _j, _k, i); temp_value = ((calGet3Dr(mymodel, Q.k, _i, _j, _k) + calGetX3Dr (mymodel, Q.k, _i, _j, _k, i)) / 2.0) * calGet3Dr(mymodel, Q.dqdh, _i, _j, _k); h=h-((Delta_h/(lato*lato))*delta_t*temp_value); } psi=h-z; //--------------------------- Characteristic equations //snip //---Update calSet3Dr(mymodel, Q.h, _i, _j, _k, h); calSet3Dr(mymodel, Q.psi, _i, _j, _k, psi); calSet3Dr(mymodel, Q.k, _i, _j, _k, k); //snip } Ready-to-use parallel code
  12. 12. OpenCAL example ¨  One day simulation, preliminary tests on Intel Core i7-4702HQ CPU and nVidia GTX 680 GPU Version Time (s) Serial 695 OpenMP 162 4+4 cores OpenCL 68 1536 CUDA cores
  13. 13. Active cells optimization and stream compaction In order to speed-up the simulation, computation can be restricted to a subset of the computational domain (quantization)
  14. 14. Another example: SciddicaT for debris flow simulation Parallel runs Quantization Preliminary tests on Intel Core i7-4702HQ CPU and nVidia Quadro 1100M GPU Preliminary tests on Intel Core i7-4702HQ CPU Version Time (s) Serial 170 OpenMP 109 OpenCL 5 Version Time (s) No opt 170 Active cells 20 Avolio et al., 2000, International Journal of Applied Earth Observation and Geoinformation 384 CUDA cores 4+4 cores
  15. 15. OpenCAL development state q  OpenCAL version 1.0 is going to be released within this year; source code is already freely available at the URL https://github.com/OpenCALTeam/opencal
  16. 16. OpenCAL development state q  Currently we are migrating a CA-based eco-hydrological model from CAMELot (the previous CCA software, no longer supported) to OpenCAL Mendicino et al., 2015, Commun Nonlinear Sci Numer Simulat
  17. 17. OpenCAL development state q  Huge potential with GPU parallelization (OpenCL)!!! Several optimization steps performed over a single test case – Biosphere 2 LEO hillslope – Vegetation cover 15% – height of depression storage 0.0 cm – Cumulated rain of 56.8 mm in 4.5 h Final results Speedup trend over CA dimension using single precision variable, number of steps fixed at 2000 and workgroup fixed at (5x5x5)
  18. 18. OpenCAL future developments q  OpenCAL-cuda parallel GPGPU version q  OpenCAL-MPI parallel message passing version q  Bindings for Fortran, Python and other languages q  Packages for most popular Linux distributions (Debian, Ubuntu, Mint, OpenSuse, Fedora, etc) alfonso.senatore@unical.it

×