Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pub
pi
Commits
cbff4cdb
Commit
cbff4cdb
authored
Jul 01, 2019
by
Neil Gershenfeld
Browse files
wip
parent
4e839218
Pipeline
#3793
passed with stage
in 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
OpenMP/mppi.c
View file @
cbff4cdb
...
...
@@ -8,11 +8,12 @@
#include <stdio.h>
#include <time.h>
#include <omp.h>
#include <stdint.h>
#define NPTS 1000000000
#define NPTS 1000000000
00
void
main
()
{
int
i
;
u
int
64_t
i
;
double
a
,
b
,
c
,
pi
,
dt
,
mflops
;
struct
timespec
tstart
,
tend
;
clock_gettime
(
CLOCK_REALTIME
,
&
tstart
);
...
...
@@ -27,6 +28,6 @@ void main() {
clock_gettime
(
CLOCK_REALTIME
,
&
tend
);
dt
=
(
tend
.
tv_sec
+
tend
.
tv_nsec
/
1e9
)
-
(
tstart
.
tv_sec
+
tstart
.
tv_nsec
/
1e9
);
mflops
=
NPTS
*
5
.
0
/
(
dt
*
1e6
);
printf
(
"NPTS = %d, pi = %f, threads = %d
\n
"
,
NPTS
,
pi
,
omp_get_max_threads
());
printf
(
"NPTS = %
l
d, pi = %f, threads = %d
\n
"
,
NPTS
,
pi
,
omp_get_max_threads
());
printf
(
"time = %f, estimated MFlops = %f
\n
"
,
dt
,
mflops
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment