Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
pi
Commits
7277cbd1
Commit
7277cbd1
authored
6 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
f5d40df2
No related branches found
No related tags found
No related merge requests found
Pipeline
#2721
passed
6 years ago
Stage: deploy
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
JavaScript/pi.html
+4
-4
4 additions, 4 deletions
JavaScript/pi.html
Node/clusterpi.js
+1
-1
1 addition, 1 deletion
Node/clusterpi.js
Node/pi.js
+19
-0
19 additions, 0 deletions
Node/pi.js
README.md
+1
-0
1 addition, 0 deletions
README.md
with
25 additions
and
5 deletions
JavaScript/pi.html
+
4
−
4
View file @
7277cbd1
...
@@ -17,9 +17,9 @@ function serial_benchmark() {
...
@@ -17,9 +17,9 @@ function serial_benchmark() {
var
pi
=
0
var
pi
=
0
var
tstart
=
Date
.
now
()
/
1000
var
tstart
=
Date
.
now
()
/
1000
for
(
var
i
=
1
;
i
<=
points
;
++
i
)
for
(
var
i
=
1
;
i
<=
points
;
++
i
)
pi
+=
a
/
((
i
-
b
)
*
(
i
-
c
))
;
pi
+=
a
/
((
i
-
b
)
*
(
i
-
c
))
var
tend
=
Date
.
now
()
/
1000
var
tend
=
Date
.
now
()
/
1000
var
mflops
=
points
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
;
var
mflops
=
points
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
document
.
getElementById
(
'
div_pi_serial
'
).
innerHTML
=
'
pi:
'
+
pi
document
.
getElementById
(
'
div_pi_serial
'
).
innerHTML
=
'
pi:
'
+
pi
document
.
getElementById
(
'
div_time_serial
'
).
innerHTML
=
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
document
.
getElementById
(
'
div_time_serial
'
).
innerHTML
=
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
document
.
getElementById
(
'
div_flop_serial
'
).
innerHTML
=
'
estimated MFlops:
'
+
mflops
.
toFixed
(
1
)
document
.
getElementById
(
'
div_flop_serial
'
).
innerHTML
=
'
estimated MFlops:
'
+
mflops
.
toFixed
(
1
)
...
@@ -34,7 +34,7 @@ function reduce_benchmark() {
...
@@ -34,7 +34,7 @@ function reduce_benchmark() {
var
array
=
new
Float64Array
(
points
)
var
array
=
new
Float64Array
(
points
)
var
pi
=
array
.
reduce
(
function
(
sum
,
val
,
i
,
arr
){
return
sum
+
a
/
(((
i
+
1
)
-
b
)
*
((
i
+
1
)
-
c
))},
0
)
var
pi
=
array
.
reduce
(
function
(
sum
,
val
,
i
,
arr
){
return
sum
+
a
/
(((
i
+
1
)
-
b
)
*
((
i
+
1
)
-
c
))},
0
)
var
tend
=
Date
.
now
()
/
1000
var
tend
=
Date
.
now
()
/
1000
var
mflops
=
points
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
;
var
mflops
=
points
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
document
.
getElementById
(
'
div_pi_reduce
'
).
innerHTML
=
'
pi:
'
+
pi
document
.
getElementById
(
'
div_pi_reduce
'
).
innerHTML
=
'
pi:
'
+
pi
document
.
getElementById
(
'
div_time_reduce
'
).
innerHTML
=
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
document
.
getElementById
(
'
div_time_reduce
'
).
innerHTML
=
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
document
.
getElementById
(
'
div_flop_reduce
'
).
innerHTML
=
'
estimated MFlops:
'
+
mflops
.
toFixed
(
1
)
document
.
getElementById
(
'
div_flop_reduce
'
).
innerHTML
=
'
estimated MFlops:
'
+
mflops
.
toFixed
(
1
)
...
@@ -56,7 +56,7 @@ function parallel_benchmark() {
...
@@ -56,7 +56,7 @@ function parallel_benchmark() {
workers
[
evt
.
data
.
index
].
terminate
()
workers
[
evt
.
data
.
index
].
terminate
()
if
(
results
.
length
==
threads
)
{
if
(
results
.
length
==
threads
)
{
var
tend
=
Date
.
now
()
/
1000
var
tend
=
Date
.
now
()
/
1000
var
mflops
=
(
threads
*
points
)
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
;
var
mflops
=
(
threads
*
points
)
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
var
pi
=
results
.
reduce
(
function
(
x
,
y
){
return
x
+
y
},
0
)
var
pi
=
results
.
reduce
(
function
(
x
,
y
){
return
x
+
y
},
0
)
document
.
getElementById
(
'
div_pi_parallel
'
).
innerHTML
=
'
pi:
'
+
pi
document
.
getElementById
(
'
div_pi_parallel
'
).
innerHTML
=
'
pi:
'
+
pi
document
.
getElementById
(
'
div_time_parallel
'
).
innerHTML
=
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
document
.
getElementById
(
'
div_time_parallel
'
).
innerHTML
=
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
...
...
This diff is collapsed.
Click to expand it.
Node/clusterpi.js
+
1
−
1
View file @
7277cbd1
...
@@ -25,7 +25,7 @@ function master() {
...
@@ -25,7 +25,7 @@ function master() {
results
+=
1
results
+=
1
if
(
results
==
processes
)
{
if
(
results
==
processes
)
{
var
tend
=
Date
.
now
()
/
1000
var
tend
=
Date
.
now
()
/
1000
var
mflops
=
(
processes
*
points
)
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
;
var
mflops
=
(
processes
*
points
)
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
console
.
log
(
'
pi:
'
+
pi
)
console
.
log
(
'
pi:
'
+
pi
)
console
.
log
(
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
)
console
.
log
(
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
)
console
.
log
(
'
processes:
'
+
processes
)
console
.
log
(
'
processes:
'
+
processes
)
...
...
This diff is collapsed.
Click to expand it.
Node/pi.js
0 → 100644
+
19
−
0
View file @
7277cbd1
//
// pi.js
// Neil Gershenfeld 11/24/18
// pi calculation benchmark
// pi = 3.14159265358979323846
//
var
points
=
1
e8
var
a
=
0.5
var
b
=
0.75
var
c
=
0.25
var
pi
=
0
var
tstart
=
Date
.
now
()
/
1000
for
(
var
i
=
1
;
i
<=
points
;
++
i
)
pi
+=
a
/
((
i
-
b
)
*
(
i
-
c
))
var
tend
=
Date
.
now
()
/
1000
var
mflops
=
points
*
5.0
*
1
e
-
6
/
(
tend
-
tstart
)
console
.
log
(
'
pi:
'
+
pi
)
console
.
log
(
'
time:
'
+
(
tend
-
tstart
).
toFixed
(
1
)
+
'
s
'
)
console
.
log
(
'
estimated MFlops:
'
+
mflops
.
toFixed
(
1
))
This diff is collapsed.
Click to expand it.
README.md
+
1
−
0
View file @
7277cbd1
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
|9.371|
[
pi.c
](
C/pi.c
)
|C
<br>
gcc pi.c -o pi -lm -O3 -ffast-math|Intel i7-8700T|Nov 17, 2018|
|9.371|
[
pi.c
](
C/pi.c
)
|C
<br>
gcc pi.c -o pi -lm -O3 -ffast-math|Intel i7-8700T|Nov 17, 2018|
|3.734|
[
pi.html
](
https://pub.pages.cba.mit.edu/pi/JavaScript/pi.html
)
|JavaScript, 1 worker|Intel i7-8700T|Nov 17, 2018|
|3.734|
[
pi.html
](
https://pub.pages.cba.mit.edu/pi/JavaScript/pi.html
)
|JavaScript, 1 worker|Intel i7-8700T|Nov 17, 2018|
|3.472|
[
pi.html
](
https://pub.pages.cba.mit.edu/pi/JavaScript/pi.html
)
|JavaScript, 1 worker|Intel 2x E5-2680|Nov 19, 2018|
|3.472|
[
pi.html
](
https://pub.pages.cba.mit.edu/pi/JavaScript/pi.html
)
|JavaScript, 1 worker|Intel 2x E5-2680|Nov 19, 2018|
|3.817|
[
pi.js
](
Node/pi.js
)
|Node|Intel 2x E5-2680|Nov 24, 2018|
|3.007|
[
clusterpi.js
](
Node/clusterpi.js
)
|Node, 12 processes|Intel 2x E5-2680|Nov 24, 2018|
|3.007|
[
clusterpi.js
](
Node/clusterpi.js
)
|Node, 12 processes|Intel 2x E5-2680|Nov 24, 2018|
|0.573|
[
pi.c
](
C/pi.c
)
|C
<br>
gcc pi.c -o pi -lm|Intel i7-8700T|Nov 17, 2018|
|0.573|
[
pi.c
](
C/pi.c
)
|C
<br>
gcc pi.c -o pi -lm|Intel i7-8700T|Nov 17, 2018|
|0.470|
[
numpi.py
](
Python/numpi.py
)
|Python, NumPy|Intel i7-8700T|Nov 17, 2018|
|0.470|
[
numpi.py
](
Python/numpi.py
)
|Python, NumPy|Intel i7-8700T|Nov 17, 2018|
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment