-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathkblas-test-l3.py
executable file
·123 lines (110 loc) · 3.9 KB
/
kblas-test-l3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, getopt
import csv
import time
import commands
# create output log folder
KBLAS_HOME='.'
TEST_LOGS_PATH='kblas-test-log'
cmd = ('cd '+KBLAS_HOME+'; mkdir -p '+TEST_LOGS_PATH)
print cmd
sys.stdout.flush()
os.system(cmd)
BIN_PATH='./testing/bin/'
if (not os.path.isdir(BIN_PATH)):
print 'Unable to find executables folder! Exiting'
exit()
#detect GPU devices
NGPUS=0
# first check using environment variable
if ( "CUDA_VISIBLE_DEVICES" in os.environ ):
aux=os.environ["CUDA_VISIBLE_DEVICES"].strip(',')
if ( len(aux) > 0):
NGPUS=int( aux.count(',') ) + 1
if ( NGPUS == 0 ):
# check using system
cmd=('nvidia-smi -L | wc -l')
NGPUS = int(commands.getstatusoutput(cmd)[1])
if (NGPUS < 1):
print 'Unable to detect an NVIDIA GPU device to test on! Exiting'
exit()
#check = ''
check = '-c'
TRMM = 1
TRSM = 1
ranges = ['--range 128:1024:128', #square matrices
#'--range 2048:15360:1024 ', #square matrices
#'--mrange 512:15360:512 -n 512 ', #tall & skinny matrices
#'--nrange 512:15360:512 -m 512 ' #thin & wide matrices
]
#--------------------------------
def task1(pVariants, pRanges, pExec, pCheck, pDev, pOutfile, pGpus):
sys.stdout.write('running: '+pExec+' ... ')
os.system('echo running: '+pExec+' > '+pOutfile)
for v in pVariants:
for r in pRanges:
cmd = (pExec+' '+r+' -w --nb 128 --db 256 --ngpu '+str(pGpus)+' -t '+pCheck+' '+v)
os.system('echo >> '+pOutfile)
os.system('echo '+cmd+' >> '+pOutfile)
sys.stdout.flush()
os.system(cmd+' >> '+pOutfile)
time.sleep(1)
print ' done'
#--------------------------------
def task2(pVariants, pRanges, pExec, pCheck, pDev, pOutfile):
sys.stdout.write('running: '+pExec+' ... ')
os.system('echo running: '+pExec+' > '+pOutfile)
for v in pVariants:
for r in pRanges:
cmd = (pExec+' '+r+' -w --nb 128 --db 256 -t '+pCheck+' --dev '+str(pDev)+' '+v)
os.system('echo >> '+pOutfile)
os.system('echo '+cmd+' >> '+pOutfile)
sys.stdout.flush()
os.system(cmd+' >> '+pOutfile)
time.sleep(1)
print ' done'
############### TRMM
if (TRMM == 1):
variants = ['-SL -L -NN',
'-SL -L -TN',
'-SL -U -NN',
'-SL -U -TN',
'-SR -L -NN',
'-SR -L -TN',
'-SR -U -NN',
'-SR -U -TN'
]
programs = [#'test_strmm', 'test_dtrmm', 'test_ctrmm', 'test_ztrmm',
#'test_strmm_cpu', 'test_dtrmm_cpu', 'test_ctrmm_cpu', 'test_ztrmm_cpu',
'test_strmm_mgpu', 'test_dtrmm_mgpu', 'test_ctrmm_mgpu', 'test_ztrmm_mgpu'
]
for p in programs:
pp = BIN_PATH+p
if (not os.path.isfile(pp)):
print 'Unable to find '+pp+' executable! Skipping...'
else:
logFile = TEST_LOGS_PATH+'/'+p+'.txt'
task1(variants, ranges, pp, check, 0, logFile, NGPUS)
############### TRSM
if (TRSM == 1):
variants = ['-SL -L -NN',
'-SL -L -TN',
'-SL -U -NN',
'-SL -U -TN',
'-SR -L -NN',
'-SR -L -TN',
'-SR -U -NN',
'-SR -U -TN'
]
programs = [#'test_strsm', 'test_dtrsm', 'test_ctrsm', 'test_ztrsm',
#'test_strsm_cpu', 'test_dtrsm_cpu', 'test_ctrsm_cpu', 'test_ztrsm_cpu',
'test_strsm_mgpu', 'test_dtrsm_mgpu', 'test_ctrsm_mgpu', 'test_ztrsm_mgpu'
]
for p in programs:
pp = BIN_PATH+p
if (not os.path.isfile(pp)):
print 'Unable to find '+pp+' executable! Skipping...'
else:
logFile = TEST_LOGS_PATH+'/'+p+'.txt'
task1(variants, ranges, pp, check, 0, logFile, NGPUS)