Calculating PI Value In Different Parallel Framework.
We use Riemann Sum with Midpoint Rule to calculate the integration, which includes loops that may be optimized using parallel computing.
Use pthread
as the parallel framework.
Use OpenMP
as the parallel framework to calculate Pi.
Note that in macOS the default clang
does not support OpenMP
, thus it needs to be built with gcc
or llvm
.
gcc
could be directly installed by
brew install gcc
and llvm
could be installed via
brew install llvm
Use MPI
as the parallel framework.
Use CUDA
to optimize the parallel computing process, which must be run under CUDA environment. i.e., you must have
at least a nVidia card and nvcc
installed to compile and run the code.
Use mixed method of MPI
and OpenMP
to gain scalability and high parallel performance at the same time.
All experiments are carried out under Linux
with nvcc
and nVidia cards installed.
And I chose 2^30 as the STEP_NUM for all framework.
Parallel parameters are listed below:
Framework | Parameters |
---|---|
OpenMP | 16 Threads |
MPI | 16 Processes |
PThread | 16 Threads |
CUDA | 512 Threads / 64 Blocks |
MPIOMP | 4 Processes / 4 Threads |
MIT.