15 from subprocess
import Popen, STDOUT, PIPE
20 if hasattr(os,
"sysconf"):
21 if os.sysconf_names.has_key(
"SC_NPROCESSORS_ONLN"):
22 ncpus_av = os.sysconf(
"SC_NPROCESSORS_ONLN")
24 if os.environ.has_key(
"NUMBER_OF_PROCESSORS"):
25 ncpus_av = int(os.environ[
"NUMBER_OF_PROCESSORS"]);
29 ncpus=int(math.floor(ncpus_av/2))
34 opts, args = getopt.getopt(sys.argv[1:],
"hnc:s:",
35 [
"help",
"cores=",
"sched="])
37 except getopt.error, msg:
39 print "for help use --help"
47 if o
in (
"-h",
"--help"):
48 print sys.argv[0]+
" [-h|--help] [-c n|--cores=n] [-s s|--sched=s]"
49 print " -c Fix the number of cores"
50 print " -s Specify the scheduling mode: 0 for static, 1 for dynamic"
51 print " -n Print the commands only"
54 if o
in (
'-c',
'--ncores' ):
56 elif o
in (
'-s' ,
'--sched' ):
61 elif o
in (
'-n' ,
'--noexec' ):
66 os.environ[
"PATH"] = os.environ[
"PATH"]+
":."
71 cmdline=
"./" + cmdline
76 p=Popen( cmdline, shell=
True, stdout=PIPE, stderr=STDOUT )
84 print "---- TESTING " + cmdline.split()[3] +
"... FAILED(" + str(p.returncode) +
") !"
85 for line
in pipe.readlines():
89 for line
in pipe.readlines():
91 if "TESTING" in line :
95 print cmdline.split()[0] +
" " + cmdline.split()[3] +
": FAILED(Unexpected error)"
102 filename =
"testing_results.txt"
104 f = open(filename,
'w')
109 print "---------------- Testing PLASMA Routines ----------------"
111 print "-- Number of cores available =", ncpus_av
112 print "-- Number of cores used for testing =", ncpus
113 print "-- Detailed results are stored in", filename
114 print "-- Scheduling mode: ",
121 (
"s",
"d",
"c",
"z"),
122 (
"Single",
"Double",
"Complex",
"Double Complex"),
125 for dtype
in range(4):
126 letter = dtypes[0][dtype]
127 name = dtypes[1][dtype]
130 print "--------------------- In Place Transformation -------------------"
134 cmdbase=
"%stesting " % letter + str(ncpus) +
" " + str(sched)
136 test01=
local_popen(f, cmdbase +
" GECFI" +
" 623 531 123 145 136 134")
140 print "------------------------- %s ------------------------" % name
145 test1 =
local_popen(f, cmdbase +
" GEMM" +
" 1.0 -2.0 600 500 550 650 625 700")
146 test2 =
local_popen(f, cmdbase +
" TRSM" +
" -2.0 600 500 650 625")
147 test3 =
local_popen(f, cmdbase +
" TRMM" +
" -2.0 600 500 650 625")
148 test4 =
local_popen(f, cmdbase +
" SYMM" +
" 1.0 -2.0 600 500 650 625 700")
149 test5 =
local_popen(f, cmdbase +
" SYRK" +
" 1.0 -2.0 600 500 650 625")
151 if letter
in (
"c",
"z" ) :
152 test101 =
local_popen(f,
"%stesting " % letter + str(ncpus) +
" " + str(sched) +
" HEMM" +
" 1.0 -2.0 600 500 650 625 600")
153 test102 =
local_popen(f,
"%stesting " % letter + str(ncpus) +
" " + str(sched) +
" HERK" +
" 1.0 -2.0 600 500 650 625")
157 test22 =
local_popen(f, cmdbase +
" GELS" +
" 0 800 400 825 25 810")
158 test23 =
local_popen(f, cmdbase +
" GELS" +
" 1 800 400 825 25 810 4")
159 test24 =
local_popen(f, cmdbase +
" GELS" +
" 0 400 800 825 25 810")
160 test25 =
local_popen(f, cmdbase +
" GELS" +
" 1 400 800 825 25 810 4")
171 print "--------------------- Mixed Precision -------------------"
174 for substr
in ( (
"z",
"C"), (
"d",
"S") ):
175 cmdbase=
"%stesting " % substr[0] + str(ncpus) +
" " + str(sched)
177 test201 =
local_popen(f, cmdbase +
" %sGESV" % substr[1] +
" 800 825 25 810")
178 test202 =
local_popen(f, cmdbase +
" %sUNGESV" % substr[1] +
" 800 825 25 810")
179 test203 =
local_popen(f, cmdbase +
" %sPOSV" % substr[1] +
" 800 825 25 810")