GithubHelp home page GithubHelp logo

stargate01 / hpcgol Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 0.0 5.11 MB

High performance Conway's Game of Life

License: MIT License

Makefile 3.36% Fortran 94.11% Shell 2.53%
hpc mpi openmp vectorization simd conways-game-of-life

hpcgol's Introduction

High performance Conway's Game of Life

High performance Conway's Game of Life. See https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life.

Modules

  • Exploitation of cache locality and memory layout (simple)
  • Optimized kernel (simple_opt)
  • Vectorization (sub-optimal in this use-case, not recommended) using
    • The Auto-Vectorizer (simple_simd)
    • OpenMP SIMD (simple_simd2)
  • Thread-level parallelism using OpenMP (threads)
  • CPU-Node parallelism using MPI (nodes)
  • Thread-level and CPU-Node hybrid parallelism using OpenMP and MPI (hybrid)

Installation

Run sudo make deps if your package manager ist apt, otherwise install these packages:

  • gfortran
  • mpich
  • libmpich-dev

Compilation

Run make all or make modulename or make bin/modulename to build all resp. a single program.

Run make clean to remove all binaries.

Debugging and optimization

To enable debug symbols and disable code optimization, define the DEBUG makefile variable when calling make, like this: make modulename DEBUG=1.

To enable all possible compiler optimizations in order to produce fast code, do not define the DEBUG variable. Note that due to aggressive optimization binaries are generally not portable between different CPUs.

MPICH2 vs OpenMPI

If you want to use OpenMPI instead of MPICH2, the code should compile and work but I have not tested this yet but may support it in the future.

GNU compiler vs Intel compiler

Instead of the GNU compiler gfortran the intel compiler ifort may be used by defining the makefile variable INTEL. In general, every OpenMP- and MPI-capable Fortran-2008 standard compliant compiler should work.

Execution

The included makefile has a run target, which should be used to launch the binaries. Note that also invokes the compilation. The syntax and some default values are as follows:

make run EXE=modulename ARG_PRINT=1 ARG_STEPS=15 ARG_WIDTH=10 ARG_HEIGHT=10 ARG_THREADS=1 ARG_NODES=1

  • EXE: The name of the module to launch, see above.
  • ARG_PRINT: 1 to print the field as ACII, 0 to not print it. This is only recommended for small field sizes.
  • ARG_STEPS: The number of iterations to compute.
  • ARG_WIDTH: The width in cells of the field.
  • ARG_HEIGHT: The height in cells of the field.
  • ARG_THREADS: The number of threads to use. Note that more threads than your system has CPU cores or hyper-threads may slow things down.
  • ARG_NODES: The number of MPI nodes to use. If there is no MPI cluster available, hydra will automatically emulate a cluster using multiple processes.

Recommended settings

Use the default values above to test the program using its graphical output.

A field size of 10000 times 10000 is a reasonable first scale test, it runs with about 0.2 - 1 steps per second on most laptops and PCs, depending on optimization and CPU speed.

Memory requirements

The minimum amount of required RAM is roughly 2 * ARG_WIDTH * ARG_HEIGHT bytes. When running on a MPI cluster, this memory is equally distributed.

IDE support

The Visual Studio Code IDE (See https://code.visualstudio.com/) is supported. But any other IDE capable of launching makefiles should work.

hpcgol's People

Contributors

stargate01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.