example codes of common HPC kernels such as dense and sparse linear
1. pi
algebra, spectral and N-body methods, structured and unstructured
1. prng
grids, Monte Carlo methods and parallel I/O. The code samples are
1. prime
published as open source and can be used both for educational purposes
and as parts of real application suites (as permitted by particular
## Integral Basic
license).
### Files:
## How to contribute
1. integral1d.c
1. integral1d_mpi.c
Any contributions (new code samples, bug fixes, improvements etc.) are
1. integral1d_OMP.c
warmly welcome. In order to contribute, please follow the standard
Gitlab workflow:
#### integral1d.c
1. Fork the project into your personal space
* This example computes integral of ( 1 / (1 + x * x) ) in x=[0,1] by using importance sampling Monte Carlo method
2. Create a feature branch
3. Work on your contributions
* This code is a serial algorithm, no need for any external library
4. Push the commit(s) to your fork
5. Submit a merge request to the master branch
* This is one of the code sample from the PRACE CodeVault. You can find more code samples available for download from the PRACE CodeVault here: https://gitlab.com/PRACE-4IP/CodeVault
## Compilation instructions
***Relase Date:** 28 January 2016
The pre-requisites are:
***Version:** 1.0 (initial version)
* CMake 2.8.10 or higher. CMake >= 3.0.0 if you want to build everything.
***Contributors:** Ahmet Tuncer DURAK (UHeM, ITU, TURKEY), Samet DEMIR (ITU, TURKEY)
***Copyright:** None. The code is free to copy, modify and use, but comes with no warranty and therefore usage is at your own risk.
In order to build the code, follow the typical CMake steps for an
***Language:** This code sample file is written in C. No external libraries are required.
out-of-source build:
***Parallelisation Implementation:** This file is a serial code
```bash
mkdir build
***Level of the code sample complexity:** Code sample complexity is simple and intended for new starters.
cd build
cmake ..
***Instructions on how to compile the code:** Load a supported programming environment or compiler [GNU, PGI, Intel, Clang], Use the CodeVault CMake infrastructure, see main README.md
make
make install# optional
***Instructions on how to run the code:** ./7_montecarlo_integral1d_serial trial#
```
***Sample input:** There is one already in the code (1 / (1 + x * x)), can be changed from the code.
***Sample output:** For a trial of 100 output is
computed value of the integral= 0.784455
true value of the integral= 0.785398
error= 0.000943
#### integral1d_mpi.c
* This code sample computes integral of ( 1 / (1 + x * x) ) in x=[0,1] by using importance sampling Monte Carlo method
* A MPI framework is needed to run the code
* This is one of the code sample from the PRACE CodeVault. You can find more code samples available for download from the PRACE CodeVault here: https://gitlab.com/PRACE-4IP/CodeVault
***Relase Date:** 28 January 2016
***Version: 1.0** (initial version)
***Contributors:** Ahmet Tuncer DURAK (UHeM, ITU, TURKEY), Samet DEMIR (ITU, TURKEY)
***Copyright:** None. The code is free to copy, modify and use, but comes with no warranty and therefore usage is at your own risk.
***Language:** This code sample file is written in C.
***Parallelisation Implementation:** MPI
***Level of the code sample complexity:** Code sample complexity is simple and intended for new starters.
***Instructions on how to compile the code:** Load a supported programming environment or compiler [GNU, PGI, Intel, Clang], Use the CodeVault CMake infrastructure, see main README.md
***Instructions on how to run the code:** mpirun -n 4 ./7_montecarlo_integral1d_serial #trial (for 4 process)
* This code sample computes integral of ( 1 / (1 + x * x) ) in x=[0,1] by using importance sampling Monte Carlo method
* Additional pre-requisites: OpenMP
***Relase Date:** 28 January 2016
***Version:** 1.0 (initial version)
***Contributors:** Ahmet Tuncer DURAK (UHeM, ITU, TURKEY), Samet DEMIR (ITU, TURKEY)
***Copyright:** None. The code is free to copy, modify and use, but comes with no warranty and therefore usage is at your own risk.
***Language:** This code sample file is written in C.
***Parallelisation Implementation:** OpenMP
***Level of the code sample complexity:** Code sample complexity is simple and intended for new starters.
***Instructions on how to compile the code:** Load a supported programming environment or compiler [GNU, PGI, Intel, Clang], Use the CodeVault CMake infrastructure, see main README.md
***Instructions on how to run the code:** ./7_montecarlo_integral1d_openmp thread# trial#
* This code sample calculates the value of pi by using Monte Carlo Methods.
* This code is a serial algorithm, no need for any external library
* This is one of the code sample from the PRACE CodeVault. You can find more code samples available for download from the PRACE CodeVault here: https://gitlab.com/PRACE-4IP/CodeVault
***Relase Date:** 28 January 2016
***Version:** 1.0 (initial version)
***Contributors:** Ahmet Tuncer DURAK (UHeM, ITU, TURKEY), Samet DEMIR ( ITU, TURKEY)
***Copyright:** None. The code is free to copy, modify and use, but comes with no warranty and therefore usage is at your own risk.
***Language:** This code sample file is written in C. No external libraries are required.
***Parallelisation Implementation:** This file is a serial code
***Level of the code sample complexity:** Code sample complexity is simple and intended for new starters.
***Instructions on how to compile the code:** Load a supported programming environment or compiler [GNU, PGI, Intel, Clang], Use the CodeVault CMake infrastructure, see main README.md
***Instructions on how to run the code:** ./7_montecarlo_pi_serial seed# N
seed (integer): seed for the pseudo random number generator
* This code sample calculates the value of pi by using Monte Carlo Methods.
***Additional pre-requisites:** OpenMP
* This is one of the code sample from the PRACE CodeVault. You can find more code samples available for download from the PRACE CodeVault here: https://gitlab.com/PRACE-4IP/CodeVault
***Relase Date:** 28 January 2016
***Version:** 1.0 (initial version)
***Contributors:** Ahmet Tuncer DURAK (UHeM, ITU, TURKEY), Samet DEMIR ( ITU, TURKEY)
***Copyright:** None. The code is free to copy, modify and use, but comes with no warranty and therefore usage is at your own risk.
***Language:** This code sample file is written in C. No external libraries are required.
***Parallelisation Implementation:** OpenMP
***Level of the code sample complexity:** Code sample complexity is simple and intended for new starters.
***Instructions on how to compile the code:** Load a supported programming environment or compiler [GNU, PGI, Intel, Clang], Use the CodeVault CMake infrastructure, see main README.md
***Instructions on how to run the code:** ./7_montecarlo_pi_omp seed# N
seed (integer): seed for the pseudo random number generator
* This code sample calculates the value of pi by using Monte Carlo Methods.
***Additional pre-requisites:** MPI
* This is one of the code sample from the PRACE CodeVault. You can find more code samples available for download from the PRACE CodeVault here: https://gitlab.com/PRACE-4IP/CodeVault
***Relase Date:** 28 January 2016
***Version:** 1.0 (initial version)
***Contributors:** Ahmet Tuncer DURAK (UHeM, ITU, TURKEY), Samet DEMIR ( ITU, TURKEY)
***Copyright:** None. The code is free to copy, modify and use, but comes with no warranty and therefore usage is at your own risk.
***Language:** This code sample file is written in C. No external libraries are required.
***Parallelisation Implementation:** MPI
***Level of the code sample complexity:** Code sample complexity is simple and intended for new starters.
***Instructions on how to compile the code:** Load a supported programming environment or compiler [GNU, PGI, Intel, Clang], Use the CodeVault CMake infrastructure, see main README.md
***Instructions on how to run the code:** mpirun -n 4 ./7_montecarlo_pi_omp seed# N# (for 4 process)
seed (integer): seed for the pseudo random number generator