Giter VIP home page Giter VIP logo

hpp-hpc's Introduction

Intro

This repository contains three parallel implementations in C of the Hardy–Pomeau–Pazzis (HPP) cellular automaton, a simple model for fluid propagation from the Lattice Gas family (Lattice-Gas Cellular Automata or LGCA). The automaton involves a two-dimensional stencil computation problem.

In particular, the repository contains:

  • A parallel version leveraging a shared memory model via OpenMP, achieved by incrementally applying different optimization techniques.
  • A parallel version utilizing a distributed memory model with Open MPI, exploiting synchronous MPI_SendRecv routines for communication between processes.
  • A parallel version based on a distributed memory model with Open MPI, replacing MPI_SendRecv calls with MPI_Isend and MPI_Irecv asynchronous routines to further reduce communication overhead and improve performance.

The versions are not reimplementations of the same solution strategy, but provide 3 different ways to tackle the problem.

Techs

C, OpenMP, Open MPI, Docker.

Documentation

The solution strategies adopted are explained in the comments along with the code. Contact me for further documentation.

How to deploy & use

To ease deployment and make it platform-independent, this repository includes a Dockerfile that isolates the executables in a container.

Prerequisites

  • Docker (tested with version 20.10.22)
  • Git (tested with version 2.30.1)

Steps

  1. Clone the repo into the desired folder:
    git clone https://github.com/danielegiulianini/hpp-hpc
  1. Move inside the downloaded folder:
    cd hpp-hpc
  1. Build the image by running:
    docker build -t hpp-hpc .
  1. Start the container from the created image (implying source compilation) giving it a custom name (replacing <container-name> with it):
    docker run -it --name <container-name> hpp-hpc
  1. Run the parallel programs and generate the animations of the HPP cellular automaton. Optional: configure the simulation parameters:
  • n. of threads/processes executing (default: 2);
  • Input image (default: cannon.in; alternative: box.in)
  • image size (default: 256 pixels); by passing the corresponding key-value pairs to make ("[" and "]" just stands for optionality):
    make all-movies [EXECUTION_UNITS=2 MOVIE_SIZE=256 INPUT_FILE=cannon.in]
  1. Now you can inspect the video generated by the programs to check for their correctness (files named: omp-hppmovie.avi, mpi-sendrecv-hppmovie.avi, and mpi-isend-hppmovie.avi for OpenMP, Open MPI with MPI_SendRecv and Open MPI with MPI_Isend, respectively).
    mpv --no-config --vo=tct omp-hppmovie.avi
  1. You can run the executables with different configurations to analyze performance and outputs; just remember to clean the previous programs outputs before rerunning:
    make clean
    make all-movies [EXECUTION_UNITS=4 MOVIE_SIZE=512 INPUT_FILE=cannon.in]
  1. Finally, free up the resources associated to the container:
    docker remove <container-name>

hpp-hpc's People

Contributors

danielegiulianini avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.