README.md 8.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# README - Monte Carlo Methods

# Folders:
 1. integral_basic
 1. pi
 1. prng

## Integral Basic

### Files:
1. integral1d.c
1. integral1d_mpi.c
1. integral1d_OMP.c

#### integral1d.c

* This example computes integral of ( 1 / (1 + x * x) ) in x=[0,1] by using importance sampling Monte Carlo method

* 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_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)

* **Sample input:** mpirun -n 4 ./7_montecarlo_integral1d_serial 1000

* **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_OMP.c

* 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#

* **Sample input:** ./7_montecarlo_integral1d_openmp 4 10000

* **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

## Pi
	
### Files
1. pi_mpi.c
1. pi_omp.c
1. pi_serial.c
1. pi_shared.c
1. pi_shared.h

#### pi_serial.c

* 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
          a negative value indicates current timestamp
	N (integer)   : number of random samples to use

* **Sample input:** ./7_montecarlo_pi_serial 10 100000

* **Sample output:** 10	100000	1	3.142156	0.000563 (seed N thread calculated_pi error)

#### pi_omp.c

* 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
          a negative value indicates current timestamp
	N (integer)   : number of random samples to use

* **Sample input:** ./7_montecarlo_pi_serial 10 100000

* **Sample output:** 10	100000	1	3.142156	0.000563 (seed N thread calculated_pi error)


#### pi_mpi.c

* 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
          a negative value indicates current timestamp
	N (integer)   : number of random samples to use

* **Sample input:** mpirun -n 4 ./7_montecarlo_pi_omp 10 10000

* **Sample output:** 10	100000	1	3.142156	0.000563 (seed N thread calculated_pi error)