diff --git a/utilities/test_suite/HIP/runMiscTests.py b/utilities/test_suite/HIP/runMiscTests.py index f4adbde28..ee97f4547 100644 --- a/utilities/test_suite/HIP/runMiscTests.py +++ b/utilities/test_suite/HIP/runMiscTests.py @@ -74,24 +74,25 @@ def generate_performance_reports(RESULTS_DIR): print(dfPrint_noIndices) def run_unit_test_cmd(numDims, case, numRuns, testType, toggle, batchSize, outFilePath, additionalArg): - print(f"./Tensor_misc_hip {case} {testType} {toggle} {numDims} {batchSize} {numRuns} {additionalArg}") - result = subprocess.run([buildFolderPath + "/build/Tensor_misc_hip", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_misc_hip " + str(case) + " " + str(testType) + " " + str(toggle) + " " + str(numDims) + " " + str(batchSize) + " " + str(numRuns) + " " + str(additionalArg)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_misc_hip", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) print("------------------------------------------------------------------------------------------") def run_performance_test_cmd(loggingFolder, numDims, case, numRuns, testType, toggle, batchSize, outFilePath, additionalArg): - with open("{}/Tensor_misc_hip_raw_performance_log.txt".format(loggingFolder), "a") as logFile: - print(f"./Tensor_misc_hip {case} {testType} {toggle} {numDims} {batchSize} {numRuns} {additionalArg}") - process = subprocess.Popen([buildFolderPath + "/build/Tensor_misc_hip", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_misc_hip_raw_performance_log.txt", "a") as logFile: + logFile.write("./Tensor_misc_hip " + str(case) + " " + str(testType) + " " + str(toggle) + " " + str(numDims) + " " + str(batchSize) + " " + str(numRuns) + " " + str(additionalArg) + "\n") + process = subprocess.Popen([buildFolderPath + "/build/Tensor_misc_hip", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec read_from_subprocess_and_write_to_log(process, logFile) def run_performance_test_with_profiler_cmd(loggingFolder, numDims, case, numRuns, testType, toggle, batchSize, outFilePath, additionalArg): - if not os.path.exists(f"{outFilePath}/case_{case}"): - os.mkdir(f"{outFilePath}/case_{case}") + if not os.path.exists(outFilePath + "/case_" + str(case)): + os.mkdir(outFilePath + "/case_" + str(case)) - with open("{}/Tensor_misc_hip_raw_performance_log.txt".format(loggingFolder), "a") as logFile: - print(f"\nrocprof --basenames on --timestamp on --stats -o {outFilePath}/case_{case}/output_case{case}.csv ./Tensor_misc_hip {case} {testType} {toggle} {numDims} {batchSize} {numRuns} {additionalArg}") - process = subprocess.Popen([ 'rocprof', '--basenames', 'on', '--timestamp', 'on', '--stats', '-o', f"{outFilePath}/case_{case}/output_case{case}.csv", "./Tensor_misc_hip", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_misc_hip_raw_performance_log.txt", "a") as logFile: + logFile.write("\nrocprof --basenames on --timestamp on --stats -o " + outFilePath + "/case_" + str(case) + "/output_case" + str(case) + ".csv ./Tensor_misc_hip " + str(case) + " " + str(testType) + " " + str(toggle) + " " + str(numDims) + " " + str(batchSize) + " " + str(numRuns) + " " + str(additionalArg) + "\n") + process = subprocess.Popen(['rocprof', '--basenames', 'on', '--timestamp', 'on', '--stats', '-o', outFilePath + "/case_" + str(case) + "/output_case" + str(case) + ".csv", "./Tensor_misc_hip", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec read_from_subprocess_and_write_to_log(process, logFile) print("------------------------------------------------------------------------------------------") @@ -206,8 +207,8 @@ def rpp_test_suite_parser_and_validator(): os.chdir(buildFolderPath + "/build") # Run cmake and make commands -subprocess.run(["cmake", scriptPath], cwd=".") # nosec -subprocess.run(["make", "-j16"], cwd=".") # nosec +subprocess.call(["cmake", scriptPath], cwd=".") # nosec +subprocess.call(["make", "-j16"], cwd=".") # nosec supportedCaseList = ['0', '1', '2'] for case in caseList: @@ -253,7 +254,7 @@ def rpp_test_suite_parser_and_validator(): continue new_file.close() - subprocess.call(['chown', '{}:{}'.format(os.getuid(), os.getgid()), CONSOLIDATED_FILE]) # nosec + subprocess.call(['chown', str(os.getuid()) + ':' + str(os.getgid()), CONSOLIDATED_FILE]) # nosec try: generate_performance_reports(RESULTS_DIR) except ImportError: diff --git a/utilities/test_suite/HIP/runTests.py b/utilities/test_suite/HIP/runTests.py index 88606d0e1..cb4bc8bda 100644 --- a/utilities/test_suite/HIP/runTests.py +++ b/utilities/test_suite/HIP/runTests.py @@ -70,35 +70,39 @@ def run_unit_test(srcPath1, srcPath2, dstPathTemp, case, numRuns, testType, layo if case == "40" or case == "41" or case == "49" or case == "54": for kernelSize in range(3, 10, 2): - print(f"./Tensor_hip {srcPath1} {srcPath2} {dstPath} {bitDepth} {outputFormatToggle} {case} {kernelSize}") - result = subprocess.run([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(kernelSize), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_hip " + srcPath1 + " " + srcPath2 + " " + dstPath + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(kernelSize)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(kernelSize), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) elif case == "8": # Run all variants of noise type functions with additional argument of noiseType = gausssianNoise / shotNoise / saltandpepperNoise for noiseType in range(3): - print(f"./Tensor_hip {srcPath1} {srcPath2} {dstPathTemp} {bitDepth} {outputFormatToggle} {case} {noiseType} ") - result = subprocess.run([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(noiseType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_hip " + srcPath1 + " " + srcPath2 + " " + dstPathTemp + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(noiseType)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(noiseType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) elif case == "21" or case == "23" or case == "24" or case == "79": # Run all variants of interpolation functions with additional argument of interpolationType = bicubic / bilinear / gaussian / nearestneigbor / lanczos / triangular interpolationRange = 6 if case =='79': interpolationRange = 2 for interpolationType in range(interpolationRange): - print(f"./Tensor_hip {srcPath1} {srcPath2} {dstPathTemp} {bitDepth} {outputFormatToggle} {case} {interpolationType}") - result = subprocess.run([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(interpolationType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_hip " + srcPath1 + " " + srcPath2 + " " + dstPathTemp + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(interpolationType)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(interpolationType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) else: - print(f"./Tensor_hip {srcPath1} {srcPath2} {dstPathTemp} {bitDepth} {outputFormatToggle} {case} 0 {numRuns} {testType} {layout}") - result = subprocess.run([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), "0", str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_hip " + srcPath1 + " " + srcPath2 + " " + dstPathTemp + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " 0 " + str(numRuns) + " " + str(testType) + " " + str(layout)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), "0", str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) print("------------------------------------------------------------------------------------------") def run_performance_test_cmd(loggingFolder, logFileLayout, srcPath1, srcPath2, dstPath, bitDepth, outputFormatToggle, case, additionalParam, numRuns, testType, layout, qaMode, decoderType, batchSize, roiList): - with open("{}/Tensor_hip_{}_raw_performance_log.txt".format(loggingFolder, logFileLayout), "a") as logFile: - print(f"./Tensor_hip {srcPath1} {srcPath2} {dstPath} {bitDepth} {outputFormatToggle} {case} {additionalParam} 0 ") - process = subprocess.Popen([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPath, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_hip_" + logFileLayout + "_raw_performance_log.txt", "a") as logFile: + print("./Tensor_hip " + srcPath1 + " " + srcPath2 + " " + dstPath + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(additionalParam)) + process = subprocess.Popen([buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPath, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec read_from_subprocess_and_write_to_log(process, logFile) def run_performance_test(loggingFolder, logFileLayout, srcPath1, srcPath2, dstPath, case, numRuns, testType, layout, qaMode, decoderType, batchSize, roiList): @@ -133,11 +137,11 @@ def run_performance_test(loggingFolder, logFileLayout, srcPath1, srcPath2, dstPa def run_performance_test_with_profiler(loggingFolder, logFileLayout, srcPath1, srcPath2, dstPath, bitDepth, outputFormatToggle, case, additionalParam, additionalParamType, numRuns, testType, layout, qaMode, decoderType, batchSize, roiList): addtionalParamString = additionalParamType + str(additionalParam) layoutName = get_layout_name(layout) - if not os.path.isdir(f"{dstPath}/Tensor_{layoutName}/case_{case}"): - os.mkdir(f"{dstPath}/Tensor_{layoutName}/case_{case}") - with open(f"{loggingFolder}/Tensor_hip_{logFileLayout}_raw_performance_log.txt", "a") as logFile: - print(f'rocprof --basenames on --timestamp on --stats -o {dstPath}/Tensor_{layoutName}/case_{case}/output_case{case}_bitDepth{bitDepth}_oft{outputFormatToggle}{addtionalParamString}.csv ./Tensor_hip {srcPath1} {srcPath2} {bitDepth} {outputFormatToggle} {case} {additionalParam} 0') - process = subprocess.Popen(['rocprof', '--basenames', 'on', '--timestamp', 'on', '--stats', '-o', f'{dstPath}/Tensor_{layoutName}/case_{case}/output_case{case}_bitDepth{bitDepth}_oft{outputFormatToggle}{addtionalParamString}.csv', buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPath, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), str(numRuns), str(testType), str(layout), '0', str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec + if not os.path.isdir(dstPath + "/Tensor_" + layoutName + "/case_" + str(case)): + os.makedirs(dstPath + "/Tensor_" + layoutName + "/case_" + str(case)) + with open(loggingFolder + "/Tensor_hip_" + logFileLayout + "_raw_performance_log.txt", "a") as logFile: + logFile.write("rocprof --basenames on --timestamp on --stats -o " + dstPath + "/Tensor_" + layoutName + "/case_" + str(case) + "/output_case" + str(case) + "_bitDepth" + str(bitDepth) + "_oft" + addtionalParamString + ".csv ./Tensor_hip " + srcPath1 + " " + srcPath2 + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(additionalParam) + " 0\n") + process = subprocess.Popen(['rocprof', '--basenames', 'on', '--timestamp', 'on', '--stats', '-o', dstPath + "/Tensor_" + layoutName + "/case_" + str(case) + "/output_case" + str(case) + "_bitDepth" + str(bitDepth) + "_oft" + addtionalParamString + ".csv", buildFolderPath + "/build/Tensor_hip", srcPath1, srcPath2, dstPath, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), str(numRuns), str(testType), str(layout), '0', str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec while True: output = process.stdout.readline() if not output and process.poll() is not None: @@ -172,7 +176,7 @@ def rpp_test_suite_parser_and_validator(): # validate the parameters passed by user if ((args.case_start < caseMin or args.case_start > caseMax) or (args.case_end < caseMin or args.case_end > caseMax)): - print(f"Starting case# and Ending case# must be in the {caseMin}:{caseMax} range. Aborting!") + print("Starting case# and Ending case# must be in the " + str(caseMin) + ":" + str(caseMax) + " range. Aborting!") exit(0) elif args.case_end < args.case_start: print("Ending case# must be greater than starting case#. Aborting!") @@ -214,7 +218,7 @@ def rpp_test_suite_parser_and_validator(): else: for case in args.case_list: if int(case) < caseMin or int(case) > caseMax: - print(f"Invalid case number {case}! Case number must be in the {caseMin}:{caseMax} range. Aborting!") + print("Invalid case number " + str(case) + "! Case number must be in the " + str(caseMin) + ":" + str(caseMax) + " range. Aborting!") exit(0) return args @@ -272,17 +276,17 @@ def rpp_test_suite_parser_and_validator(): os.chdir(buildFolderPath + "/build") # Run cmake and make commands -subprocess.run(["cmake", scriptPath], cwd=".") # nosec -subprocess.run(["make", "-j16"], cwd=".") # nosec +subprocess.call(["cmake", scriptPath], cwd=".") # nosec +subprocess.call(["make", "-j16"], cwd=".") # nosec # List of cases supported supportedCaseList = ['0', '1', '2', '4', '6', '8', '13', '20', '21', '23', '26', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '45', '46', '54', '61', '63', '65', '68', '70', '79', '80', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92'] # Create folders based on testType and profilingOption if testType == 1 and profilingOption == "YES": - os.makedirs(f"{dstPath}/Tensor_PKD3") - os.makedirs(f"{dstPath}/Tensor_PLN1") - os.makedirs(f"{dstPath}/Tensor_PLN3") + os.makedirs(dstPath + "/Tensor_PKD3") + os.makedirs(dstPath + "/Tensor_PLN1") + os.makedirs(dstPath + "/Tensor_PLN3") print("\n\n\n\n\n") print("##########################################################################################") @@ -453,7 +457,7 @@ def rpp_test_suite_parser_and_validator(): continue new_file.close() - subprocess.call(['chown', '{}:{}'.format(os.getuid(), os.getgid()), RESULTS_DIR + "/consolidated_results_" + TYPE + ".stats.csv"]) # nosec + subprocess.call(['chown', str(os.getuid()) + ':' + str(os.getgid()), RESULTS_DIR + "/consolidated_results_" + TYPE + ".stats.csv"]) # nosec try: generate_performance_reports(d_counter, TYPE_LIST, RESULTS_DIR) diff --git a/utilities/test_suite/HIP/runVoxelTests.py b/utilities/test_suite/HIP/runVoxelTests.py index f3ad38025..31c9dd22f 100644 --- a/utilities/test_suite/HIP/runVoxelTests.py +++ b/utilities/test_suite/HIP/runVoxelTests.py @@ -57,20 +57,23 @@ def func_group_finder(case_number): return "miscellaneous" def run_unit_test_cmd(headerPath, dataPath, dstPathTemp, layout, case, numRuns, testType, qaMode, batchSize): - print(f"./Tensor_voxel_hip {headerPath} {dataPath} {dstPathTemp} {layout} {case} {numRuns} {testType} {qaMode} {batchSize} {bitDepth}") - result = subprocess.run([buildFolderPath + "/build/Tensor_voxel_hip", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_voxel_hip " + headerPath + " " + dataPath + " " + dstPathTemp + " " + str(layout) + " " + str(case) + " " + str(numRuns) + " " + str(testType) + " " + str(qaMode) + " " + str(batchSize) + " " + str(bitDepth)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_voxel_hip", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) print("------------------------------------------------------------------------------------------") def run_performance_test_cmd(loggingFolder, logFileLayout, headerPath, dataPath, dstPathTemp, layout, case, numRuns, testType, qaMode, batchSize): - with open(f"{loggingFolder}/Tensor_voxel_hip_{logFileLayout}_raw_performance_log.txt", "a") as logFile: - print(f"./Tensor_voxel_hip {headerPath} {dataPath} {dstPathTemp} {layout} {case} {numRuns} {testType} {qaMode} {batchSize} {bitDepth}") - process = subprocess.Popen([buildFolderPath + "/build/Tensor_voxel_hip", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_voxel_hip_" + logFileLayout + "_raw_performance_log.txt", "a") as logFile: + logFile.write("./Tensor_voxel_hip " + headerPath + " " + dataPath + " " + dstPathTemp + " " + str(layout) + " " + str(case) + " " + str(numRuns) + " " + str(testType) + " " + str(qaMode) + " " + str(batchSize) + " " + str(bitDepth) + "\n") + process = subprocess.Popen([buildFolderPath + "/build/Tensor_voxel_hip", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec while True: output = process.stdout.readline() if not output and process.poll() is not None: break - print(output.strip()) + output = output.decode().strip() # Decode bytes to string and strip extra whitespace + print(output) + logFile.write(output) if "Running" in output or "max,min,avg wall times" in output: cleanedOutput = ''.join(char for char in output if 32 <= ord(char) <= 126) # Remove control characters cleanedOutput = cleanedOutput.strip() # Remove leading/trailing whitespace @@ -81,14 +84,15 @@ def run_performance_test_cmd(loggingFolder, logFileLayout, headerPath, dataPath, def run_performance_test_with_profiler_cmd(loggingFolder, logFileLayout, headerPath, dataPath, dstPathTemp, layout, case, numRuns, testType, qaMode, batchSize): layoutName = get_layout_name(layout) - if not os.path.exists(f"{loggingFolder}/Tensor_{layoutName}/case_{case}"): - os.mkdir(f"{loggingFolder}/Tensor_{layoutName}/case_{case}") + directory_path = os.path.join(loggingFolder, "Tensor_" + layoutName, "case_" + str(case)) + if not os.path.exists(directory_path): + os.mkdir(directory_path) bitDepths = [0, 2] for bitDepth in bitDepths: - with open(f"{loggingFolder}/Tensor_voxel_hip_{logFileLayout}_raw_performance_log.txt", "a") as logFile: - print(f"\nrocprof --basenames on --timestamp on --stats -o {dstPathTemp}/Tensor_{layoutName}/case_{case}/output_case{case}.csv ./Tensor_voxel_hip {headerPath} {dataPath} {dstPathTemp} {layout} {case}{numRuns} {testType} {qaMode} {batchSize} {bitDepth}") - process = subprocess.Popen([ 'rocprof', '--basenames', 'on', '--timestamp', 'on', '--stats', '-o', f"{dstPath}/Tensor_{layoutName}/case_{case}/output_case{case}.csv", buildFolderPath + "/build/Tensor_voxel_hip", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec + with open(loggingFolder + "/Tensor_voxel_hip_" + logFileLayout + "_raw_performance_log.txt", "a") as logFile: + logFile.write("\nrocprof --basenames on --timestamp on --stats -o " + dstPathTemp + "/Tensor_" + layoutName + "/case_" + str(case) + "/output_case" + str(case) + ".csv ./Tensor_voxel_hip " + headerPath + " " + dataPath + " " + dstPathTemp + " " + str(layout) + " " + str(case) + " " + str(numRuns) + " " + str(testType) + " " + str(qaMode) + " " + str(batchSize) + " " + str(bitDepth) + "\n") + process = subprocess.Popen(['rocprof', '--basenames', 'on', '--timestamp', 'on', '--stats', '-o', dstPath + "/Tensor_" + layoutName + "/case_" + str(case) + "/output_case" + str(case) + ".csv", buildFolderPath + "/build/Tensor_voxel_hip", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec while True: output = process.stdout.readline() if not output and process.poll() is not None: @@ -227,17 +231,17 @@ def rpp_test_suite_parser_and_validator(): os.chdir(buildFolderPath + "/build") # Run cmake and make commands -subprocess.run(["cmake", scriptPath], cwd=".") # nosec -subprocess.run(["make", "-j16"], cwd=".") # nosec +subprocess.call(["cmake", scriptPath], cwd=".") # nosec +subprocess.call(["make", "-j16"], cwd=".") # nosec # List of cases supported supportedCaseList = ['0', '1', '2', '3', '4', '5', '6'] # Create folders based on testType and profilingOption if testType == 1 and profilingOption == "YES": - os.makedirs(f"{dstPath}/Tensor_PKD3") - os.makedirs(f"{dstPath}/Tensor_PLN1") - os.makedirs(f"{dstPath}/Tensor_PLN3") + os.makedirs(dstPath + "/Tensor_PKD3") + os.makedirs(dstPath + "/Tensor_PLN1") + os.makedirs(dstPath + "/Tensor_PLN3") print("\n\n\n\n\n") print("##########################################################################################") @@ -322,7 +326,7 @@ def rpp_test_suite_parser_and_validator(): continue new_file.close() - subprocess.call(['chown', '{}:{}'.format(os.getuid(), os.getgid()), RESULTS_DIR + "/consolidated_results_" + TYPE + ".stats.csv"]) # nosec + subprocess.call(['chown', str(os.getuid()) + ':' + str(os.getgid()), RESULTS_DIR + "/consolidated_results_" + TYPE + ".stats.csv"]) # nosec try: generate_performance_reports(d_counter, TYPE_LIST, RESULTS_DIR) diff --git a/utilities/test_suite/HOST/runAudioTests.py b/utilities/test_suite/HOST/runAudioTests.py index c0600c057..a1771716b 100644 --- a/utilities/test_suite/HOST/runAudioTests.py +++ b/utilities/test_suite/HOST/runAudioTests.py @@ -45,15 +45,16 @@ def get_log_file_list(): ] def run_unit_test_cmd(srcPath, case, numRuns, testType, batchSize, outFilePath): - print(f"./Tensor_audio_host {srcPath} {case} {numRuns} {testType} {numRuns} {batchSize}") - result = subprocess.run([buildFolderPath + "/build/Tensor_audio_host", srcPath, str(case), str(testType), str(numRuns), str(batchSize), outFilePath, scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_audio_host " + srcPath + " " + str(case) + " " + str(numRuns) + " " + str(testType) + " " + str(numRuns) + " " + str(batchSize)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_audio_host", srcPath, str(case), str(testType), str(numRuns), str(batchSize), outFilePath, scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) print("------------------------------------------------------------------------------------------") def run_performance_test_cmd(loggingFolder, srcPath, case, numRuns, testType, batchSize, outFilePath): - with open("{}/Tensor_audio_host_raw_performance_log.txt".format(loggingFolder), "a") as logFile: - print(f"./Tensor_audio_host {srcPath} {case} {numRuns} {testType} {numRuns} {batchSize} ") - process = subprocess.Popen([buildFolderPath + "/build/Tensor_audio_host", srcPath, str(case), str(testType), str(numRuns), str(batchSize), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_audio_host_raw_performance_log.txt", "a") as logFile: + logFile.write("./Tensor_audio_host " + srcPath + " " + str(case) + " " + str(numRuns) + " " + str(testType) + " " + str(numRuns) + " " + str(batchSize) + "\n") + process = subprocess.Popen([buildFolderPath + "/build/Tensor_audio_host", srcPath, str(case), str(testType), str(numRuns), str(batchSize), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec read_from_subprocess_and_write_to_log(process, logFile) print("------------------------------------------------------------------------------------------") @@ -87,7 +88,7 @@ def rpp_test_suite_parser_and_validator(): # validate the parameters passed by user if ((args.case_start < caseMin or args.case_start > caseMax) or (args.case_end < caseMin or args.case_end > caseMax)): - print(f"Starting case# and Ending case# must be in the {caseMin}:{caseMax} range. Aborting!") + print("Starting case# and Ending case# must be in the " + str(caseMin) + ":" + str(caseMax) + " range. Aborting!") exit(0) elif args.case_end < args.case_start: print("Ending case# must be greater than starting case#. Aborting!") @@ -120,7 +121,7 @@ def rpp_test_suite_parser_and_validator(): else: for case in args.case_list: if int(case) < caseMin or int(case) > caseMax: - print(f"Invalid case number {case}! Case number must be in the {caseMin}:{caseMax} range. Aborting!") + print("Invalid case number " + str(case) + "! Case number must be in the " + str(caseMin) + ":" + str(caseMax) + " range. Aborting!") exit(0) return args @@ -171,8 +172,8 @@ def rpp_test_suite_parser_and_validator(): os.chdir(buildFolderPath + "/build") # Run cmake and make commands -subprocess.run(["cmake", scriptPath], cwd=".") # nosec -subprocess.run(["make", "-j16"], cwd=".") # nosec +subprocess.call(["cmake", scriptPath], cwd=".") # nosec +subprocess.call(["make", "-j16"], cwd=".") # nosec # List of cases supported supportedCaseList = ['0', '1', '2', '3', '4', '5', '6', '7'] diff --git a/utilities/test_suite/HOST/runMiscTests.py b/utilities/test_suite/HOST/runMiscTests.py index 0f428fe40..931838f71 100644 --- a/utilities/test_suite/HOST/runMiscTests.py +++ b/utilities/test_suite/HOST/runMiscTests.py @@ -47,15 +47,16 @@ def get_log_file_list(): ] def run_unit_test_cmd(numDims, case, numRuns, testType, toggle, batchSize, outFilePath, additionalArg): - print(f"./Tensor_misc_host {case} {testType} {toggle} {numDims} {batchSize} {numRuns} {additionalArg}") - result = subprocess.run([buildFolderPath + "/build/Tensor_misc_host", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_misc_host " + str(case) + " " + str(testType) + " " + str(toggle) + " " + str(numDims) + " " + str(batchSize) + " " + str(numRuns) + " " + str(additionalArg)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_misc_host", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) print("------------------------------------------------------------------------------------------") def run_performance_test_cmd(loggingFolder, numDims, case, numRuns, testType, toggle, batchSize, outFilePath, additionalArg): - with open("{}/Tensor_misc_host_raw_performance_log.txt".format(loggingFolder), "a") as logFile: - print(f"./Tensor_misc_host {case} {testType} {toggle} {numDims} {batchSize} {numRuns} {additionalArg}") - process = subprocess.Popen([buildFolderPath + "/build/Tensor_misc_host", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_misc_host_raw_performance_log.txt", "a") as logFile: + logFile.write("./Tensor_misc_host " + str(case) + " " + str(testType) + " " + str(toggle) + " " + str(numDims) + " " + str(batchSize) + " " + str(numRuns) + " " + str(additionalArg) + "\n") + process = subprocess.Popen([buildFolderPath + "/build/Tensor_misc_host", str(case), str(testType), str(toggle), str(numDims), str(batchSize), str(numRuns), str(additionalArg), outFilePath, scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec read_from_subprocess_and_write_to_log(process, logFile) def run_test(loggingFolder, numDims, case, numRuns, testType, toggle, batchSize, outFilePath, additionalArg = ""): @@ -162,8 +163,8 @@ def rpp_test_suite_parser_and_validator(): os.chdir(buildFolderPath + "/build") # Run cmake and make commands -subprocess.run(["cmake", scriptPath], cwd=".") # nosec -subprocess.run(["make", "-j16"], cwd=".") # nosec +subprocess.call(["cmake", scriptPath], cwd=".") # nosec +subprocess.call(["make", "-j16"], cwd=".") # nosec supportedCaseList = ['0', '1', '2'] for case in caseList: diff --git a/utilities/test_suite/HOST/runTests.py b/utilities/test_suite/HOST/runTests.py index bec4de5be..7386b364b 100644 --- a/utilities/test_suite/HOST/runTests.py +++ b/utilities/test_suite/HOST/runTests.py @@ -71,34 +71,37 @@ def run_unit_test(srcPath1, srcPath2, dstPathTemp, case, numRuns, testType, layo if case == "8": # Run all variants of noise type functions with additional argument of noiseType = gausssianNoise / shotNoise / saltandpepperNoise for noiseType in range(3): - print(f"./Tensor_host {srcPath1} {srcPath2} {dstPathTemp} {bitDepth} {outputFormatToggle} {case} {noiseType} 0 ") - result = subprocess.run([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(noiseType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_host " + srcPath1 + " " + srcPath2 + " " + dstPathTemp + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(noiseType) + " 0") + result = subprocess.Popen([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(noiseType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) elif case == "21" or case == "23" or case == "24" or case == "79": # Run all variants of interpolation functions with additional argument of interpolationType = bicubic / bilinear / gaussian / nearestneigbor / lanczos / triangular interpolationRange = 6 if case =='79': interpolationRange = 2 for interpolationType in range(interpolationRange): - print(f"./Tensor_host {srcPath1} {srcPath2} {dstPathTemp} {bitDepth} {outputFormatToggle} {case} {interpolationType} 0") - result = subprocess.run([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(interpolationType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_host " + srcPath1 + " " + srcPath2 + " " + dstPathTemp + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(interpolationType) + " 0") + result = subprocess.Popen([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), str(interpolationType), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) else: - print(f"./Tensor_host {srcPath1} {srcPath2} {dstPathTemp} {bitDepth} {outputFormatToggle} {case} 0 {numRuns} {testType} {layout} 0") - result = subprocess.run([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), "0", str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_host " + srcPath1 + " " + srcPath2 + " " + dstPathTemp + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " 0 " + str(numRuns) + " " + str(testType) + " " + str(layout) + " 0") + result = subprocess.Popen([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPathTemp, str(bitDepth), str(outputFormatToggle), str(case), "0", str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) print("------------------------------------------------------------------------------------------") def run_performance_test_cmd(loggingFolder, logFileLayout, srcPath1, srcPath2, dstPath, bitDepth, outputFormatToggle, case, additionalParam, numRuns, testType, layout, qaMode, decoderType, batchSize, roiList): if qaMode == 1: - with open("{}/BatchPD_host_{}_raw_performance_log.txt".format(loggingFolder, logFileLayout), "a") as logFile: - process = subprocess.Popen([buildFolderPath + "/build/BatchPD_host_" + logFileLayout, srcPath1, srcPath2, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), "0"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/BatchPD_host_" + logFileLayout + "_raw_performance_log.txt", "a") as logFile: + process = subprocess.Popen([buildFolderPath + "/build/BatchPD_host_" + logFileLayout, srcPath1, srcPath2, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), "0"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec read_from_subprocess_and_write_to_log(process, logFile) - with open("{}/Tensor_host_{}_raw_performance_log.txt".format(loggingFolder, logFileLayout), "a") as logFile: - print(f"./Tensor_host {srcPath1} {srcPath2} {dstPath} {bitDepth} {outputFormatToggle} {case} {additionalParam} 0 ") - process = subprocess.Popen([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPath, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_host_" + logFileLayout + "_raw_performance_log.txt", "a") as logFile: + logFile.write("./Tensor_host " + srcPath1 + " " + srcPath2 + " " + dstPath + " " + str(bitDepth) + " " + str(outputFormatToggle) + " " + str(case) + " " + str(additionalParam) + " 0\n") + process = subprocess.Popen([buildFolderPath + "/build/Tensor_host", srcPath1, srcPath2, dstPath, str(bitDepth), str(outputFormatToggle), str(case), str(additionalParam), str(numRuns), str(testType), str(layout), "0", str(qaMode), str(decoderType), str(batchSize)] + roiList + [scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec read_from_subprocess_and_write_to_log(process, logFile) def run_performance_test(loggingFolder, logFileLayout, srcPath1, srcPath2, dstPath, case, numRuns, testType, layout, qaMode, decoderType, batchSize, roiList): @@ -154,7 +157,7 @@ def rpp_test_suite_parser_and_validator(): # validate the parameters passed by user if ((args.case_start < caseMin or args.case_start > caseMax) or (args.case_end < caseMin or args.case_end > caseMax)): - print(f"Starting case# and Ending case# must be in the {caseMin}:{caseMax} range. Aborting!") + print("Starting case# and Ending case# must be in the " + str(caseMin) + ":" + str(caseMax) + " range. Aborting!") exit(0) elif args.case_end < args.case_start: print("Ending case# must be greater than starting case#. Aborting!") @@ -193,7 +196,7 @@ def rpp_test_suite_parser_and_validator(): else: for case in args.case_list: if int(case) < caseMin or int(case) > caseMax: - print(f"Invalid case number {case}! Case number must be in the {caseMin}:{caseMax} range. Aborting!") + print("Invalid case number " + str(case) + "! Case number must be in the " + str(caseMin) + ":" + str(caseMax) + " range. Aborting!") exit(0) return args @@ -254,8 +257,8 @@ def rpp_test_suite_parser_and_validator(): os.chdir(buildFolderPath + "/build") # Run cmake and make commands -subprocess.run(["cmake", scriptPath], cwd=".") # nosec -subprocess.run(["make", "-j16"], cwd=".") # nosec +subprocess.call(["cmake", scriptPath], cwd=".") # nosec +subprocess.call(["make", "-j16"], cwd=".") # nosec # List of cases supported supportedCaseList = ['0', '1', '2', '4', '6', '8', '13', '20', '21', '23', '26', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '45', '46', '54', '61', '63', '65', '68', '70', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92'] @@ -443,23 +446,23 @@ def rpp_test_suite_parser_and_validator(): passedCases = df['Test_Result'].eq('PASSED').sum() failedCases = df['Test_Result'].eq('FAILED').sum() - summaryRow = {'BatchPD_Augmentation_Type': pd.NA, - 'Tensor_Augmentation_Type': pd.NA, - 'Performance Speedup (%)': pd.NA, - 'Test_Result': f'Final Results of Tests: Passed: {passedCases}, Failed: {failedCases}'} + summaryRow = {'BatchPD_Augmentation_Type': None, + 'Tensor_Augmentation_Type': None, + 'Performance Speedup (%)': None, + 'Test_Result': 'Final Results of Tests: Passed: ' + str(passedCases) + ', Failed: ' + str(failedCases)} - print("\n", df.to_markdown()) + print("\n" + dataframe_to_markdown(df)) # Append the summary row to the DataFrame # Convert the dictionary to a DataFrame summaryRow = pd.DataFrame([summaryRow]) - df = pd.concat([df, summaryRow], ignore_index=True) + df = pd.concat([df, summaryRow], ignore_index=True, sort = True) df.to_excel(excelFilePath, index=False) print("\n-------------------------------------------------------------------" + resultsInfo + "\n\n-------------------------------------------------------------------") print("\nIMPORTANT NOTE:") print("- The following performance comparison shows Performance Speedup percentages between times measured on previous generation RPP-BatchPD APIs against current generation RPP-Tensor APIs.") - print(f"- All APIs have been improved for performance ranging from {0}% (almost same) to {100}% faster.") + print("- All APIs have been improved for performance ranging from " + str(0) + "% (almost same) to " + str(100) + "% faster.") print("- Random observations of negative speedups might always occur due to current test machine temperature/load variances or other CPU/GPU state-dependent conditions.") print("\n-------------------------------------------------------------------\n") elif (testType == 1 and qaMode == 0): diff --git a/utilities/test_suite/HOST/runVoxelTests.py b/utilities/test_suite/HOST/runVoxelTests.py index 3dbe0baa5..f44c05f78 100644 --- a/utilities/test_suite/HOST/runVoxelTests.py +++ b/utilities/test_suite/HOST/runVoxelTests.py @@ -58,20 +58,23 @@ def func_group_finder(case_number): return "miscellaneous" def run_unit_test_cmd(headerPath, dataPath, dstPathTemp, layout, case, numRuns, testType, qaMode, batchSize): - print(f"./Tensor_voxel_host {headerPath} {dataPath} {dstPathTemp} {layout} {case} {numRuns} {testType} {qaMode} {batchSize} {bitDepth}") - result = subprocess.run([buildFolderPath + "/build/Tensor_voxel_host", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE) # nosec - print(result.stdout.decode()) + print("./Tensor_voxel_host " + headerPath + " " + dataPath + " " + dstPathTemp + " " + str(layout) + " " + str(case) + " " + str(numRuns) + " " + str(testType) + " " + str(qaMode) + " " + str(batchSize) + " " + str(bitDepth)) + result = subprocess.Popen([buildFolderPath + "/build/Tensor_voxel_host", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE) # nosec + stdout_data, stderr_data = result.communicate() + print(stdout_data.decode()) print("------------------------------------------------------------------------------------------") def run_performance_test_cmd(loggingFolder, logFileLayout, headerPath, dataPath, dstPathTemp, layout, case, numRuns, testType, qaMode, batchSize): - with open(f"{loggingFolder}/Tensor_voxel_host_{logFileLayout}_raw_performance_log.txt", "a") as logFile: - print(f"./Tensor_voxel_host {headerPath} {dataPath} {dstPathTemp} {layout} {case} {numRuns} {testType} {qaMode} {batchSize} {bitDepth}") - process = subprocess.Popen([buildFolderPath + "/build/Tensor_voxel_host", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec + with open(loggingFolder + "/Tensor_voxel_host_" + logFileLayout + "_raw_performance_log.txt", "a") as logFile: + logFile.write("./Tensor_voxel_host " + headerPath + " " + dataPath + " " + dstPathTemp + " " + str(layout) + " " + str(case) + " " + str(numRuns) + " " + str(testType) + " " + str(qaMode) + " " + str(batchSize) + " " + str(bitDepth) + "\n") + process = subprocess.Popen([buildFolderPath + "/build/Tensor_voxel_host", headerPath, dataPath, dstPathTemp, str(layout), str(case), str(numRuns), str(testType), str(qaMode), str(batchSize), str(bitDepth), scriptPath], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec while True: output = process.stdout.readline() if not output and process.poll() is not None: break - print(output.strip()) + output = output.decode().strip() # Decode bytes to string and strip extra whitespace + print(output) + logFile.write(output) if "Running" in output or "max,min,avg wall times" in output: cleanedOutput = ''.join(char for char in output if 32 <= ord(char) <= 126) # Remove control characters cleanedOutput = cleanedOutput.strip() # Remove leading/trailing whitespace @@ -203,8 +206,8 @@ def rpp_test_suite_parser_and_validator(): os.chdir(buildFolderPath + "/build") # Run cmake and make commands -subprocess.run(["cmake", scriptPath], cwd=".") # nosec -subprocess.run(["make", "-j16"], cwd=".") # nosec +subprocess.call(["cmake", scriptPath], cwd=".") # nosec +subprocess.call(["make", "-j16"], cwd=".") # nosec # List of cases supported supportedCaseList = ['0', '1', '2', '3', '4', '5', '6'] diff --git a/utilities/test_suite/common.py b/utilities/test_suite/common.py index 699495b39..19c0529df 100644 --- a/utilities/test_suite/common.py +++ b/utilities/test_suite/common.py @@ -27,6 +27,13 @@ import sys import datetime import shutil +import pandas as pd + +try: + from errno import FileExistsError +except ImportError: + # Python 2 compatibility + FileExistsError = OSError try: from errno import FileExistsError @@ -179,7 +186,7 @@ def case_file_check(CASE_FILE_PATH, TYPE, TENSOR_TYPE_LIST, new_file, d_counter) def directory_name_generator(qaMode, affinity, layoutType, case, path, func_group_finder): if qaMode == 0: functionality_group = func_group_finder(int(case)) - dst_folder_temp = f"{path}/rpp_{affinity}_{layoutType}_{functionality_group}" + dst_folder_temp = path + "/rpp_" + affinity + "_" + layoutType + "_" + functionality_group else: dst_folder_temp = path @@ -360,3 +367,22 @@ def func_group_finder(case_number): if case_number in value: return key return "miscellaneous" + +def dataframe_to_markdown(df): + # Calculate the maximum width of each column + column_widths = {} + for col in df.columns: + max_length = len(col) + for value in df[col]: + max_length = max(max_length, len(str(value))) + column_widths[col] = max_length + + # Create the header row + md = '| ' + ' | '.join([col.ljust(column_widths[col]) for col in df.columns]) + ' |\n' + md += '| ' + ' | '.join(['-' * column_widths[col] for col in df.columns]) + ' |\n' + + # Create the data rows + for i, row in df.iterrows(): + md += '| ' + ' | '.join([str(value).ljust(column_widths[df.columns[j]]) for j, value in enumerate(row.values)]) + ' |\n' + + return md diff --git a/utilities/test_suite/rpp_test_suite_misc.h b/utilities/test_suite/rpp_test_suite_misc.h index 0a4197caa..9ef118c48 100644 --- a/utilities/test_suite/rpp_test_suite_misc.h +++ b/utilities/test_suite/rpp_test_suite_misc.h @@ -98,6 +98,7 @@ void fill_roi_values(Rpp32u nDim, Rpp32u batchSize, Rpp32u *roiTensor, bool qaMo case 3: { std::array roi = {0, 0, 0, 50, 50, 8}; + for(int i = 0, j = 0; i < batchSize ; i++, j += 6) std::copy(roi.begin(), roi.end(), &roiTensor[j]); break; exit(0);