File tree Expand file tree Collapse file tree 2 files changed +116
-0
lines changed Expand file tree Collapse file tree 2 files changed +116
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/python
2
+
3
+ import os
4
+ import sys
5
+ import time
6
+ import numpy
7
+ from numpy .random import randn
8
+ from scipy .linalg import blas
9
+
10
+ def run_dsyrk (N ,l ):
11
+
12
+ A = randn (N ,N ).astype ('float64' )
13
+ C = randn (N ,N ).astype ('float64' )
14
+
15
+
16
+ start = time .time ();
17
+ for i in range (0 ,l ):
18
+ C = blas .dsyrk (1.0 ,A )
19
+ end = time .time ()
20
+
21
+ timediff = (end - start )
22
+ mflops = ( N * N * N ) * l / timediff
23
+ mflops *= 1e-6
24
+
25
+ size = "%dx%d" % (N ,N )
26
+ print ("%14s :\t %20f MFlops\t %20f sec" % (size ,mflops ,timediff ))
27
+
28
+
29
+ if __name__ == "__main__" :
30
+ N = 128
31
+ NMAX = 2048
32
+ NINC = 128
33
+ LOOPS = 1
34
+
35
+ z = 0
36
+ for arg in sys .argv :
37
+ if z == 1 :
38
+ N = int (arg )
39
+ elif z == 2 :
40
+ NMAX = int (arg )
41
+ elif z == 3 :
42
+ NINC = int (arg )
43
+ elif z == 4 :
44
+ LOOPS = int (arg )
45
+
46
+ z = z + 1
47
+
48
+ if 'OPENBLAS_LOOPS' in os .environ :
49
+ p = os .environ ['OPENBLAS_LOOPS' ]
50
+ if p :
51
+ LOOPS = int (p );
52
+
53
+ print ("From: %d To: %d Step=%d Loops=%d" % (N , NMAX , NINC , LOOPS ))
54
+ print ("\t SIZE\t \t \t Flops\t \t \t \t \t Time" )
55
+
56
+ for i in range (N ,NMAX + NINC ,NINC ):
57
+ run_dsyrk (i ,LOOPS )
58
+
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/python
2
+
3
+ import os
4
+ import sys
5
+ import time
6
+ import numpy
7
+ from numpy .random import randn
8
+ from scipy .linalg import blas
9
+
10
+ def run_ssyrk (N ,l ):
11
+
12
+ A = randn (N ,N ).astype ('float32' )
13
+ C = randn (N ,N ).astype ('float32' )
14
+
15
+
16
+ start = time .time ();
17
+ for i in range (0 ,l ):
18
+ C = blas .ssyrk (1.0 ,A )
19
+ end = time .time ()
20
+
21
+ timediff = (end - start )
22
+ mflops = ( N * N * N ) * l / timediff
23
+ mflops *= 1e-6
24
+
25
+ size = "%dx%d" % (N ,N )
26
+ print ("%14s :\t %20f MFlops\t %20f sec" % (size ,mflops ,timediff ))
27
+
28
+
29
+ if __name__ == "__main__" :
30
+ N = 128
31
+ NMAX = 2048
32
+ NINC = 128
33
+ LOOPS = 1
34
+
35
+ z = 0
36
+ for arg in sys .argv :
37
+ if z == 1 :
38
+ N = int (arg )
39
+ elif z == 2 :
40
+ NMAX = int (arg )
41
+ elif z == 3 :
42
+ NINC = int (arg )
43
+ elif z == 4 :
44
+ LOOPS = int (arg )
45
+
46
+ z = z + 1
47
+
48
+ if 'OPENBLAS_LOOPS' in os .environ :
49
+ p = os .environ ['OPENBLAS_LOOPS' ]
50
+ if p :
51
+ LOOPS = int (p );
52
+
53
+ print ("From: %d To: %d Step=%d Loops=%d" % (N , NMAX , NINC , LOOPS ))
54
+ print ("\t SIZE\t \t \t Flops\t \t \t \t \t Time" )
55
+
56
+ for i in range (N ,NMAX + NINC ,NINC ):
57
+ run_ssyrk (i ,LOOPS )
58
+
You can’t perform that action at this time.
0 commit comments