run_test.py support knc target
This commit is contained in:
53
run_tests.py
53
run_tests.py
@@ -156,6 +156,10 @@ def run_test(testname):
|
|||||||
# is this a test to make sure an error is issued?
|
# is this a test to make sure an error is issued?
|
||||||
want_error = (filename.find("tests_errors") != -1)
|
want_error = (filename.find("tests_errors") != -1)
|
||||||
if want_error == True:
|
if want_error == True:
|
||||||
|
if (options.target == "knc"):
|
||||||
|
ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \
|
||||||
|
(filename, options.arch, "generic-16")
|
||||||
|
else:
|
||||||
ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \
|
ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \
|
||||||
(filename, options.arch, options.target)
|
(filename, options.arch, options.target)
|
||||||
(return_code, output) = run_command(ispc_cmd)
|
(return_code, output) = run_command(ispc_cmd)
|
||||||
@@ -242,13 +246,21 @@ def run_test(testname):
|
|||||||
and (options.include_file.find("knc-i1x16.h")!=-1 or options.include_file.find("knc.h")!=-1 or options.include_file.find("knc2x.h")!=-1):
|
and (options.include_file.find("knc-i1x16.h")!=-1 or options.include_file.find("knc.h")!=-1 or options.include_file.find("knc2x.h")!=-1):
|
||||||
gcc_isa = '-mmic'
|
gcc_isa = '-mmic'
|
||||||
|
|
||||||
|
if (options.target == "knc"):
|
||||||
|
cc_cmd = "%s -O2 -I. %s %s test_static.cpp -DTEST_SIG=%d %s -o %s" % \
|
||||||
|
(options.compiler_exe, gcc_arch, "-mmic", match, obj_name, exe_name)
|
||||||
|
else:
|
||||||
cc_cmd = "%s -O2 -I. %s %s test_static.cpp -DTEST_SIG=%d %s -o %s" % \
|
cc_cmd = "%s -O2 -I. %s %s test_static.cpp -DTEST_SIG=%d %s -o %s" % \
|
||||||
(options.compiler_exe, gcc_arch, gcc_isa, match, obj_name, exe_name)
|
(options.compiler_exe, gcc_arch, gcc_isa, match, obj_name, exe_name)
|
||||||
|
|
||||||
if platform.system() == 'Darwin':
|
if platform.system() == 'Darwin':
|
||||||
cc_cmd += ' -Wl,-no_pie'
|
cc_cmd += ' -Wl,-no_pie'
|
||||||
if should_fail:
|
if should_fail:
|
||||||
cc_cmd += " -DEXPECT_FAILURE"
|
cc_cmd += " -DEXPECT_FAILURE"
|
||||||
|
if (options.target == "knc"):
|
||||||
|
ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \
|
||||||
|
(filename, obj_name, options.arch, "generic-16")
|
||||||
|
else:
|
||||||
ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \
|
ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \
|
||||||
(filename, obj_name, options.arch, options.target)
|
(filename, obj_name, options.arch, options.target)
|
||||||
if options.no_opt:
|
if options.no_opt:
|
||||||
@@ -459,7 +471,7 @@ def verify():
|
|||||||
"sse4-i8x16", "avx1-i32x4" "avx1-i32x8", "avx1-i32x16", "avx1-i64x4", "avx1.1-i32x8",
|
"sse4-i8x16", "avx1-i32x4" "avx1-i32x8", "avx1-i32x16", "avx1-i64x4", "avx1.1-i32x8",
|
||||||
"avx1.1-i32x16", "avx1.1-i64x4", "avx2-i32x8", "avx2-i32x16", "avx2-i64x4",
|
"avx1.1-i32x16", "avx1.1-i64x4", "avx2-i32x8", "avx2-i32x16", "avx2-i64x4",
|
||||||
"generic-1", "generic-4", "generic-8",
|
"generic-1", "generic-4", "generic-8",
|
||||||
"generic-16", "generic-32", "generic-64"]]
|
"generic-16", "generic-32", "generic-64", "knc"]]
|
||||||
for i in range (0,len(f_lines)):
|
for i in range (0,len(f_lines)):
|
||||||
if f_lines[i][0] == "%":
|
if f_lines[i][0] == "%":
|
||||||
continue
|
continue
|
||||||
@@ -531,8 +543,9 @@ def run_tests(options1, args, print_version):
|
|||||||
ispc_exe += " " + options.ispc_flags
|
ispc_exe += " " + options.ispc_flags
|
||||||
|
|
||||||
global is_generic_target
|
global is_generic_target
|
||||||
is_generic_target = (options.target.find("generic-") != -1 and
|
is_generic_target = ((options.target.find("generic-") != -1 and
|
||||||
options.target != "generic-1" and options.target != "generic-x1")
|
options.target != "generic-1" and options.target != "generic-x1") or
|
||||||
|
options.target == "knc")
|
||||||
if is_generic_target and options.include_file == None:
|
if is_generic_target and options.include_file == None:
|
||||||
if options.target == "generic-4" or options.target == "generic-x4":
|
if options.target == "generic-4" or options.target == "generic-x4":
|
||||||
error("No generics #include specified; using examples/intrinsics/sse4.h\n", 2)
|
error("No generics #include specified; using examples/intrinsics/sse4.h\n", 2)
|
||||||
@@ -553,9 +566,14 @@ def run_tests(options1, args, print_version):
|
|||||||
error("No generics #include specified; using examples/intrinsics/generic-64.h\n", 2)
|
error("No generics #include specified; using examples/intrinsics/generic-64.h\n", 2)
|
||||||
options.include_file = "examples/intrinsics/generic-64.h"
|
options.include_file = "examples/intrinsics/generic-64.h"
|
||||||
options.target = "generic-64"
|
options.target = "generic-64"
|
||||||
|
elif options.target == "knc":
|
||||||
|
error("No knc #include specified; using examples/intrinsics/knc-i1x16.h\n", 2)
|
||||||
|
options.include_file = "examples/intrinsics/knc-i1x16.h"
|
||||||
|
|
||||||
if options.compiler_exe == None:
|
if options.compiler_exe == None:
|
||||||
if is_windows:
|
if (options.target == "knc"):
|
||||||
|
options.compiler_exe = "icpc"
|
||||||
|
elif is_windows:
|
||||||
options.compiler_exe = "cl.exe"
|
options.compiler_exe = "cl.exe"
|
||||||
else:
|
else:
|
||||||
options.compiler_exe = "clang++"
|
options.compiler_exe = "clang++"
|
||||||
@@ -578,6 +596,29 @@ def run_tests(options1, args, print_version):
|
|||||||
|
|
||||||
ispc_root = "."
|
ispc_root = "."
|
||||||
|
|
||||||
|
# checks the required environment otherwise prints an error message
|
||||||
|
if (options.target == "knc"):
|
||||||
|
options.wrapexe = "micnativeloadex"
|
||||||
|
PATH_dir = string.split(os.getenv("PATH"), os.pathsep)
|
||||||
|
wrapexe_exists = False
|
||||||
|
for counter in PATH_dir:
|
||||||
|
if os.path.exists(counter + os.sep + options.wrapexe):
|
||||||
|
wrapexe_exists = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if not wrapexe_exists:
|
||||||
|
error("missing the required launcher: %s \nAdd it to your $PATH\n" % options.wrapexe, 1)
|
||||||
|
|
||||||
|
if platform.system() == 'Windows' or 'CYGWIN_NT' in platform.system():
|
||||||
|
OS = "Windows"
|
||||||
|
else:
|
||||||
|
if platform.system() == 'Darwin':
|
||||||
|
OS = "Mac"
|
||||||
|
else:
|
||||||
|
OS = "Linux"
|
||||||
|
|
||||||
|
if not (OS == 'Linux'):
|
||||||
|
error ("knc target supported only on Linux", 1)
|
||||||
# if no specific test files are specified, run all of the tests in tests/,
|
# if no specific test files are specified, run all of the tests in tests/,
|
||||||
# failing_tests/, and tests_errors/
|
# failing_tests/, and tests_errors/
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
@@ -726,7 +767,7 @@ if __name__ == "__main__":
|
|||||||
parser.add_option("-f", "--ispc-flags", dest="ispc_flags", help="Additional flags for ispc (-g, -O1, ...)",
|
parser.add_option("-f", "--ispc-flags", dest="ispc_flags", help="Additional flags for ispc (-g, -O1, ...)",
|
||||||
default="")
|
default="")
|
||||||
parser.add_option('-t', '--target', dest='target',
|
parser.add_option('-t', '--target', dest='target',
|
||||||
help='Set compilation target (sse2-i32x4, sse2-i32x8, sse4-i32x4, sse4-i32x8, sse4-i16x8, sse4-i8x16, avx1-i32x8, avx1-i32x16, avx1.1-i32x8, avx1.1-i32x16, avx2-i32x8, avx2-i32x16, generic-x1, generic-x4, generic-x8, generic-x16, generic-x32, generic-x64)',
|
help='Set compilation target (sse2-i32x4, sse2-i32x8, sse4-i32x4, sse4-i32x8, sse4-i16x8, sse4-i8x16, avx1-i32x8, avx1-i32x16, avx1.1-i32x8, avx1.1-i32x16, avx2-i32x8, avx2-i32x16, generic-x1, generic-x4, generic-x8, generic-x16, generic-x32, generic-x64, knc)',
|
||||||
default="sse4")
|
default="sse4")
|
||||||
parser.add_option('-a', '--arch', dest='arch',
|
parser.add_option('-a', '--arch', dest='arch',
|
||||||
help='Set architecture (arm, x86, x86-64)',
|
help='Set architecture (arm, x86, x86-64)',
|
||||||
|
|||||||
Reference in New Issue
Block a user