Révision 247 Pi/C/OpenMP/Pi_OpenMP.c
Pi_OpenMP.c (revision 247) | ||
---|---|---|
1 | 1 |
// |
2 | 2 |
// Estimation of Pi using Monte Carlo exploration process |
3 | 3 |
// Cecill v2 Emmanuel QUEMENER <emmanuel.quemener@gmail.com> |
4 |
// gcc -std=c99 -O3 -o Pi Pi.c -lm
|
|
4 |
// gcc -std=c99 -O3 -o Pi_OpenMP Pi_OpenMP.c -lm
|
|
5 | 5 |
// |
6 | 6 |
|
7 | 7 |
#include <math.h> |
... | ... | |
154 | 154 |
|
155 | 155 |
double itops=(double)(ParallelRate*IterationsEach)/elapsed; |
156 | 156 |
|
157 |
printf("ParallelRate %i\nElapsed Time %.2f\nItops %.0f\n",ParallelRate,elapsed,itops);
|
|
157 |
printf("ParallelRate %i\nElapsed Time %.2f\nItops %.0f\nLogItops %.2f\n",ParallelRate,elapsed,itops,log10(itops));
|
|
158 | 158 |
|
159 | 159 |
free(inside); |
160 | 160 |
|
... | ... | |
169 | 169 |
|
170 | 170 |
if (argc > 1) { |
171 | 171 |
iterations=(LENGTH)atoll(argv[1]); |
172 |
ParallelRate=atoi(argv[2]); |
|
172 |
if (argc > 2) { |
|
173 |
ParallelRate=atoi(argv[2]); |
|
174 |
} |
|
173 | 175 |
} |
174 | 176 |
else { |
175 | 177 |
printf("\n\tPi : Estimate Pi with Monte Carlo exploration\n\n"); |
Formats disponibles : Unified diff