small corrections of test system

This commit is contained in:
Ilia Filippov
2013-09-20 17:28:07 +04:00
parent 491c58aef3
commit af5da885a5
6 changed files with 169 additions and 117 deletions

6
.gitignore vendored
View File

@@ -3,14 +3,20 @@
depend depend
ispc ispc
ispc_test ispc_test
ispc_ref
objs objs
docs/doxygen docs/doxygen
docs/*.html docs/*.html
tests*/*cpp tests*/*cpp
tests*/*run tests*/*run
logs/
notify_log.log
alloy_results_*
examples/*/*.png examples/*/*.png
examples/*/*.ppm examples/*/*.ppm
examples/*/objs/* examples/*/objs/*
examples/*/ref
examples/*/test
*.swp *.swp

223
alloy.py
View File

@@ -101,8 +101,7 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, from_v
LLVM_BUILD="build-" + folder LLVM_BUILD="build-" + folder
LLVM_BIN="bin-" + folder LLVM_BIN="bin-" + folder
if os.path.exists(LLVM_BIN) and not force: if os.path.exists(LLVM_BIN) and not force:
print_debug("You have folder " + LLVM_BIN + ". If you want to rebuild use --force\n", False, "") error("you have folder " + LLVM_BIN + ".\nIf you want to rebuild use --force", 1)
exit(0)
LLVM_BUILD_selfbuild = LLVM_BUILD + "_temp" LLVM_BUILD_selfbuild = LLVM_BUILD + "_temp"
LLVM_BIN_selfbuild = LLVM_BIN + "_temp" LLVM_BIN_selfbuild = LLVM_BIN + "_temp"
common.remove_if_exists(LLVM_SRC) common.remove_if_exists(LLVM_SRC)
@@ -188,26 +187,45 @@ def check_targets():
AVX = False; AVX = False;
AVX11 = False; AVX11 = False;
AVX2 = False; AVX2 = False;
cpu = open("/proc/cpuinfo") if current_OS == "Linux":
f_lines = cpu.readlines() cpu = open("/proc/cpuinfo")
cpu.close() f_lines = cpu.readlines()
# check what native targets do we have cpu.close()
for i in range(0,len(f_lines)): # check what native targets do we have
if SSE2 == False and "sse2" in f_lines[i]: for i in range(0,len(f_lines)):
if SSE2 == False and "sse2" in f_lines[i]:
SSE2 = True;
answer = answer + ["sse2-i32x4", "sse2-i32x8"]
if SSE4 == False and "sse4_1" in f_lines[i]:
SSE4 = True;
answer = answer + ["sse4-i32x4", "sse4-i32x8", "sse4-i16x8", "sse4-i8x16"]
if AVX == False and "avx" in f_lines[i]:
AVX = True;
answer = answer + ["avx1-i32x8", "avx1-i32x16"]
if AVX11 == False and "rdrand" in f_lines[i]:
AVX11 = True;
answer = answer + ["avx1.1-i32x8", "avx1.1-i32x16"]
if AVX2 == False and "avx2" in f_lines[i]:
AVX2 = True;
answer = answer + ["avx2-i32x8", "avx2-i32x16"]
if current_OS == "MacOS":
f_lines = take_lines("sysctl machdep.cpu.features", "first")
if "SSE2" in f_lines:
SSE2 = True; SSE2 = True;
answer = answer + ["sse2-i32x4", "sse2-i32x8"] answer = answer + ["sse2-i32x4", "sse2-i32x8"]
if SSE4 == False and "sse4_1" in f_lines[i]: if "SSE4.1" in f_lines:
SSE4 = True; SSE4 = True;
answer = answer + ["sse4-i32x4", "sse4-i32x8", "sse4-i16x8", "sse4-i8x16"] answer = answer + ["sse4-i32x4", "sse4-i32x8", "sse4-i16x8", "sse4-i8x16"]
if AVX == False and "avx" in f_lines[i]: if "AVX1.0" in f_lines:
AVX = True; AVX = True;
answer = answer + ["avx1-i32x8", "avx1-i32x16"] answer = answer + ["avx1-i32x8", "avx1-i32x16"]
if AVX11 == False and "rdrand" in f_lines[i]: if "RDRAND" in f_lines:
AVX11 = True; AVX11 = True;
answer = answer + ["avx1.1-i32x8", "avx1.1-i32x16"] answer = answer + ["avx1.1-i32x8", "avx1.1-i32x16"]
if AVX2 == False and "avx2" in f_lines[i]: if "AVX2.0" in f_lines:
AVX2 = True; AVX2 = True;
answer = answer + ["avx2-i32x8", "avx2-i32x16"] answer = answer + ["avx2-i32x8", "avx2-i32x16"]
answer = answer + ["generic-4", "generic-16", "generic-8", "generic-1", "generic-32", "generic-64"] answer = answer + ["generic-4", "generic-16", "generic-8", "generic-1", "generic-32", "generic-64"]
# now check what targets we have with the help of SDE # now check what targets we have with the help of SDE
sde_exists = "" sde_exists = ""
@@ -224,17 +242,14 @@ def check_targets():
"Please refer to http://www.intel.com/software/sde for SDE download information.", 2) "Please refer to http://www.intel.com/software/sde for SDE download information.", 2)
return [answer, answer_sde] return [answer, answer_sde]
# here we have SDE # here we have SDE
os.system(sde_exists + " -help > " + temp_alloy_file) f_lines = take_lines(sde_exists + " -help", "all")
cpu = open(temp_alloy_file)
f_lines = cpu.readlines()
cpu.close()
for i in range(0,len(f_lines)): for i in range(0,len(f_lines)):
if SSE4 == False and "wsm" in f_lines[i]: if SSE4 == False and "wsm" in f_lines[i]:
answer_sde = answer_sde + [["-wsm", "sse4-i32x4"], ["-wsm", "sse4-i32x8"], ["-wsm", "sse4-i16x8"], ["-wsm", "sse4-i8x16"]] answer_sde = answer_sde + [["-wsm", "sse4-i32x4"], ["-wsm", "sse4-i32x8"], ["-wsm", "sse4-i16x8"], ["-wsm", "sse4-i8x16"]]
if AVX == False and "snb" in f_lines[i]: if AVX == False and "snb" in f_lines[i]:
answer_sde = answer_sde + [["-snb", "avx1-i32x8"], ["-snb", "avx1-i32x16"]] answer_sde = answer_sde + [["-snb", "avx1-i32x8"], ["-snb", "avx1-i32x16"]]
if AVX11 == False and "ivb" in f_lines[i]: if AVX11 == False and "ivb" in f_lines[i]:
answer_sde = answer_sde + [["-ivb", "avx1.1-i32x8"], ["ivb", "avx1.1-i32x16"]] answer_sde = answer_sde + [["-ivb", "avx1.1-i32x8"], ["-ivb", "avx1.1-i32x16"]]
if AVX2 == False and "hsw" in f_lines[i]: if AVX2 == False and "hsw" in f_lines[i]:
answer_sde = answer_sde + [["-hsw", "avx2-i32x8"], ["-hsw", "avx2-i32x16"]] answer_sde = answer_sde + [["-hsw", "avx2-i32x8"], ["-hsw", "avx2-i32x16"]]
return [answer, answer_sde] return [answer, answer_sde]
@@ -271,14 +286,11 @@ def execute_stability(stability, R, print_version):
def run_special_tests(): def run_special_tests():
i = 5 i = 5
def validation_run(only, only_targets, reference_branch, notify, update): def validation_run(only, only_targets, reference_branch, number, notify, update):
current_path = os.getcwd()
os.chdir(os.environ["ISPC_HOME"]) os.chdir(os.environ["ISPC_HOME"])
os.environ["PATH"] = os.environ["ISPC_HOME"] + ":" + os.environ["PATH"] os.environ["PATH"] = os.environ["ISPC_HOME"] + ":" + os.environ["PATH"]
if options.notify != "": if options.notify != "":
if os.environ.get("SMTP_ISPC") == None: common.remove_if_exists(os.environ["ISPC_HOME"] + os.sep + "notify_log.log")
error("you have no SMTP_ISPC in your environment for option notify", 1)
common.remove_if_exists(os.environ["ISPC_HOME"] + os.sep + "all_answer.txt")
smtp_server = os.environ["SMTP_ISPC"] smtp_server = os.environ["SMTP_ISPC"]
msg = MIMEMultipart() msg = MIMEMultipart()
msg['Subject'] = 'ISPC test system results' msg['Subject'] = 'ISPC test system results'
@@ -437,7 +449,7 @@ def validation_run(only, only_targets, reference_branch, notify, update):
print_debug("\n\nPerformance validation run\n\n", False, "") print_debug("\n\nPerformance validation run\n\n", False, "")
performance = options_for_drivers() performance = options_for_drivers()
# performance constant options # performance constant options
performance.number = 5 performance.number = number
performance.config = "./perf.ini" performance.config = "./perf.ini"
performance.path = "./" performance.path = "./"
performance.silent = True performance.silent = True
@@ -450,16 +462,13 @@ def validation_run(only, only_targets, reference_branch, notify, update):
if len(need_LLVM) != 0: if len(need_LLVM) != 0:
build_LLVM(need_LLVM[i], "", "", "", False, False, True, False) build_LLVM(need_LLVM[i], "", "", "", False, False, True, False)
# prepare reference point. build both test and reference compilers # prepare reference point. build both test and reference compilers
os.system("git branch > " + temp_alloy_file) temp4 = take_lines("git branch", "all")
br = open(temp_alloy_file)
temp4 = br.readlines()
br.close()
for line in temp4: for line in temp4:
if "*" in line: if "*" in line:
current_branch = line[2:-1] current_branch = line[2:-1]
stashing = True stashing = True
sys.stdout.write("Please, don't interrupt script here! You can have not sync git status after interruption!\n") sys.stdout.write("Please, don't interrupt script here! You can have not sync git status after interruption!\n")
if "No local changes" in detect_version("git stash"): if "No local changes" in take_lines("git stash", "first"):
stashing = False stashing = False
#try_do_LLVM("stash current branch ", "git stash", True) #try_do_LLVM("stash current branch ", "git stash", True)
try_do_LLVM("checkout reference branch " + reference_branch + " ", "git checkout " + reference_branch, True) try_do_LLVM("checkout reference branch " + reference_branch + " ", "git checkout " + reference_branch, True)
@@ -478,11 +487,9 @@ def validation_run(only, only_targets, reference_branch, notify, update):
attach_mail_file(msg, performance.in_file, "performance.log") attach_mail_file(msg, performance.in_file, "performance.log")
attach_mail_file(msg, "." + os.sep + "logs" + os.sep + "perf_build.log", "perf_build.log") attach_mail_file(msg, "." + os.sep + "logs" + os.sep + "perf_build.log", "perf_build.log")
print_debug("Logs are in alloy_results_[date]", False, "")
# sending e-mail with results # sending e-mail with results
if options.notify != "": if options.notify != "":
fp = open(os.environ["ISPC_HOME"] + os.sep + "all_answer.txt", 'rb') fp = open(os.environ["ISPC_HOME"] + os.sep + "notify_log.log", 'rb')
f_lines = fp.readlines() f_lines = fp.readlines()
fp.close() fp.close()
line = "" line = ""
@@ -495,46 +502,56 @@ def validation_run(only, only_targets, reference_branch, notify, update):
s = smtplib.SMTP(smtp_server) s = smtplib.SMTP(smtp_server)
s.sendmail('ISPC_test_system', options.notify, msg.as_string()) s.sendmail('ISPC_test_system', options.notify, msg.as_string())
s.quit() s.quit()
# exit of validation routine
common.remove_if_exists(temp_alloy_file)
os.chdir(current_path)
def Main(): def Main():
global current_OS
if (platform.system() == 'Windows' or 'CYGWIN_NT' in platform.system()) == True: if (platform.system() == 'Windows' or 'CYGWIN_NT' in platform.system()) == True:
current_OS = "Windows"
error("Windows isn't supported now", 1) error("Windows isn't supported now", 1)
if (options.build_llvm == False and else:
options.validation_run == False and if (platform.system() == 'Darwin'):
options.llvm_home == "" and current_OS = "MacOS"
options.ispc_home == "" and else:
options.sde_home == ""): current_OS = "Linux"
if (options.build_llvm == False and options.validation_run == False):
parser.print_help() parser.print_help()
exit(0) exit(0)
global f_date
f_date = "logs"
common.remove_if_exists(f_date)
os.makedirs(f_date)
global temp_alloy_file
temp_alloy_file = os.getcwd() + os.sep + f_date + os.sep + "temp_detect_version"
global alloy_build
alloy_build = os.getcwd() + os.sep + f_date + os.sep + "alloy_build.log"
common.remove_if_exists(alloy_build)
global stability_log
stability_log = os.getcwd() + os.sep + f_date + os.sep + "stability.log"
common.remove_if_exists(stability_log)
setting_paths(options.llvm_home, options.ispc_home, options.sde_home) setting_paths(options.llvm_home, options.ispc_home, options.sde_home)
if os.environ.get("LLVM_HOME") == None: if os.environ.get("LLVM_HOME") == None:
error("you have no LLVM_HOME", 1) error("you have no LLVM_HOME", 1)
if os.environ.get("ISPC_HOME") == None: if os.environ.get("ISPC_HOME") == None:
error("you have no ISPC_HOME", 1) error("you have no ISPC_HOME", 1)
if options.build_llvm: if options.notify != "":
build_LLVM(options.version, options.revision, options.folder, options.tarball, if os.environ.get("SMTP_ISPC") == None:
error("you have no SMTP_ISPC in your environment for option notify", 1)
global f_date
f_date = "logs"
common.remove_if_exists(f_date)
os.makedirs(f_date)
global alloy_build
alloy_build = os.getcwd() + os.sep + f_date + os.sep + "alloy_build.log"
global stability_log
stability_log = os.getcwd() + os.sep + f_date + os.sep + "stability.log"
current_path = os.getcwd()
try:
if options.build_llvm:
build_LLVM(options.version, options.revision, options.folder, options.tarball,
options.debug, options.selfbuild, False, options.force) options.debug, options.selfbuild, False, options.force)
if options.validation_run: if options.validation_run:
validation_run(options.only, options.only_targets, options.branch, options.notify, options.update) validation_run(options.only, options.only_targets, options.branch,
os.rename(f_date, "alloy_results_" + datetime.datetime.now().strftime('%H_%M_%d_%m_%Y')) options.number_for_performance, options.notify, options.update)
finally:
os.chdir(current_path)
date_name = "alloy_results_" + datetime.datetime.now().strftime('%H_%M_%d_%m_%Y')
os.rename(f_date, date_name)
print_debug("Logs are in " + date_name + "\n", False, "")
###Main### ###Main###
from optparse import OptionParser from optparse import OptionParser
from optparse import OptionGroup
import sys import sys
import os import os
import operator import operator
@@ -554,47 +571,73 @@ import run_tests
import perf import perf
import common import common
error = common.error error = common.error
detect_version = common.detect_version take_lines = common.take_lines
print_debug = common.print_debug print_debug = common.print_debug
# parsing options # parsing options
parser = OptionParser() class MyParser(OptionParser):
# options for activity "build LLVM" def format_epilog(self, formatter):
return self.epilog
examples = ("Examples:\n" +
"Load and build LLVM from trunk\n\talloy.py -b\n" +
"Load and build LLVM 3.3. Rewrite LLVM folders\n\talloy.py -b --version=3.3 --force\n" +
"Untar files llvm.tgz clang.tgz, build LLVM from them in folder bin-from_tar\n\talloy.py -b --tarball='llvm.tgz clang.tgz' --folder=from_tar\n" +
"Load LLVM from trunk, revision r172870. Build it. Do selfbuild\n\talloy.py -b --revision=r172870 --selfbuild\n" +
"Validation run with LLVM 3.3, trunk; x86, x86-64; -O2;\nall supported targets; performance\n\talloy.py -r\n" +
"Validation run with all avx targets and sse4-i8x16 without performance\n\talloy.py -r --only=stability --only-targets='avx sse4-i8x16'\n" +
"Validation run with avx2-i32x8, all sse4 and sse2 targets\nand all targets with i32x16\n\talloy.py -r --only-targets='avx2-i32x8 sse4 i32x16 sse2'\n" +
"Stability validation run with LLVM 3.2, 3.3; -O0; x86,\nupdate fail_db.txt with passes and fails\n\talloy.py -r --only='3.2 -O0 stability 3.3 x86' --update-errors=FP\n" +
"Try to build compiler with all LLVM\n\talloy.py -r --only=build\n" +
"Performance validation run with 10 runs of each test and comparing to branch 'old'\n\talloy.py -r --only=performance --compare-with=old --number=10\n" +
"Validation run. Update fail_db.txt with new fails, send results to my@my.com\n\talloy.py -r --update-errors=F --notify='my@my.com'\n")
parser = MyParser(usage="Usage: alloy.py -r/-b [options]", epilog=examples)
parser.add_option('-b', '--build-llvm', dest='build_llvm', parser.add_option('-b', '--build-llvm', dest='build_llvm',
help='ask to build LLVM', default=False, action="store_true") help='ask to build LLVM', default=False, action="store_true")
parser.add_option('--version', dest='version',
help='version of llvm to build: 3.1 3.2 3.3 trunk', default="trunk")
parser.add_option('--revision', dest='revision',
help='revision of llvm to build in format r172870', default="")
parser.add_option('--debug', dest='debug',
help='debug build of LLVM?', default=False, action="store_true")
parser.add_option('--folder', dest='folder',
help='folder to build LLVM in', default="")
parser.add_option('--tarball', dest='tarball',
help='"llvm_tarball clang_tarball"', default="")
parser.add_option('--selfbuild', dest='selfbuild',
help='make selfbuild of LLVM and clang', default=False, action="store_true")
parser.add_option('--force', dest='force',
help='rebuild LLVM', default=False, action='store_true')
# options for activity "setup PATHS"
parser.add_option('--llvm_home', dest='llvm_home',help='path to LLVM',default="")
parser.add_option('--ispc_home', dest='ispc_home',help='path to ISPC',default="")
parser.add_option('--sde_home', dest='sde_home',help='path to SDE',default="")
# options for activity "validation run"
parser.add_option('-r', '--run', dest='validation_run', parser.add_option('-r', '--run', dest='validation_run',
help='ask for validation run', default=False, action="store_true") help='ask for validation run', default=False, action="store_true")
parser.add_option('--compare-with', dest='branch', # options for activity "build LLVM"
help='set performance reference point', default="master") llvm_group = OptionGroup(parser, "Options for building LLVM",
parser.add_option('--only-targets', dest='only_targets', "These options must be used with -b option.")
help='set list of targets to test. Possible values - all subnames of targets.\n' + llvm_group.add_option('--version', dest='version',
'Example: --only-targets="avx2-i32x8 sse4 i32x16 sse2"', default="") help='version of llvm to build: 3.1 3.2 3.3 trunk. Default: trunk', default="trunk")
parser.add_option('--notify', dest='notify', llvm_group.add_option('--revision', dest='revision',
help='sent results to email', default="") help='revision of llvm to build in format r172870', default="")
parser.add_option('--only', dest='only', llvm_group.add_option('--debug', dest='debug',
help='debug build of LLVM?', default=False, action="store_true")
llvm_group.add_option('--folder', dest='folder',
help='folder to build LLVM in', default="")
llvm_group.add_option('--tarball', dest='tarball',
help='"llvm_tarball clang_tarball"', default="")
llvm_group.add_option('--selfbuild', dest='selfbuild',
help='make selfbuild of LLVM and clang', default=False, action="store_true")
llvm_group.add_option('--force', dest='force',
help='rebuild LLVM', default=False, action='store_true')
parser.add_option_group(llvm_group)
# options for activity "validation run"
run_group = OptionGroup(parser, "Options for validation run",
"These options must be used with -r option.")
run_group.add_option('--compare-with', dest='branch',
help='set performance reference point. Dafault: master', default="master")
run_group.add_option('--number', dest='number_for_performance',
help='number of performance runs for each test. Default: 5', default=5)
run_group.add_option('--notify', dest='notify',
help='email to sent results to', default="")
run_group.add_option('--update-errors', dest='update',
help='rewrite fail_db.txt file according to received results (F or FP)', default="")
run_group.add_option('--only-targets', dest='only_targets',
help='set list of targets to test. Possible values - all subnames of targets.',
default="")
run_group.add_option('--only', dest='only',
help='set types of tests. Possible values:\n' + help='set types of tests. Possible values:\n' +
'-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance)\n' + '-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance)\n' +
'build (only build with different LLVM), 3.1, 3.2, 3.3, trunk, native (do not use SDE), current (do not rebuild ISPC).\n' + 'build (only build with different LLVM), 3.1, 3.2, 3.3, trunk, native (do not use SDE), current (do not rebuild ISPC).',
'Example: --only="3.2 -O0 stability 3.3"', default="") default="")
parser.add_option('--update-errors', dest='update', parser.add_option_group(run_group)
help='rewrite fail_db.txt file according to received results (F or FP)', default="") # options for activity "setup PATHS"
setup_group = OptionGroup(parser, "Options for setup",
"These options must be use with -r or -b to setup environment variables")
setup_group.add_option('--llvm_home', dest='llvm_home',help='path to LLVM',default="")
setup_group.add_option('--ispc_home', dest='ispc_home',help='path to ISPC',default="")
setup_group.add_option('--sde_home', dest='sde_home',help='path to SDE',default="")
parser.add_option_group(setup_group)
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
Main() Main()

View File

@@ -39,7 +39,7 @@ import os
import string import string
print_debug = common.print_debug print_debug = common.print_debug
error = common.error error = common.error
detect_version = common.detect_version take_lines = common.take_lines
exists = [False, False, False, False, False, False, False, False] exists = [False, False, False, False, False, False, False, False]
names = ["m4", "bison", "flex", "sde", "ispc", "clang", "gcc", "icc"] names = ["m4", "bison", "flex", "sde", "ispc", "clang", "gcc", "icc"]
@@ -54,26 +54,26 @@ print_debug("=== in PATH: ===\n", False, "")
print_debug("Tools:\n", False, "") print_debug("Tools:\n", False, "")
for i in range(0,3): for i in range(0,3):
if exists[i]: if exists[i]:
print_debug(detect_version(names[i] + " --version"), False, "") print_debug(take_lines(names[i] + " --version", "first"), False, "")
else: else:
error("you don't have " + names[i], 0) error("you don't have " + names[i], 0)
if exists[0] and exists[1] and exists[2]: if exists[0] and exists[1] and exists[2]:
if common.check_tools(2): if common.check_tools(2):
print_debug("versions are ok\n", False, "") print_debug("Tools' versions are ok\n", False, "")
print_debug("\nSDE:\n", False, "") print_debug("\nSDE:\n", False, "")
if exists[3]: if exists[3]:
print_debug(detect_version(names[3] + " --version"), False, "") print_debug(take_lines(names[3] + " --version", "first"), False, "")
else: else:
error("you don't have " + names[3], 2) error("you don't have " + names[3], 2)
print_debug("\nISPC:\n", False, "") print_debug("\nISPC:\n", False, "")
if exists[4]: if exists[4]:
print_debug(detect_version(names[4] + " --version"), False, "") print_debug(take_lines(names[4] + " --version", "first"), False, "")
else: else:
error("you don't have " + names[4], 2) error("you don't have " + names[4], 2)
print_debug("\nC/C++ compilers:\n", False, "") print_debug("\nC/C++ compilers:\n", False, "")
for i in range(5,8): for i in range(5,8):
if exists[i]: if exists[i]:
print_debug(detect_version(names[i] + " --version"), False, "") print_debug(take_lines(names[i] + " --version", "first"), False, "")
else: else:
error("you don't have " + names[i], 2) error("you don't have " + names[i], 2)
@@ -88,7 +88,7 @@ else:
print_debug("Your ISPC_HOME:" + os.environ.get("ISPC_HOME") + "\n", False, "") print_debug("Your ISPC_HOME:" + os.environ.get("ISPC_HOME") + "\n", False, "")
if os.path.exists(os.environ.get("ISPC_HOME") + os.sep + "ispc"): if os.path.exists(os.environ.get("ISPC_HOME") + os.sep + "ispc"):
print_debug("You have ISPC in your ISPC_HOME: " + print_debug("You have ISPC in your ISPC_HOME: " +
detect_version(os.environ.get("ISPC_HOME") + os.sep + "ispc" + " --version"), False, "") take_lines(os.environ.get("ISPC_HOME") + os.sep + "ispc" + " --version", "first"), False, "")
else: else:
error("you don't have ISPC in your ISPC_HOME", 2) error("you don't have ISPC in your ISPC_HOME", 2)
if os.environ.get("SDE_HOME") == None: if os.environ.get("SDE_HOME") == None:
@@ -97,6 +97,6 @@ else:
print_debug("Your SDE_HOME:" + os.environ.get("SDE_HOME") + "\n", False, "") print_debug("Your SDE_HOME:" + os.environ.get("SDE_HOME") + "\n", False, "")
if os.path.exists(os.environ.get("SDE_HOME") + os.sep + "sde"): if os.path.exists(os.environ.get("SDE_HOME") + os.sep + "sde"):
print_debug("You have sde in your SDE_HOME: " + print_debug("You have sde in your SDE_HOME: " +
detect_version(os.environ.get("SDE_HOME") + os.sep + "sde" + " --version"), False, "") take_lines(os.environ.get("SDE_HOME") + os.sep + "sde" + " --version", "first"), False, "")
else: else:
error("you don't have any SDE in your ISPC_HOME", 2) error("you don't have any SDE in your ISPC_HOME", 2)

View File

@@ -50,21 +50,24 @@ def remove_if_exists(filename):
os.remove(filename) os.remove(filename)
# detect version which is printed after command # detect version which is printed after command
def detect_version(command): def take_lines(command, which):
os.system(command + " > " + "temp_detect_version") os.system(command + " > " + "temp_detect_version")
version = open("temp_detect_version") version = open("temp_detect_version")
answer = version.readline() if which == "first":
answer = version.readline()
if which == "all":
answer = version.readlines()
version.close() version.close()
remove_if_exists("temp_detect_version") remove_if_exists("temp_detect_version")
return answer return answer
# print versions of compilers # print versions of compilers
def print_version(ispc_test, ispc_ref, ref_compiler, s, perf_log, is_windows): def print_version(ispc_test, ispc_ref, ref_compiler, s, perf_log, is_windows):
print_debug("\nUsing test compiler: " + detect_version(ispc_test + " --version"), s, perf_log) print_debug("\nUsing test compiler: " + take_lines(ispc_test + " --version", "first"), s, perf_log)
if ispc_ref != "": if ispc_ref != "":
print_debug("Using ref compiler: " + detect_version(ispc_ref + " --version"), s, perf_log) print_debug("Using ref compiler: " + take_lines(ispc_ref + " --version", "first"), s, perf_log)
if is_windows == False: if is_windows == False:
temp1 = detect_version(ref_compiler + " --version") temp1 = take_lines(ref_compiler + " --version", "first")
else: else:
os.system(ref_compiler + " 2>&1" + " 2> temp_detect_version > temp_detect_version1" ) os.system(ref_compiler + " 2>&1" + " 2> temp_detect_version > temp_detect_version1" )
version = open("temp_detect_version") version = open("temp_detect_version")
@@ -80,7 +83,7 @@ def print_debug(line, silent, filename):
sys.stdout.write(line) sys.stdout.write(line)
sys.stdout.flush() sys.stdout.flush()
if os.environ.get("ISPC_HOME") != None: if os.environ.get("ISPC_HOME") != None:
write_to_file(os.environ["ISPC_HOME"] + os.sep + "all_answer.txt", line) write_to_file(os.environ["ISPC_HOME"] + os.sep + "notify_log.log", line)
if filename != "": if filename != "":
write_to_file(filename, line) write_to_file(filename, line)
@@ -102,9 +105,9 @@ def check_tools(m):
input_tools=[[[1,4],"m4 --version", "bad m4 version"], input_tools=[[[1,4],"m4 --version", "bad m4 version"],
[[2,4],"bison --version", "bad bison version"], [[2,4],"bison --version", "bad bison version"],
[[2,5], "flex --version", "bad flex version"]] [[2,5], "flex --version", "bad flex version"]]
ret = 1
for t in range(0,len(input_tools)): for t in range(0,len(input_tools)):
t1 = ((detect_version(input_tools[t][1]))[:-1].split(" ")) t1 = ((take_lines(input_tools[t][1], "first"))[:-1].split(" "))
for i in range(0,len(t1)): for i in range(0,len(t1)):
t11 = t1[i].split(".") t11 = t1[i].split(".")
f = True f = True
@@ -116,5 +119,5 @@ def check_tools(m):
if j < len(input_tools[t][0]): if j < len(input_tools[t][0]):
if int(t11[j])<input_tools[t][0][j]: if int(t11[j])<input_tools[t][0][j]:
error(input_tools[t][2], m) error(input_tools[t][2], m)
return 0 ret = 0
return 1 return ret

12
perf.py
View File

@@ -247,11 +247,11 @@ def compare(A, B):
p1 = 0 p1 = 0
else: else:
p1 = 100 - 100 * A[3][i]/B[3][i] p1 = 100 - 100 * A[3][i]/B[3][i]
print_debug("%21s: %10.2f %10.2f %10.2f" % (A[0][i], A[3][i], B[3][i], p1), False, "") print_debug("%21s: %10.2f %10.2f %10.2f" % (A[0][i], A[3][i], B[3][i], abs(p1)), False, "")
if p1 < -1: if p1 < -1:
print_debug(" <-", False, "")
if p1 > 1:
print_debug(" <+", False, "") print_debug(" <+", False, "")
if p1 > 1:
print_debug(" <-", False, "")
print_debug("\n", False, "") print_debug("\n", False, "")
print_debug("\n", False, "") print_debug("\n", False, "")
@@ -261,11 +261,11 @@ def compare(A, B):
p2 = 0 p2 = 0
else: else:
p2 = 100 - 100 * A[4][i]/B[4][i] p2 = 100 - 100 * A[4][i]/B[4][i]
print_debug("%21s: %10.2f %10.2f %10.2f" % (A[0][i], A[4][i], B[4][i], p2), False, "") print_debug("%21s: %10.2f %10.2f %10.2f" % (A[0][i], A[4][i], B[4][i], abs(p2)), False, "")
if p2 < -1: if p2 < -1:
print_debug(" <-", False, "")
if p2 > 1:
print_debug(" <+", False, "") print_debug(" <+", False, "")
if p2 > 1:
print_debug(" <-", False, "")
print_debug("\n", False, "") print_debug("\n", False, "")
if "performance.log" in options.in_file: if "performance.log" in options.in_file:
print_debug("\n\n_________________Watch performance.log for details________________\n", False, "") print_debug("\n\n_________________Watch performance.log for details________________\n", False, "")

View File

@@ -364,11 +364,11 @@ def file_check(compfails, runfails):
else: else:
opt = "-O2" opt = "-O2"
# Detect LLVM version # Detect LLVM version
temp1 = common.detect_version(ispc_exe + " --version") temp1 = common.take_lines(ispc_exe + " --version", "first")
llvm_version = temp1[-10:-2] llvm_version = temp1[-10:-2]
#Detect compiler version # Detect compiler version
if is_windows == False: if is_windows == False:
temp1 = common.detect_version(options.compiler_exe + " --version") temp1 = common.take_lines(options.compiler_exe + " --version", "first")
temp2 = temp1.split(" ") temp2 = temp1.split(" ")
compiler_version = temp2[0] + temp2[2][0:4] compiler_version = temp2[0] + temp2[2][0:4]
else: else: