Skip to content

Commit 2acd338

Browse files
committed
more benchmarks
1 parent 7e5a75d commit 2acd338

File tree

2 files changed

+82
-2
lines changed

2 files changed

+82
-2
lines changed

SwiftMetalProcessing/ViewController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ class ViewController: UIViewController {
1616
override func viewDidLoad() {
1717
super.viewDidLoad()
1818

19-
19+
let start0 = CACurrentMediaTime()
20+
2021
// prepare original input data – a Swift array
21-
var myvector = [Float](count: 123456, repeatedValue: 0)
22+
var myvector = [Float](count: 10000000, repeatedValue: 0)
2223
for (index, value) in enumerate(myvector) {
2324
myvector[index] = Float(index)
2425
}
2526

27+
let stop0 = CACurrentMediaTime()
28+
let delta0 = (stop0-start0)*1000000.0
29+
println("filling array took \(delta0) microseconds")
30+
2631
// initialize Metal
2732
var (device, commandQueue, defaultLibrary, commandBuffer, computeCommandEncoder) = initMetal()
2833

simplebenchmark/benchmark.txt

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,81 @@
1+
A) number of elements: 123456
2+
13
2014-12-16 12:22:12.307 SwiftMetalProcessing[1660:497840] Metal GPU Frame Capture Enabled
24
2014-12-16 12:22:12.309 SwiftMetalProcessing[1660:497840] Metal API Validation Enabled
35
cold GPU: runtime in microsecs : 185110.416787211
46
0.5
57
CPU: runtime in microsecs : 47843169.1665901
68
relativespeed = 258.457465533055
9+
10+
B) number of elements: 1234567
11+
12+
filling array took 37754876.9166606 microseconds
13+
2014-12-16 12:48:12.529 SwiftMetalProcessing[1674:503863] Metal GPU Frame Capture Enabled
14+
2014-12-16 12:48:12.531 SwiftMetalProcessing[1674:503863] Metal API Validation Enabled
15+
cold GPU: runtime in microsecs : 659326.249879086
16+
0.5
17+
CPU: runtime in microsecs : 483907755.833352
18+
relativespeed = 733.942802856849
19+
20+
C) number of elements: 12345
21+
filling array took 392090.833338443 microseconds
22+
2014-12-16 13:00:48.332 SwiftMetalProcessing[1683:506570] Metal GPU Frame Capture Enabled
23+
2014-12-16 13:00:48.333 SwiftMetalProcessing[1683:506570] Metal API Validation Enabled
24+
cold GPU: runtime in microsecs : 69997.0831919927
25+
0.5
26+
CPU: runtime in microsecs : 5653783.33325498
27+
relativespeed = 80.7716989827619
28+
29+
D) number of elements: 1234
30+
filling array took 45910.2916793199 microseconds
31+
2014-12-16 13:01:11.848 SwiftMetalProcessing[1690:506887] Metal GPU Frame Capture Enabled
32+
2014-12-16 13:01:11.849 SwiftMetalProcessing[1690:506887] Metal API Validation Enabled
33+
cold GPU: runtime in microsecs : 51162.0834004134
34+
0.5
35+
CPU: runtime in microsecs : 533953.750127694
36+
relativespeed = 10.4365130315115
37+
38+
E) number of elements: 123
39+
filling array took 10645.3750049695 microseconds
40+
2014-12-16 13:01:33.749 SwiftMetalProcessing[1697:507169] Metal GPU Frame Capture Enabled
41+
2014-12-16 13:01:33.749 SwiftMetalProcessing[1697:507169] Metal API Validation Enabled
42+
cold GPU: runtime in microsecs : 43723.7499863841
43+
0.5
44+
CPU: runtime in microsecs : 49662.0833291672
45+
relativespeed = 1.13581482248509
46+
47+
F) number of elements: 12
48+
filling array took 6889.83334111981 microseconds
49+
2014-12-16 13:01:56.817 SwiftMetalProcessing[1704:507447] Metal GPU Frame Capture Enabled
50+
2014-12-16 13:01:56.818 SwiftMetalProcessing[1704:507447] Metal API Validation Enabled
51+
cold GPU: runtime in microsecs : 46259.1667019296
52+
0.5
53+
CPU: runtime in microsecs : 5571.25007617287
54+
relativespeed = 0.1204355908975
55+
56+
G) number of elements: 1
57+
filling array took 6692.37499823794 microseconds
58+
2014-12-16 13:02:30.052 SwiftMetalProcessing[1711:507785] Metal GPU Frame Capture Enabled
59+
2014-12-16 13:02:30.052 SwiftMetalProcessing[1711:507785] Metal API Validation Enabled
60+
cold GPU: runtime in microsecs : 45577.9167532455
61+
0.5
62+
CPU: runtime in microsecs : 900.000013643876
63+
relativespeed = 0.0197464052276981
64+
65+
H) number of elements: 10000000 (10 million)
66+
filling array took 305784797.541666 microseconds
67+
2014-12-16 13:10:26.122 SwiftMetalProcessing[1727:508964] Metal GPU Frame Capture Enabled
68+
2014-12-16 13:10:26.123 SwiftMetalProcessing[1727:508964] Metal API Validation Enabled
69+
cold GPU: runtime in microsecs : 3179862.08334332
70+
0.5
71+
CPU: runtime in microsecs : 3908226572.91676
72+
relativespeed = 1229.0553711083
73+
74+
I) number of elements: 1000000 (1 million)
75+
filling array took 30580217.2916738 microseconds
76+
2014-12-16 13:03:42.253 SwiftMetalProcessing[1719:508194] Metal GPU Frame Capture Enabled
77+
2014-12-16 13:03:42.254 SwiftMetalProcessing[1719:508194] Metal API Validation Enabled
78+
cold GPU: runtime in microsecs : 495616.249972954
79+
0.5
80+
CPU: runtime in microsecs : 390826717.500022
81+
relativespeed = 788.567197950731

0 commit comments

Comments
 (0)