GithubHelp home page GithubHelp logo

poisson-solver's Introduction

Poisson Solver

build

This project solve Poisson's equation on a 2D grid using either:

  1. A parallel openMP/openACC implementation of the Gauss-Seidel method
  2. or LAPACK

The goal was to practice openMP and openACC parallelization. This was a learning exercise and is not intended to serve as a comparison between LAPACK and GS method.

There is a build script scripts/build.sh.

The binary bin/solver outputs the discrete grid u_grid to a fort file fort.10. You can check that both methods produce the same answer.

Hardware Requirements

  • I have only tested on NVIDIA GPUs
  • For NVIDIA GPUs and openMP offloading a GPU with Compute Capability >= 7.0 is required

Results

openMP (CPU only)

Intel CPU - ifort compiler

For problem size:

  • ugrid[200,200]
  • tol = 1e-11 (GS only)

For this test run I compiled the code with ifort version 2021.7.0 (oneapi) but the code also works with GNU compiler gfortran.

The test was run on CPU Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz with 16 Gb RAM.

Walltime (s)

Procs LAPACK Gauss-Seidel
1 823 25
2 434 16
4 265 11

Maximum Memory

LAPACK Gauss-Seidel
11.6Gb 22Mb

Arm CPU - Gnu compiler

The test was run on arm CPU Neoverse-N1 with 512 Gb RAM.

Problem size u_grid dims = [300,300] number of iterations = 192018

Cores Time (s)
80 15.4646
64 14.1203
32 15.4587
16 21.6295
8 38.4833
4 70.8669
2 136.7466
1 270.7637

openACC (GPU)

The test was run on nvidia GPU NVIDIA A100 with 40 Gb RAM connected to the arm system above.

Problem size u_grid dims = [300,300] number of iterations = 192018

GPU Time (s)
na 17.7678

TODO

Continue to profile openACC version. Check for unneccessary memory transfers.

poisson-solver's People

Contributors

tommelt avatar

Watchers

 avatar

Forkers

isazi

poisson-solver's Issues

Build errors

I am trying to build this on our cluster. The build fails, and I found this error message:

   17 |   subroutine get_xy_pos(r, c, x, y)
      |
Error: ‘is_recursive.0’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:17:0: Error: ‘is_recursive.0’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:17:0: Error: ‘is_recursive.0’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:17:0: Error: ‘is_recursive.0’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:17:0: Error: ‘is_recursive.0’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:52:0:

   52 |   end subroutine init_grid
      |
Error: ‘is_recursive.14’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:52:0: Error: ‘is_recursive.14’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:52:0: Error: ‘is_recursive.14’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:52:0: Error: ‘is_recursive.14’ requires a ‘declare’ directive for use in a ‘routine’ function
/home/alessio/src/Poisson-Solver/src/grid_mod.f90:52:0: Error: ‘is_recursive.14’ requires a ‘declare’ directive for use in a ‘routine’ function

I am using NVHPC 22.5 and GCC 9.4.0

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.