How to use develop method in tox

Best Python code snippet using tox_python

MIVisionX-profile.py

Source:MIVisionX-profile.py Github

copy

Full Screen

1import os2import getopt3import sys4__author__ = "Kiriti Nagesh Gowda"5__copyright__ = "Copyright 2018, AMD MIVisionX Profiler"6__license__ = "MIT"7__version__ = "0.9.5"8__maintainer__ = "Kiriti Nagesh Gowda"9__email__ = "Kiriti.NageshGowda@amd.com"10__status__ = "beta"11# caffe models to benchmark12caffeModelConfig = [ 13 ('xyznet',3,1024,2048),14 ('xyznet_18-04',3,1024,2048),15 ('googlenet',3,224,224),16 ('inceptionv4',3,299,299),17 ('resnet50',3,224,224),18 ('resnet101',3,224,224),19 ('resnet152',3,224,224),20 ('vgg16',3,224,224),21 ('vgg19',3,224,224)22 ]23# onnx models to benchmark24onnxModelConfig = [25 ('resnet50',3,224,224),26 ('googlenet',3,224,224),27 ('inception_v2',3,224,224),28 ('inception_v1',3,224,224),29 ('vgg19',3,224,224),30 ('densenet121',3,224,224),31 ('squeezenet',3,224,224),32 ('zfnet512',3,224,224)33 ]34# nnef models to benchmark35nnefModelConfig = [36 'alexnet-caffe',37 'alexnet-onnx',38 'vgg16-caffe',39 'vgg16-onnx',40 'vgg19-caffe',41 'vgg19-onnx',42 'googlenet-caffe',43 'googlenet-onnx',44 'inceptionv1-onnx',45 'inceptionv2-onnx',46 'resnetv1-18-onnx',47 'resnetv1-34-onnx',48 'resnetv1-50-onnx',49 'resnetv1-101-onnx',50 'resnetv1-152-caffe',51 'resnetv2-18-onnx',52 'resnetv2-34-onnx',53 'resnetv2-50-onnx',54 'resnetv2-101-onnx',55 'mobilenetv1-caffe',56 'mobilenetv2-onnx',57 'mobilenetv2-caffe',58 'squeezenet1.0-caffe',59 'squeezenet1.0-onnx',60 'squeezenet1.1-caffe',61 'squeezenet1.1-onnx'62]63opts, args = getopt.getopt(sys.argv[1:], 'd:l:m:f:')64buildDir = ''65profileLevel = 066profileMode = 067miopenFind = 168for opt, arg in opts:69 if opt == '-d':70 buildDir = arg71 elif opt =='-l':72 profileLevel = int(arg)73 elif opt =='-m':74 profileMode = int(arg)75 elif opt =='-f':76 miopenFind = int(arg)77if buildDir == '':78 print('Invalid command line arguments.\n \t\t\t\t-d [build directory - required]\n '\79 '\t\t\t\t-l [profile level - optional (level 1-8, default:7)]\n'\80 '\t\t\t\t-m [profile mode - optional (level 1-9, default:1)]\n'\81 '\t\t\t\t-f [MIOPEN_FIND_ENFORCE mode - optional (level 1-5, default:1)]\n')82 exit()83buildDir_MIVisionX = buildDir+'MIVisionX'84if profileLevel == 0:85 profileLevel = 786if profileMode == 0:87 profileMode = 188# Bring CaffeModels89if profileMode == 1 or profileMode == 2 or profileMode == 3:90 caffeModels_dir = os.path.expanduser(buildDir_MIVisionX+'/caffeModels')91 if(os.path.exists(caffeModels_dir)):92 print("\nCaffeModel Folder Exist\n")93 else:94 os.system('(cd '+buildDir_MIVisionX+'; scp -r client@amdovx-file-server:~/caffeModels . )')95 if(os.path.exists(caffeModels_dir)):96 print("\nCaffeModel Retrived from the amdovx-file-server\n")97 else:98 print("\nERROR -- FILE SERVER CONNECTION FAILED, CHECK CONNECTION\n")99 exit()100# Bring ONNX-Models101elif profileMode == 4 or profileMode == 5 or profileMode == 6:102 onnxModels_dir = os.path.expanduser(buildDir_MIVisionX+'/onnxModels')103 if(os.path.exists(onnxModels_dir)):104 print("\nOnnxModel Folder Exist\n")105 else:106 os.system('(cd '+buildDir_MIVisionX+'; scp -r client@amdovx-file-server:~/onnxModels . )')107 if(os.path.exists(onnxModels_dir)):108 print("\nonnxModel Retrived from the amdovx-file-server\n")109 else:110 print("\nERROR -- FILE SERVER CONNECTION FAILED, CHECK CONNECTION\n")111 exit()112# Bring NNEF-Models113elif profileMode == 7 or profileMode == 8 or profileMode == 9:114 nnefModels_dir = os.path.expanduser(buildDir_MIVisionX+'/nnefModels')115 print nnefModels_dir116 if(os.path.exists(nnefModels_dir)):117 print("\nNNEFModel Folder Exist\n")118 else:119 os.system('(cd '+buildDir_MIVisionX+'; scp -r client@amdovx-file-server:~/nnefModels . )')120 if(os.path.exists(nnefModels_dir)):121 print("\nnnefModel Retrived from the amdovx-file-server\n")122 else:123 print("\nERROR -- FILE SERVER CONNECTION FAILED, CHECK CONNECTION\n")124 exit()125# run models126develop_dir = os.path.expanduser(buildDir_MIVisionX+'/develop')127if(os.path.exists(develop_dir)):128 os.system('(cd '+buildDir_MIVisionX+'; rm -rf develop)')129os.system('(cd '+buildDir_MIVisionX+'; mkdir develop)')130if profileMode == 1 or profileMode == 2 or profileMode == 3:131 print("\nCaffe Models access ..\n")132 os.system('(cd '+develop_dir+'; mkdir caffe-folder)')133 for i in range(len(caffeModelConfig)):134 modelName, channel, height, width = caffeModelConfig[i] 135 os.system('(cd '+develop_dir+'/caffe-folder; mkdir '+modelName+')')136 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'; cp -r ../../../caffeModels/'+modelName+' .)')137elif profileMode == 4 or profileMode == 5 or profileMode == 6:138 print("\nONNX Models access ..\n")139 os.system('(cd '+develop_dir+'; mkdir onnx-folder)')140 for i in range(len(onnxModelConfig)):141 modelName, channel, height, width = onnxModelConfig[i] 142 os.system('(cd '+develop_dir+'/onnx-folder; mkdir '+modelName+')')143 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'; cp -r ../../../onnxModels/'+modelName+' .)')144elif profileMode == 7 or profileMode == 8 or profileMode == 9:145 print("\nNNEF Models access ..\n")146 os.system('(cd '+develop_dir+'; mkdir nnef-folder)')147 for i in range(len(nnefModelConfig)):148 modelName = nnefModelConfig[i] 149 os.system('(cd '+develop_dir+'/nnef-folder; mkdir '+modelName+')')150 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'; cp -r ../../../nnefModels/'+modelName+' .)')151# run caffe2nnir2openvx no fuse flow152if profileMode == 1:153 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')154 for i in range(len(caffeModelConfig)):155 modelName, channel, height, width = caffeModelConfig[i]156 print "\n caffe2nnir2openvx --",modelName,"\n"157 if(modelName == 'xyznet' or modelName == 'xyznet_18-04'):158 x = 1159 print "\n",modelName," - Batch size ", x160 x = str(x)161 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'; mkdir nnir_build_'+x+')')162 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/caffe_to_nnir.py ../'+modelName+'/'+modelName+'.caffemodel . --input-dims '+x+','+str(channel)+','+str(height)+','+str(width)+')')163 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')164 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; cmake .; make)')165 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_output.log)')166 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_output.log)')167 else:168 for x in range(profileLevel):169 x = 2**x170 print "\n",modelName," - Batch size ", x171 x = str(x)172 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'; mkdir nnir_build_'+x+')')173 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/caffe_to_nnir.py ../'+modelName+'/'+modelName+'.caffemodel . --input-dims '+x+','+str(channel)+','+str(height)+','+str(width)+')')174 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')175 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; cmake .; make)')176 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_output.log)')177 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_output.log)')178 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_output.log > '''+develop_dir+'''/caffe2nnir2openvx_noFuse_profile.csv'''179 os.system(runAwk_csv)180 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_output.log > '''+develop_dir+'''/caffe2nnir2openvx_noFuse_profile.txt'''181 os.system(runAwk_txt)182 orig_stdout = sys.stdout183 sys.stdout = open(develop_dir+'/caffe2nnir2openvx_noFuse_profile.md','a')184 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'185 print(echo_1)186 echo_2 = '|------------|------------|-----------------|-----------------|'187 print(echo_2)188 sys.stdout = orig_stdout189 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_output.log | tee -a '''+develop_dir+'''/caffe2nnir2openvx_noFuse_profile.md'''190 os.system(runAwk_md)191# run caffe2nnir2openvx with fuse flow192if profileMode == 2:193 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')194 for i in range(len(caffeModelConfig)):195 modelName, channel, height, width = caffeModelConfig[i]196 print "\n caffe2nnir2openvx --",modelName,"\n"197 if(modelName == 'xyznet' or modelName == 'xyznet_18-04'):198 x = 1199 print "\n",modelName," - Batch size ", x 200 x = str(x)201 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'; mkdir nnir_fuse_build_'+x+')')202 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/caffe_to_nnir.py ../'+modelName+'/'+modelName+'.caffemodel . --input-dims '+x+','+str(channel)+','+str(height)+','+str(width)+')')203 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --fuse-ops 1 . .)')204 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')205 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; cmake .; make)')206 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fuse_output.log)')207 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fuse_output.log)')208 else:209 for x in range(profileLevel):210 x = 2**x211 print "\n",modelName," - Batch size ", x 212 x = str(x)213 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'; mkdir nnir_fuse_build_'+x+')')214 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/caffe_to_nnir.py ../'+modelName+'/'+modelName+'.caffemodel . --input-dims '+x+','+str(channel)+','+str(height)+','+str(width)+')')215 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --fuse-ops 1 . .)')216 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')217 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; cmake .; make)')218 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fuse_output.log)')219 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fuse_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fuse_output.log)')220 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_fuse_output.log > '''+develop_dir+'''/caffe2nnir2openvx_fuse_profile.csv'''221 os.system(runAwk_csv)222 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_fuse_output.log > '''+develop_dir+'''/caffe2nnir2openvx_fuse_profile.txt'''223 os.system(runAwk_txt)224 orig_stdout = sys.stdout225 sys.stdout = open(develop_dir+'/caffe2nnir2openvx_fuse_profile.md','a')226 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'227 print(echo_1)228 echo_2 = '|------------|------------|-----------------|-----------------|'229 print(echo_2)230 sys.stdout = orig_stdout231 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_fuse_output.log | tee -a '''+develop_dir+'''/caffe2nnir2openvx_fuse_profile.md'''232 os.system(runAwk_md)233 234# run caffe2nnir2openvx with fp16 flow235if profileMode == 3:236 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')237 for i in range(len(caffeModelConfig)):238 modelName, channel, height, width = caffeModelConfig[i]239 print "\n caffe2nnir2openvx --",modelName,"\n"240 if(modelName == 'xyznet' or modelName == 'xyznet_18-04'):241 x = 1242 print "\n",modelName," - Batch size ", x 243 x = str(x)244 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'; mkdir nnir_fp16_build_'+x+')')245 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/caffe_to_nnir.py ../'+modelName+'/'+modelName+'.caffemodel . --input-dims '+x+','+str(channel)+','+str(height)+','+str(width)+')')246 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --convert-fp16 1 . .)')247 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')248 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; cmake .; make)')249 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fp16_output.log)')250 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fp16_output.log)')251 else:252 for x in range(profileLevel):253 x = 2**x254 print "\n",modelName," - Batch size ", x 255 x = str(x)256 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'; mkdir nnir_fp16_build_'+x+')')257 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/caffe_to_nnir.py ../'+modelName+'/'+modelName+'.caffemodel . --input-dims '+x+','+str(channel)+','+str(height)+','+str(width)+')')258 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --convert-fp16 1 . .)')259 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')260 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; cmake .; make)')261 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fp16_output.log)')262 os.system('(cd '+develop_dir+'/caffe-folder/'+modelName+'/nnir_fp16_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fp16_output.log)')263 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_fp16_output.log > '''+develop_dir+'''/caffe2nnir2openvx_fp16_profile.csv'''264 os.system(runAwk_csv)265 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_fp16_output.log > '''+develop_dir+'''/caffe2nnir2openvx_fp16_profile.txt'''266 os.system(runAwk_txt)267 orig_stdout = sys.stdout268 sys.stdout = open(develop_dir+'/caffe2nnir2openvx_fp16_profile.md','a')269 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'270 print(echo_1)271 echo_2 = '|------------|------------|-----------------|-----------------|'272 print(echo_2)273 sys.stdout = orig_stdout274 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/caffe-folder/nnir_fp16_output.log | tee -a '''+develop_dir+'''/caffe2nnir2openvx_fp16_profile.md'''275 os.system(runAwk_md)276# run onnx2nnir2openvx no fuse flow277if profileMode == 4:278 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')279 for i in range(len(onnxModelConfig)):280 modelName, channel, height, width = onnxModelConfig[i]281 print "\n onnx2nnir2openvx --",modelName,"\n"282 for x in range(profileLevel):283 x = 2**x284 print "\n",modelName," - Batch size ", x285 x = str(x)286 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'; mkdir nnir_build_'+x+')')287 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/onnx_to_nnir.py ../'+modelName+'/model.onnx . --input-dims '+x+','+str(channel)+','+str(height)+','+str(width)+')')288 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')289 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_build_'+x+'; cmake .; make)')290 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_output.log)')291 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_output.log)')292 293 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_output.log > '''+develop_dir+'''/onnx2nnir2openvx_noFuse_profile.csv'''294 os.system(runAwk_csv)295 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_output.log > '''+develop_dir+'''/onnx2nnir2openvx_noFuse_profile.txt'''296 os.system(runAwk_txt)297 orig_stdout = sys.stdout298 sys.stdout = open(develop_dir+'/onnx2nnir2openvx_noFuse_profile.md','a')299 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'300 print(echo_1)301 echo_2 = '|------------|------------|-----------------|-----------------|'302 print(echo_2)303 sys.stdout = orig_stdout304 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net , bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_output.log | tee -a '''+develop_dir+'''/onnx2nnir2openvx_noFuse_profile.md'''305 os.system(runAwk_md)306# run onnx2nnir2openvx with fuse flow307if profileMode == 5:308 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')309 for i in range(len(onnxModelConfig)):310 modelName, channel, height, width = onnxModelConfig[i]311 print "\n onnx2nnir2openvx --",modelName,"\n"312 for x in range(profileLevel):313 x = 2**x314 print "\n",modelName," - Batch size ", x315 x = str(x)316 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'; mkdir nnir_fuse_build_'+x+')')317 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/onnx_to_nnir.py ../'+modelName+'/model.onnx .'+')')318 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --fuse-ops 1 . .)')319 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')320 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fuse_build_'+x+'; cmake .; make)')321 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fuse_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fuse_output.log)')322 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fuse_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fuse_output.log)')323 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_fuse_output.log > '''+develop_dir+'''/onnx2nnir2openvx_fuse_profile.csv'''324 os.system(runAwk_csv)325 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_fuse_output.log > '''+develop_dir+'''/onnx2nnir2openvx_fuse_profile.txt'''326 os.system(runAwk_txt)327 orig_stdout = sys.stdout328 sys.stdout = open(develop_dir+'/onnx2nnir2openvx_fuse_profile.md','a')329 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'330 print(echo_1)331 echo_2 = '|------------|------------|-----------------|-----------------|'332 print(echo_2)333 sys.stdout = orig_stdout334 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_fuse_output.log | tee -a '''+develop_dir+'''/onnx2nnir2openvx_fuse_profile.md'''335 os.system(runAwk_md)336 337# run onnx2nnir2openvx with fp16 flow338if profileMode == 6:339 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')340 for i in range(len(onnxModelConfig)):341 modelName, channel, height, width = onnxModelConfig[i]342 print "\n onnx2nnir2openvx --",modelName,"\n"343 for x in range(profileLevel):344 x = 2**x345 print "\n",modelName," - Batch size ", x346 x = str(x)347 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'; mkdir nnir_fp16_build_'+x+')')348 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/onnx_to_nnir.py ../'+modelName+'/model.onnx .'+')')349 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --convert-fp16 1 . .)')350 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')351 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fp16_build_'+x+'; cmake .; make)')352 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fp16_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fp16_output.log)')353 os.system('(cd '+develop_dir+'/onnx-folder/'+modelName+'/nnir_fp16_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fp16_output.log)')354 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_fp16_output.log > '''+develop_dir+'''/onnx2nnir2openvx_fp16_profile.csv'''355 os.system(runAwk_csv)356 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_fp16_output.log > '''+develop_dir+'''/onnx2nnir2openvx_fp16_profile.txt'''357 os.system(runAwk_txt)358 orig_stdout = sys.stdout359 sys.stdout = open(develop_dir+'/onnx2nnir2openvx_fp16_profile.md','a')360 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'361 print(echo_1)362 echo_2 = '|------------|------------|-----------------|-----------------|'363 print(echo_2)364 sys.stdout = orig_stdout365 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/onnx-folder/nnir_fp16_output.log | tee -a '''+develop_dir+'''/onnx2nnir2openvx_fp16_profile.md'''366 os.system(runAwk_md)367# run nnef2nnir2openvx no fuse flow368if profileMode == 7:369 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')370 for i in range(len(nnefModelConfig)):371 modelName = nnefModelConfig[i]372 print "\n nnef2nnir2openvx --",modelName,"\n"373 for x in range(profileLevel):374 x = 2**x375 print "\n",modelName," - Batch size ", x376 x = str(x)377 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'; mkdir nnir_build_'+x+')')378 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/nnef_to_nnir.py ../'+modelName+'/ .)')379 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')380 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_build_'+x+'; cmake .; make)')381 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_output.log)')382 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_output.log)')383 384 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_output.log > '''+develop_dir+'''/nnef2nnir2openvx_noFuse_profile.csv'''385 os.system(runAwk_csv)386 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_output.log > '''+develop_dir+'''/nnef2nnir2openvx_noFuse_profile.txt'''387 os.system(runAwk_txt)388 orig_stdout = sys.stdout389 sys.stdout = open(develop_dir+'/nnef2nnir2openvx_noFuse_profile.md','a')390 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'391 print(echo_1)392 echo_2 = '|------------|------------|-----------------|-----------------|'393 print(echo_2)394 sys.stdout = orig_stdout395 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net , bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_output.log | tee -a '''+develop_dir+'''/nnef2nnir2openvx_noFuse_profile.md'''396 os.system(runAwk_md)397# run nnef2nnir2openvx with fuse flow398if profileMode == 8:399 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')400 for i in range(len(nnefModelConfig)):401 modelName = nnefModelConfig[i]402 print "\n nnef2nnir2openvx --",modelName,"\n"403 for x in range(profileLevel):404 x = 2**x405 print "\n",modelName," - Batch size ", x406 x = str(x)407 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'; mkdir nnir_fuse_build_'+x+')')408 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/nnef_to_nnir.py ../'+modelName+'/ .)')409 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --fuse-ops 1 . .)')410 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fuse_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')411 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fuse_build_'+x+'; cmake .; make)')412 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fuse_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fuse_output.log)')413 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fuse_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fuse_output.log)')414 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_fuse_output.log > '''+develop_dir+'''/nnef2nnir2openvx_fuse_profile.csv'''415 os.system(runAwk_csv)416 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_fuse_output.log > '''+develop_dir+'''/nnef2nnir2openvx_fuse_profile.txt'''417 os.system(runAwk_txt)418 orig_stdout = sys.stdout419 sys.stdout = open(develop_dir+'/nnef2nnir2openvx_fuse_profile.md','a')420 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'421 print(echo_1)422 echo_2 = '|------------|------------|-----------------|-----------------|'423 print(echo_2)424 sys.stdout = orig_stdout425 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_fuse_output.log | tee -a '''+develop_dir+'''/nnef2nnir2openvx_fuse_profile.md'''426 os.system(runAwk_md)427 428# run nnef2nnir2openvx with fp16 flow429if profileMode == 9:430 modelCompilerScripts_dir = os.path.expanduser(buildDir_MIVisionX+'/MIVisionX/model_compiler/python')431 for i in range(len(nnefModelConfig)):432 modelName = nnefModelConfig[i]433 print "\n nnef2nnir2openvx --",modelName,"\n"434 for x in range(profileLevel):435 x = 2**x436 print "\n",modelName," - Batch size ", x437 x = str(x)438 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'; mkdir nnir_fp16_build_'+x+')')439 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_build_'+x+'; python '+modelCompilerScripts_dir+'/nnef_to_nnir.py ../'+modelName+'/ .)')440 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_update.py --convert-fp16 1 . .)')441 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fp16_build_'+x+'; python '+modelCompilerScripts_dir+'/nnir_to_openvx.py . .)')442 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fp16_build_'+x+'; cmake .; make)')443 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fp16_build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../nnir_fp16_output.log)')444 os.system('(cd '+develop_dir+'/nnef-folder/'+modelName+'/nnir_fp16_build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest weights.bin | tee -a ../../nnir_fp16_output.log)')445 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_fp16_output.log > '''+develop_dir+'''/nnef2nnir2openvx_fp16_profile.csv'''446 os.system(runAwk_csv)447 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_fp16_output.log > '''+develop_dir+'''/nnef2nnir2openvx_fp16_profile.txt'''448 os.system(runAwk_txt)449 orig_stdout = sys.stdout450 sys.stdout = open(develop_dir+'/nnef2nnir2openvx_fp16_profile.md','a')451 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'452 print(echo_1)453 echo_2 = '|------------|------------|-----------------|-----------------|'454 print(echo_2)455 sys.stdout = orig_stdout456 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/nnef-folder/nnir_fp16_output.log | tee -a '''+develop_dir+'''/nnef2nnir2openvx_fp16_profile.md'''457 os.system(runAwk_md)458# run caffe2openvx flow459if profileMode == 10:460 for i in range(len(caffeModelConfig)):461 modelName, channel, height, width = caffeModelConfig[i]462 print "\n caffe2openvx -- ",modelName,"\n"463 if(modelName == 'xyznet' or modelName == 'xyznet_18-04'):464 x = 1465 print "\n",modelName," - Batch size ", x466 x = str(x)467 os.system('(cd '+develop_dir+'/'+modelName+'; mkdir build_'+x+')')468 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; export PATH=$PATH:/opt/rocm/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib; caffe2openvx ../'+modelName+'/'+modelName+'.caffemodel '+x+' '+str(channel)+' '+str(height)+' '+str(width)+')')469 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; export PATH=$PATH:/opt/rocm/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib; caffe2openvx ../'+modelName+'/'+modelName+'.prototxt '+x+' '+str(channel)+' '+str(height)+' '+str(width)+')')470 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; cmake .; make)')471 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../output.log)')472 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest | tee -a ../../output.log)')473 else:474 for x in range(profileLevel):475 x = 2**x476 print "\n",modelName," - Batch size ", x477 x = str(x)478 os.system('(cd '+develop_dir+'/'+modelName+'; mkdir build_'+x+')')479 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; export PATH=$PATH:/opt/rocm/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib; caffe2openvx ../'+modelName+'/'+modelName+'.caffemodel '+x+' '+str(channel)+' '+str(height)+' '+str(width)+')')480 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; export PATH=$PATH:/opt/rocm/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib; caffe2openvx ../'+modelName+'/'+modelName+'.prototxt '+x+' '+str(channel)+' '+str(height)+' '+str(width)+')')481 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; cmake .; make)')482 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; echo '+modelName+' - Batch size '+x+' | tee -a ../../output.log)')483 os.system('(cd '+develop_dir+'/'+modelName+'/build_'+x+'; MIOPEN_FIND_ENFORCE='+str(miopenFind)+' ./anntest | tee -a ../../output.log)')484 runAwk_csv = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s,%3d,%8.3f ms,%8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/output.log > '''+develop_dir+'''/caffe2openvx_profile.csv'''485 os.system(runAwk_csv)486 runAwk_txt = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("%-16s %3d %8.3f ms %8.3f ms\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/output.log > '''+develop_dir+'''/caffe2openvx_profile.txt'''487 os.system(runAwk_txt)488 orig_stdout = sys.stdout489 sys.stdout = open(develop_dir+'/caffe2openvx_profile.md','a')490 echo_1 = '| Model Name | Batch Size | Time/Batch (ms) | Time/Image (ms) |'491 print(echo_1)492 echo_2 = '|------------|------------|-----------------|-----------------|'493 print(echo_2)494 sys.stdout = orig_stdout495 runAwk_md = r'''awk 'BEGIN { net = "xxx"; bsize = 1; } / - Batch size/ { net = $1; bsize = $5; } /average over 100 iterations/ { printf("|%-16s|%3d|%8.3f|%8.3f\n", net, bsize, $4, $4/bsize) }' '''+develop_dir+'''/output.log | tee -a '''+develop_dir+'''/caffe2openvx_profile.md'''...

