mipardo / pi-decimals-mpi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

drawing drawing

This program computes the Pi number using different Spigot algorithms. To perform the operations it is used a floating point precision arithmetic library. PiDecimals allows you to use GMP (The GNU Multiple Precision Arithmetic Library) or MPFR (The GNU Multiple Precision Floating-Point Reliable Library) to compute the Pi number with the algorithms supported.

This version has been developed for clusters. It can be used as a benchmark to compare and test the CPU performance in cluster environments. Processes are managed with MPI and threads are managed with OpenMP.

drawing

drawing

Spigot Algorithms

Currently, PiDecimalsMPI allows you to compute Pi using three different algorithms:

  • Bailey-Borwein-Plouffe. The expression is presented below:

drawing

  • Bellard. The expression is presented as follows:

drawing

  • Chudnovsky. The expression is shown below:

drawing

Multiple Precision Floating Point Libraries

Currently, PiDecimals allows yoy to compute Pi using two different floating point arithmetic libraries:

Compilation and Installation

To compile the code succesfully it is necessary to have installed MPI, OpenMP, GMP and MPFR library. If you are using a Linux distro it is very likely that you already have these dependencies installed.

To compile the source code use the "compile.sh" located at the root project directory. In the future it is expected to replace the bash script with a Make file.

Launch

When the source code is compiled you are ready to launch:

mpirun -np num_procs ./PiDecimalsMPI.x library algorithm precision num_threads [-csv]
  • num_procs param is the number of processes that you want to use to perform the operations.
  • library can be 'GMP' or 'MPFR'.
  • algorithm is a value between 0 and X. The X value may depend on the library used.
  • precision param is the value of precision you want to use to perform the operations.
  • num_threads param is the number of threads that you want to use to perform the operations.
  • -csv param is optional. If this param is used the program will show the results in csv format.

En example of use could be:

mpirun -np 2 ./PiDecimalsMPI.x MPFR 1 50000 4

And the output could be:

image

About


Languages

Language:C 99.0%Language:Shell 1.0%