Full Screen

Full Screen

package.py

Source:package.py Github

copy

Full Screen

1# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other2# Spack Project Developers. See the top-level COPYRIGHT file for details.3#4# SPDX-License-Identifier: (Apache-2.0 OR MIT)5import os6from spack import *7class Xsdk(Package):8 """Xsdk is a suite of Department of Energy (DOE) packages for numerical9 simulation. This is a Spack bundle package that installs the xSDK10 packages11 """12 homepage = "http://xsdk.info"13 # Dummy url since Spack complains if I don't list something, will be14 # removed when metapackage is available15 url = 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/xsdk.tar.gz'16 version('develop', 'a52dc710c744afa0b71429b8ec9425bc')17 version('0.4.0', 'a52dc710c744afa0b71429b8ec9425bc')18 version('0.3.0', 'a52dc710c744afa0b71429b8ec9425bc')19 version('xsdk-0.2.0', 'a52dc710c744afa0b71429b8ec9425bc')20 variant('debug', default=False, description='Compile in debug mode')21 variant('cuda', default=False, description='Enable CUDA dependent packages')22 variant('omega-h', default=True, description='Enable omega-h package build')23 variant('dealii', default=True, description='Enable dealii package build')24 depends_on('hypre@develop~internal-superlu', when='@develop')25 depends_on('hypre@2.15.1~internal-superlu', when='@0.4.0')26 depends_on('hypre@2.12.1~internal-superlu', when='@0.3.0')27 depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0')28 depends_on('mfem@develop+mpi+hypre+superlu-dist+petsc~sundials+examples+miniapps', when='@develop')29 depends_on('mfem@3.4.0+mpi+hypre+superlu-dist+petsc+sundials+examples+miniapps', when='@0.4.0')30 depends_on('mfem@3.3.2+mpi+hypre+superlu-dist+petsc+sundials+examples+miniapps', when='@0.3.0')31 depends_on('superlu-dist@develop', when='@develop')32 depends_on('superlu-dist@6.1.0', when='@0.4.0')33 depends_on('superlu-dist@5.2.2', when='@0.3.0')34 depends_on('superlu-dist@xsdk-0.2.0', when='@xsdk-0.2.0')35 depends_on('trilinos@develop+hypre+superlu-dist+metis+hdf5~mumps+boost~suite-sparse+tpetra+nox+ifpack2+zoltan2+amesos2~exodus+dtk+intrepid2+shards',36 when='@develop')37 depends_on('trilinos@12.14.1+hypre+superlu-dist+metis+hdf5~mumps+boost~suite-sparse+tpetra+nox+ifpack2+zoltan2+amesos2~exodus+dtk+intrepid2+shards',38 when='@0.4.0')39 depends_on('trilinos@12.12.1+hypre+superlu-dist+metis+hdf5~mumps+boost~suite-sparse~tpetra~ifpack2~zoltan2~amesos2~exodus',40 when='@0.3.0')41 depends_on('trilinos@xsdk-0.2.0+hypre+superlu-dist+metis+hdf5~mumps+boost~suite-sparse~tpetra~ifpack2~zoltan2~amesos2~exodus',42 when='@xsdk-0.2.0')43 depends_on('petsc@develop+trilinos+mpi+hypre+superlu-dist+metis+hdf5~mumps+double~int64',44 when='@develop')45 depends_on('petsc@3.10.3+trilinos+mpi+hypre+superlu-dist+metis+hdf5~mumps+double~int64',46 when='@0.4.0')47 depends_on('petsc@3.8.2+trilinos+mpi+hypre+superlu-dist+metis+hdf5~mumps+double~int64',48 when='@0.3.0')49 depends_on('petsc@xsdk-0.2.0+trilinos+mpi+hypre+superlu-dist+metis+hdf5~mumps+double~int64',50 when='@xsdk-0.2.0')51 depends_on('dealii@develop~assimp~python~doc~gmsh+petsc+slepc+mpi+trilinos~int64+hdf5~netcdf+metis~sundials', when='@develop +dealii')52 depends_on('dealii@9.0.1~assimp~python~doc~gmsh+petsc~slepc+mpi+trilinos~int64+hdf5~netcdf+metis', when='@0.4.0 +dealii')53 depends_on('pflotran@develop', when='@develop')54 depends_on('pflotran@xsdk-0.4.0', when='@0.4.0')55 depends_on('pflotran@xsdk-0.3.0', when='@0.3.0')56 depends_on('pflotran@xsdk-0.2.0', when='@xsdk-0.2.0')57 depends_on('alquimia@develop', when='@develop')58 depends_on('alquimia@xsdk-0.4.0', when='@0.4.0')59 depends_on('alquimia@xsdk-0.3.0', when='@0.3.0')60 depends_on('alquimia@xsdk-0.2.0', when='@xsdk-0.2.0')61 depends_on('sundials@4.1.0~int64+hypre', when='@develop')62 depends_on('sundials@3.2.1~int64+hypre', when='@0.4.0')63 depends_on('sundials@3.1.0~int64+hypre', when='@0.3.0')64 depends_on('plasma@18.11.1:', when='@develop %gcc@6.0:')65 depends_on('plasma@18.11.1:', when='@0.4.0 %gcc@6.0:')66 depends_on('magma@2.4.0', when='@develop +cuda')67 depends_on('magma@2.4.0', when='@0.4.0 +cuda')68 depends_on('magma@2.2.0', when='@0.3.0 +cuda')69 depends_on('amrex@develop', when='@develop %intel')70 depends_on('amrex@develop', when='@develop %gcc')71 depends_on('amrex@18.10.1', when='@0.4.0 %intel')72 depends_on('amrex@18.10.1', when='@0.4.0 %gcc')73 depends_on('slepc@develop', when='@develop')74 depends_on('slepc@3.10.1', when='@0.4.0')75 depends_on('omega-h@develop', when='@develop +omega-h')76 depends_on('omega-h@9.19.1', when='@0.4.0 +omega-h')77 depends_on('strumpack@master', when='@develop')78 depends_on('strumpack@3.1.1', when='@0.4.0')79 depends_on('pumi@develop', when='@develop')80 depends_on('pumi@2.2.0', when='@0.4.0')81 depends_on('tasmanian@develop+xsdkflags+blas~openmp', when='@develop')82 depends_on('tasmanian@develop+xsdkflags+blas+cuda+magma~openmp', when='@develop +cuda')83 depends_on('tasmanian@6.0+xsdkflags+blas~openmp', when='@0.4.0')84 depends_on('tasmanian@6.0+xsdkflags+blas+cuda+magma~openmp', when='@0.4.0 +cuda')85 # the Fortran 2003 bindings of phist require python@3:, but this86 # creates a conflict with other packages like petsc@develop. Actually87 # these are type='build' dependencies, but spack reports a conflict anyway.88 # This will be fixed once the new concretizer becomes available89 # (says @adamjsteward)90 depends_on('phist@develop kernel_lib=tpetra ~fortran ~scamac ~openmp ~host', when='@develop')91 depends_on('phist@1.7.5 kernel_lib=tpetra ~fortran ~scamac ~openmp ~host', when='@0.4.0')92 # xSDKTrilinos depends on the version of Trilinos built with93 # +tpetra which is turned off for faster xSDK94 # depends_on('xsdktrilinos@xsdk-0.2.0', when='@xsdk-0.2.0')95 # depends_on('xsdktrilinos@develop', when='@develop')96 # How do we propagate debug flag to all depends on packages ?97 # If I just do spack install xsdk+debug will that propogate it down?98 # Dummy install for now, will be removed when metapackage is available99 def install(self, spec, prefix):100 # Prevent the error message101 # ==> Error: Install failed for xsdk. Nothing was installed!102 # ==> Error: Installation process had nonzero exit code : 256103 with open(os.path.join(spec.prefix, 'bundle-package.txt'), 'w') as out:104 out.write('This is a bundle\n')...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful