Ejemplo n.º 1
0
def run_davinci(version, deviceid, arch):
    #    cmd = DAVINCIPATH + 'Scripts/run.bat ' + DAVINCIPATH + 'bin ' + TESTPATH
    #    cmd = DAVINCIPATH + 'Scripts/run.bat'
    #    t = MyThread(cmd)
    #    t.start()

    #set currentFolder=%~dp0
    #set DaVinciHome=%~1
    #set QScriptFolder=%~2
    #set CameraMode=%3
    #set aggressive=%4
    #set SilentMode=%5
    #set FileList=%6

    precondition_davinci()
    time.sleep(5)

    if (not common.find_file(os.path.join(SUITEPATH, 'user_input1.txt'))) or (not common.find_file(os.path.join(SUITEPATH, 'user_input2.txt'))):
        l('Unable to get init config file: user_input1.txt and user_input2.txt')
        sys.exit(0)

    cmdbat = DAVINCIPATH + 'Scripts/run.bat'
    args1 = DAVINCIPATH + 'bin'
    args2 = TESTPATH
    args3 = 'ScreenCap'
    args4 = 'False'
    args5 = 'True'
    args6 = ''

    cmd = [cmdbat, args1, args2, args3, args4, args5, args6]
    cmdsystem = ' '.join(cmd)
    l('Start to run DaVinci:')
    l('------------------------------------------------------------------------------------------------------------------------------------')
    l(cmdsystem)
    os.system(cmdsystem)
Ejemplo n.º 2
0
def prepare_davinci_run_qs_py():
    davinci_device_environment_set = common.parse_c_json(JSONPATH, 'davinci_device_environment_set')
    #davinci_timeout = common.parse_c_json(JSONPATH, 'davinci_timeout')
    davinci_rerun_max = common.parse_c_json(JSONPATH, 'davinci_rerun_max')
    davinci_battery_threshold = common.parse_c_json(JSONPATH, 'davinci_battery_threshold')

    run_qs_path = os.path.join(DAVINCIPATH, 'Scripts', 'run_qs.py')
    run_qs_bak_path = os.path.join(DAVINCIPATH, 'Scripts', 'run_qs_bak.py')
    #power_pusher_abs_path = os.path.join(DAVINCIPATH, 'Scripts') + '/power_pusher.qs'

    if not common.find_file(run_qs_bak_path):
        common.copy_file(run_qs_path, run_qs_bak_path)
        if common.find_file(run_qs_bak_path):
            common.remove_glob_path(run_qs_path)

    if common.find_file(run_qs_bak_path):
        f_bak = open(run_qs_bak_path, "r+")
        target_file = open(run_qs_path, 'w')
        #pp_qs = "power_pusher.qs" => pp_qs = "ABSOLUTE_PATH/power_pusher.qs"
        g = f_bak.read()
        #g = re.sub(r'pp_qs = "power_pusher.qs"', 'pp_qs = "'+ power_pusher_abs_path +'"', g)
        # RunDavinci(device_name, qs_name) in run_qs.py
        #g = re.sub(r'timeout = 600', 'timeout = ' + davinci_timeout, g)
        #g = re.sub(r'timeout = 1000', 'timeout = ' + davinci_timeout, g)
        # RunTest(is_agressive) in run_qs.py
        g = re.sub(r'rerun_max = 3', 'rerun_max = ' + davinci_rerun_max, g)
        # Add changed = True in CreateNewCfg(camera_mode) in run_qs.py
        #g = re.sub(r'reuse = False', 'reuse = False\n        changed = True', g)
        # Modify threshold value ChooseDevice(dev_list, tar_flag) in run_qa.py
        g = re.sub(r'threshold = 20', 'threshold = ' + davinci_battery_threshold, g)
        # PrepareBeforeSmokeTest(device_name) in run_qs.py
        if davinci_device_environment_set == 'false':
            g = g.replace('PrepareBeforeSmokeTest(all_dev)', '#PrepareBeforeSmokeTest(all_dev)')
        #Strength Restart_adb() in run_qs.py
        g = g.replace('PrintAndLogErr("  - Please make sure adb service is OK.")', 'PrintAndLogErr("  - Please make sure adb service is OK.")\n        Restart_adb()')
        #Disable manual to choose reference devices in run_qs.py
        l('Disable manual to choose reference devices ----- DONE')
        g = re.sub(r'ref_dev_list = raw_input', '#ref_dev_list = raw_input', g)
        g = re.sub(r'if ref_dev_list == "0":', 'ref_dev_list = "0"\n                if ref_dev_list == "0":', g)
        #Disable manual to choose device group in run_qs.py
        l('Disable manual to choose device group ----- DONE')
        g = re.sub(r'selection_choice = raw_input', '#selection_choice = raw_input', g)
        g = re.sub(r'if selection_choice == "":', 'selection_choice = "0"\n            if selection_choice == "":', g)
        target_file.write(g)
        f_bak.close()
        target_file.close()

    if common.find_file(run_qs_path):
        #if common.find_text_in_file('pp_qs = "'+ power_pusher_abs_path +'"', run_qs_path) > 0:
        #    l('Set absolute path of pp_qs: ' + power_pusher_abs_path + ' ----- DONE')
        #if common.find_text_in_file('timeout = ' + davinci_timeout, run_qs_path) > 0:
        #    l('Set davinci_timeout: ' + davinci_timeout + ' ----- DONE')
        if common.find_text_in_file('rerun_max = ' + davinci_rerun_max, run_qs_path) > 0:
            l('Set davinci_rerun_max: ' + davinci_rerun_max + ' ----- DONE')
        if common.find_text_in_file('threshold = ' + davinci_battery_threshold, run_qs_path) > 0:
            l('Set davinci_battery_threshold: ' + davinci_battery_threshold + ' ----- DONE')
        if common.find_text_in_file('ref_dev_list = "0"', run_qs_path) > 0:
            l('Set reference devices: 0 ----- DONE')
        if common.find_text_in_file('selection_choice = "0"', run_qs_path) > 0:
            l('Set device group selection choice: 0 ----- DONE')
Ejemplo n.º 3
0
def prepare_davinci_generate_py_before_2dot3():
    davinci_action_number = common.parse_c_json(JSONPATH, 'davinci_action_number')
    davinci_click_percentage = common.parse_c_json(JSONPATH, 'davinci_click_percentage')
    davinci_swipe_percentage = common.parse_c_json(JSONPATH, 'davinci_swipe_percentage')

    generate_path = os.path.join(DAVINCIPATH, 'Scripts', 'generate.py')
    generate_bak_path = os.path.join(DAVINCIPATH, 'Scripts', 'generate_bak.py')

    if not common.find_file(generate_bak_path):
        common.copy_file(generate_path, generate_bak_path)
        if common.find_file(generate_bak_path):
            common.remove_glob_path(generate_path)

    update_string = 'actionNum='+ davinci_action_number +', clickPro='+ davinci_click_percentage +', swipePro=' + davinci_swipe_percentage

    if common.find_file(generate_bak_path):
        f_bak = open(generate_bak_path, "r+")
        target_file = open(generate_path, 'w')
        # actionNum=10, clickPro=80, swipePro=20 in generate.py
        g = re.sub(r'actionNum=10, clickPro=80, swipePro=20',
                   update_string,
                   f_bak.read())
        target_file.write(g)
        f_bak.close()
        target_file.close()

    if common.find_file(generate_path):
        if common.find_text_in_file(update_string, generate_path) > 0:
            l('Set davinci_action_number: ' + davinci_action_number + ' ----- DONE')
            l('Set davinci_click_percentage: ' + davinci_click_percentage + ' ----- DONE')
            l('Set davinci_swipe_percentage: ' + davinci_swipe_percentage + ' ----- DONE')
Ejemplo n.º 4
0
def download_hekate(module, temp_directory, kosmos_version, kosmos_build):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete_path(bundle_path)
    
    common.copy_module_file('hekate', 'bootlogo.bmp', os.path.join(temp_directory, 'bootloader', 'bootlogo.bmp'))
    common.copy_module_file('hekate', 'hekate_ipl.ini', os.path.join(temp_directory, 'bootloader', 'hekate_ipl.ini'))
    common.sed('KOSMOS_VERSION', kosmos_version, os.path.join(temp_directory, 'bootloader', 'hekate_ipl.ini'))

    payload = common.find_file(os.path.join(temp_directory, 'hekate_ctcaer_*.bin'))
    if len(payload) != 0:
        shutil.copyfile(payload[0], os.path.join(temp_directory, 'bootloader', 'update.bin'))
        common.mkdir(os.path.join(temp_directory, 'atmosphere'))
        shutil.copyfile(payload[0], os.path.join(temp_directory, 'atmosphere', 'reboot_payload.bin'))

    if not kosmos_build:
        common.mkdir(os.path.join(temp_directory, '..', 'must_have'))
        shutil.move(os.path.join(temp_directory, 'bootloader'), os.path.join(temp_directory, '..', 'must_have'))
        shutil.move(os.path.join(temp_directory, 'atmosphere'), os.path.join(temp_directory, '..', 'must_have'))

    return release.tag_name
Ejemplo n.º 5
0
def download_hekate(module, temp_directory):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)

    common.copy_module_file(
        'hekate', 'hekate_ipl.ini',
        temp_directory.joinpath('bootloader/hekate_ipl.ini'))

    payload = common.find_file(temp_directory.joinpath('hekate_ctcaer_*.bin'))
    if len(payload) != 0:
        shutil.copyfile(payload[0],
                        temp_directory.joinpath('bootloader/update.bin'))
        common.mkdir(temp_directory.joinpath('atmosphere'))
        shutil.copyfile(
            payload[0],
            temp_directory.joinpath('atmosphere/reboot_payload.bin'))

        common.mkdir(temp_directory.joinpath('../hekate'))
        common.move(
            payload[0],
            temp_directory.joinpath('../hekate/',
                                    Path(payload[0]).name))

    common.delete(
        temp_directory.joinpath(
            'nyx_usb_max_rate (run once per windows pc).reg'))

    return release.tag_name
Ejemplo n.º 6
0
def prepare_davinci_delete_default_device_cfg_txt():
    delete_default_device_cfg_txt_path = os.path.join(DAVINCIPATH, 'Scripts', 'default_device_cfg.txt')
    if common.find_file(delete_default_device_cfg_txt_path):
        common.del_file(delete_default_device_cfg_txt_path)
        l('Delete default_device_cfg.txt: ----- DONE')
    else:
        l('default_device_cfg.txt doesn\'t exist ----- OK')
Ejemplo n.º 7
0
def main():
    parser = argparse.ArgumentParser(description="Analyze the log.lammps")
    parser.add_argument('-l','--logfile', help="input lammps logfile ")
    parser.add_argument('-k','--kw', default="Temp", help="keyword to analyze")
    args = parser.parse_args()

    pwd = os.getcwd()
    if args.logfile == None:
        fname = find_file(pwd, 'log')
        print(f"read {fname}")
    else:
        fname = args.logfile

    analyze_kw(fname, args.kw)
Ejemplo n.º 8
0
def download_hekate(module, temp_directory, deepsea_version, parameters,
                    deepsea_build):
    release = get_latest_release(module)
    bundle_path = download_asset(module, release, 0)
    if bundle_path is None:
        return None

    with zipfile.ZipFile(bundle_path, 'r') as zip_ref:
        zip_ref.extractall(temp_directory)

    common.delete(bundle_path)

    common.copy_module_file('hekate', 'bootlogo.bmp',
                            temp_directory.joinpath('bootloader/bootlogo.bmp'))
    common.copy_module_file(
        'hekate', 'hekate_ipl.ini',
        temp_directory.joinpath('bootloader/hekate_ipl.ini'))
    common.sed('DEEPSEA_VERSION', deepsea_version,
               temp_directory.joinpath('bootloader/hekate_ipl.ini'))

    payload = common.find_file(temp_directory.joinpath('hekate_ctcaer_*.bin'))
    if len(payload) != 0:
        shutil.copyfile(payload[0],
                        temp_directory.joinpath('bootloader/update.bin'))
        common.mkdir(temp_directory.joinpath('atmosphere'))
        shutil.copyfile(
            payload[0],
            temp_directory.joinpath('atmosphere/reboot_payload.bin'))

    common.delete(
        temp_directory.joinpath(
            'nyx_usb_max_rate (run once per windows pc).reg'))

    if not deepsea_build:
        common.mkdir(temp_directory.joinpath('../must_have'))
        common.move(temp_directory.joinpath('bootloader'),
                    temp_directory.joinpath('../must_have/bootloader'))
        common.move(
            temp_directory.joinpath('atmosphere/reboot_payload.bin'),
            temp_directory.joinpath(
                '../must_have/atmosphere/reboot_payload.bin'))
        common.delete(temp_directory.joinpath('atmosphere'))

    return get_version(module, release, 0)
Ejemplo n.º 9
0
def csv_reader(version, deviceid, arch, filepath, exetime):
    if common.find_file(filepath):
        p = os.path.join(TESTPATH, deviceid)
        common.mk_dir(p)
        p = os.path.join(TESTPATH, deviceid, exetime)
        common.mk_dir(p)

        q = os.path.join(p, common.parse_c_json(JSONPATH, 'test_result_xml_name'))

        generate_xml_report(version, deviceid, arch, q)

        dreader = csv.DictReader(open(filepath))
        #print len(list(dreader))

        for c in dreader:
            reportlink = str(c['Link']).replace('=HYPERLINK("','').replace('")','').replace('\\\\','\\')
            #testtime = c['TestTime']
            testtime = ''
            l(c['Install'] + ' ' + c['Launch'] + ' ' + c['Random'] + ' ' + c['Back']
              + ' ' + c['Uninstall'] + ' ' + c['Logcat'] + ' ' + c['Result'] + ' ' + c['Reason'].strip())

            devicemode = ''
            try:
                devicemode = c['Device Model']
            except Exception, ex:
                lr(str(ex))

            application = ''
            try:
                application = c['Application'].decode('utf-8').replace('.apk','')
            except Exception, ex:
                application = c['\xef\xbb\xbfApplication'].decode('utf-8').replace('.apk','')
            applicationname = ''
            try:
                applicationname = c['App name'].decode('utf-8')
            except Exception, ex:
                lr(str(ex))
Ejemplo n.º 10
0
    def __init__(self, options_screen):

        self.globalvars = options_screen.globalvars
        self.language = options_screen.language

        self.vbox = gtk.VBox(False, constants.vpad)

        default_language_frame = gtk.Frame(i18n.get_text(
            self.language, 250))  # language at startup

        vbox = gtk.VBox()

        self.default_language_system_button = gtk.RadioButton(
            None, i18n.get_text(self.language, 251))  # system value

        self.default_language_system_button.connect(
            "toggled", self.toggle_default_language_mode, "system")

        vbox.pack_start(self.default_language_system_button, False)

        hbox = gtk.HBox(False, constants.hpad)

        self.default_language_user_button = gtk.RadioButton(
            self.default_language_system_button,
            i18n.get_text(self.language, 252))  # user value :
        hbox.pack_start(self.default_language_user_button, False)

        self.default_language_user_button.connect(
            "toggled", self.toggle_default_language_mode, "user")

        self.language_combo = gtk.combo_box_new_text()

        self.language_combo.connect("changed",
                                    self.change_user_default_language)

        i = 0

        for language in self.globalvars.active_languages:
            # TODO use editor language !!
            self.language_combo.append_text(i18n.get_text(language, language))

            if (cmp(language, self.globalvars.main_language) == 0):
                self.language_combo.set_active(i)

            i = i + 1

        hbox.pack_start(self.language_combo, False)

        vbox.pack_start(hbox, False)

        if (cmp(self.globalvars.main_language_mode, "user") == 0):
            self.default_language_user_button.set_active(True)

        else:
            self.language_combo.set_sensitive(False)

        default_language_frame.add(vbox)

        self.vbox.pack_start(default_language_frame)

        hbox = gtk.HBox(False, constants.hpad)

        UN_image = gtk.Image()
        UN_image.set_from_file(
            common.find_file(constants.UN_image_filename, self.globalvars))

        hbox.pack_start(UN_image, True, True, constants.hpad)

        label = gtk.Label(i18n.get_text(self.language, 253))
        hbox.pack_start(label, True, True, constants.hpad)

        UN_image.show()
        label.show()

        hbox.show()

        options_screen.notebook.append_page(self.vbox, hbox)
Ejemplo n.º 11
0
def prepare_davinci_silent_mode():
    if common.find_file(os.path.join(DAVINCIPATH, 'Scripts', 'user_input1.txt')):
        common.copy_file(os.path.join(DAVINCIPATH, 'Scripts', 'user_input1.txt'), os.path.join(SUITEPATH, 'user_input1.txt'))
    if common.find_file(os.path.join(DAVINCIPATH, 'Scripts', 'user_input2.txt')):
        common.copy_file(os.path.join(DAVINCIPATH, 'Scripts', 'user_input2.txt'), os.path.join(SUITEPATH, 'user_input2.txt'))
    l('Prepare DaVinci silent mode test ----- DONE')
Ejemplo n.º 12
0
    help=
    'Specify what kind of model was trained. It could be (COCO, MPI) depends on the dataset.'
)
PARSER.add_argument('--thr',
                    default=0.1,
                    type=float,
                    help='Threshold value for pose parts heat map')

ARGS = PARSER.parse_args()

if ARGS.dataset == 'COCO':
    DATASET_INFO = (coco.BODY_PARTS, coco.POSE_PAIRS, coco.PAIR_COLORS)
else:
    DATASET_INFO = (mpi.BODY_PARTS, mpi.POSE_PAIRS, mpi.PAIR_COLORS)

NETWORK = cv.dnn.readNetFromCaffe(common.find_file(ARGS.proto),
                                  common.find_file(ARGS.model))

APP = Flask(__name__)


@APP.route('/api/compare', methods=['POST'])
def run_comparison():
    data = request.get_json()

    if data is None:
        return jsonify({'error': 'No valid request body, json missing!'})
    else:

        frame = base64_to_image(data['frame'])
        template = base64_to_image(data['template'])
Ejemplo n.º 13
0
def prepare_davinci_generate_py():
    rtlibpkg = common.parse_c_json(JSONPATH, 'runtimelib_package')
    rtlibapk = common.parse_c_json(JSONPATH, 'runtimelib_apk')
    davinci_action_number = common.parse_c_json(JSONPATH, 'davinci_action_number')
    davinci_click_percentage = common.parse_c_json(JSONPATH, 'davinci_click_percentage')
    davinci_swipe_percentage = common.parse_c_json(JSONPATH, 'davinci_swipe_percentage')

    generate_path = os.path.join(DAVINCIPATH, 'Scripts', 'generate.py')
    generate_bak_path = os.path.join(DAVINCIPATH, 'Scripts', 'generate_bak.py')

    if not common.find_file(generate_bak_path):
        common.copy_file(generate_path, generate_bak_path)
        if common.find_file(generate_bak_path):
            common.remove_glob_path(generate_path)

    if common.find_file(generate_bak_path):
        f_bak = open(generate_bak_path, "r+")
        target_file = open(generate_path, 'w')
        g = f_bak.read()
        #Disable manual to confirm settings in SmokeConfig.csv in generate.py
        l('Disable manual to confirm settings in SmokeConfig.csv ----- DONE')
        g = re.sub(r'config_done = raw_input', '#config_done = raw_input', g)
        target_file.write(g)
        f_bak.close()
        target_file.close()

    smokeconfig_path = os.path.join(DAVINCIPATH, 'Scripts', 'SmokeConfig.csv')
    smokeconfig_bak_path = os.path.join(DAVINCIPATH, 'Scripts', 'SmokeConfig_bak.csv')

    if not common.find_file(smokeconfig_bak_path):
        common.copy_file(smokeconfig_path, smokeconfig_bak_path)
        if common.find_file(smokeconfig_bak_path):
            common.remove_glob_path(smokeconfig_path)

    lists = []
    with open(smokeconfig_bak_path, 'rb') as csvfile:
        reader = csv.reader(csvfile, delimiter=';',  quotechar = '|')
        for row in reader:
            lists.append(row)

    with open(smokeconfig_path, 'wb') as csvfile:
        writer = csv.writer(csvfile, delimiter = ';', quotechar = '|',  quoting=csv.QUOTE_MINIMAL)
        for row in lists:
            t = 'Total Action Number (click action number + swipe action number):,'
            if str(row[0]).find(t) >= 0:
                row[0] = row[0].replace('10','')
                row[0] = row[0].replace(t, t + davinci_action_number)
            t = 'Click Percentage (click action number / total action number) (%):,'
            if str(row[0]).find(t) >= 0:
                row[0] = row[0].replace('80','')
                row[0] = row[0].replace(t, t + davinci_click_percentage)
            t = 'Swipe Percentage (swipe action number / total action number) (%):,'
            if str(row[0]).find(t) >= 0:
                row[0] = row[0].replace('20','')
                row[0] = row[0].replace(t, t + davinci_swipe_percentage)
            t = 'Camera Mode (ScreenCap or Disabled):,ScreenCap'
            if str(row[0]).find(t) >= 0:
                row[0] = row[0].replace(',ScreenCap',',Disabled')
            t = 'Test login feature or not (Yes/No):,Yes'
            if str(row[0]).find(t) >= 0:
                row[0] = row[0].replace('Test login feature or not (Yes/No):,Yes','Test login feature or not (Yes/No):,No')
            if str(row[0]).find('with semicolons):,') >= 0:
                row[0] = row[0].replace('with semicolons):,', 'with semicolons):,' + rtlibpkg)
            writer.writerow(row)

    l('Set davinci_action_number: ' + davinci_action_number + ' ----- DONE')
    l('Set davinci_click_percentage: ' + davinci_click_percentage + ' ----- DONE')
    l('Set davinci_swipe_percentage: ' + davinci_swipe_percentage + ' ----- DONE')
    l('Disabled Screen Capture: ----- DONE')
    l('Disabled login feature: ----- DONE')
    l('Set package name of '+ rtlibapk + ': ' + rtlibpkg + ' for logcat capturing ----- DONE')
Ejemplo n.º 14
0
	def __init__(self, options_screen) :

		self.globalvars = options_screen.globalvars
		self.language = options_screen.language

		self.vbox = gtk.VBox(False, constants.vpad)


		default_language_frame = gtk.Frame(i18n.get_text(self.language, 250))  # language at startup


		vbox = gtk.VBox()

		self.default_language_system_button = gtk.RadioButton(None, i18n.get_text(self.language, 251)) # system value

		self.default_language_system_button.connect("toggled", self.toggle_default_language_mode, "system")

		vbox.pack_start(self.default_language_system_button, False)

		
		hbox = gtk.HBox(False, constants.hpad)

		self.default_language_user_button = gtk.RadioButton(self.default_language_system_button, i18n.get_text(self.language, 252)) # user value :
		hbox.pack_start(self.default_language_user_button, False)

		self.default_language_user_button.connect("toggled", self.toggle_default_language_mode, "user")

		self.language_combo = gtk.combo_box_new_text()
		
		self.language_combo.connect("changed", self.change_user_default_language)




		i = 0

		for language in self.globalvars.active_languages :
			# TODO use editor language !!
			self.language_combo.append_text(i18n.get_text(language, language))

			if (cmp(language, self.globalvars.main_language) == 0) :
				self.language_combo.set_active(i)

			i = i + 1

		hbox.pack_start(self.language_combo, False)


		vbox.pack_start(hbox, False)

		if (cmp(self.globalvars.main_language_mode, "user") == 0) :
			self.default_language_user_button.set_active(True)

		else :
			self.language_combo.set_sensitive(False)


		default_language_frame.add(vbox)


		self.vbox.pack_start(default_language_frame)


		hbox = gtk.HBox(False, constants.hpad)

		UN_image = gtk.Image()
		UN_image.set_from_file(common.find_file(constants.UN_image_filename, self.globalvars))

		hbox.pack_start(UN_image, True, True, constants.hpad)

		label = gtk.Label(i18n.get_text(self.language, 253))
		hbox.pack_start(label, True, True, constants.hpad)

		UN_image.show()
		label.show()

		hbox.show()

		options_screen.notebook.append_page(self.vbox, hbox)		
Ejemplo n.º 15
0
Frontend tests for OpenMP examples, designed to stress the parsing and
transformation features of chimes.
"""
import os
import sys
from common import run_frontend_test, parse_argv, \
                   CHIMES_HOME, construct_simple_frontend_test, find_file, \
                   get_platform_directory, FrontendTest, is_rodinia_supported, is_spec_supported

CPP_EXAMPLES_DIR = CHIMES_HOME + '/src/examples/cpp'
OMP_EXAMPLES_DIR = CHIMES_HOME + '/src/examples/openmp'
COMPILE_SCRIPT = CHIMES_HOME + '/src/preprocessing/compile_cpp.sh'
OMP_EXAMPLES_DIR = CHIMES_HOME + '/src/examples/openmp'
OMP_TEST_DIR = CHIMES_HOME + '/src/tests/frontend/' + \
               get_platform_directory() + '/openmp'
OMP_H = find_file('omp.h', '/usr/')

SIMPLE_TESTS = ['basic_parallel.cpp', 'nested_parallel.cpp', 'for_parallel.cpp',
                'critical.cpp', 'barrier.cpp']
COMD_OMP = FrontendTest('CoMD-OMP',
                    ['src-openmp/CoMD.c', 'src-openmp/decomposition.c',
                     'src-openmp/haloExchange.c', 'src-openmp/linkCells.c',
                     'src-openmp/mycommand.c',
                     'src-openmp/performanceTimers.c',
                     'src-openmp/timestep.c', 'src-openmp/cmdLineParser.c',
                     'src-openmp/eam.c', 'src-openmp/initAtoms.c',
                     'src-openmp/ljForce.c', 'src-openmp/parallel.c',
                     'src-openmp/random.c', 'src-openmp/yamlOutput.c'],
                    'CoMD-openmp', False, src_folder='CoMD',
                    includes=[os.path.dirname(OMP_H)])
LULESH_OMP = FrontendTest('Lulesh-OMP', ['lulesh/LULESH_OMP.cc'],
Ejemplo n.º 16
0
"""
Runtime tests for OMP examples, designed to stress the checkpointing and restore
functionality of the chimes runtime.
"""
import os
import sys
from common import RuntimeTest, parse_argv, CHIMES_HOME, run_runtime_test, \
         find_file, is_rodinia_supported, is_spec_supported
from shared_tests import MISC_OMP_RUNTIME_TESTS

OMP_H = find_file('omp.h', '/usr/')
CPP_EXAMPLES_DIR = CHIMES_HOME + '/src/examples/cpp'

BASIC_PARALLEL = RuntimeTest('BasicParallel', ['basic_parallel.cpp'],
                             0,
                             1,
                             includes=[os.path.dirname(OMP_H)])
# Assertion should fail
FAIL_CHECKPOINT_IN_FOR = RuntimeTest('FailCheckpointInFor',
                                     ['fail_checkpoint_in_for.cpp'],
                                     -6,
                                     0,
                                     includes=[os.path.dirname(OMP_H)])
PARALLEL_FOR_PIPELINE = RuntimeTest('ParallelForPipeline',
                                    ['parallel_for_pipeline.cpp'],
                                    0,
                                    1,
                                    includes=[os.path.dirname(OMP_H)])
RAY_TRACER_ARGS='-x 128 -y 128 -s 512,512,100,100,0.5,0.5,0.5 ' + \
                '-s 0,0,100,100,0.5,0.5,0.5 -t 10'
RAY_TRACER_OMP = RuntimeTest('RayTracer-OMP', ['ray_tracer.c'],
Ejemplo n.º 17
0
def main():

    parser = argparse.ArgumentParser()

    parser.add_argument('--template', help='Path to the goal pose image.')
    parser.add_argument('--frame', help='Path to the input image.')
    parser.add_argument('--proto', help='Path to the .prototxt file')
    parser.add_argument('--model', help='Path to the .caffemodel file')
    parser.add_argument(
        '--dataset',
        choices=['COCO', 'MPI'],
        help=
        'Specify what kind of model was trained. It could be (COCO, MPI) depends on the dataset.'
    )
    parser.add_argument('--thr',
                        default=0.1,
                        type=float,
                        help='Threshold value for pose parts heat map')

    args = parser.parse_args()

    frame = cv2.imread(args.frame)
    template = cv2.imread(args.template)

    if args.dataset == 'COCO':
        body_parts, pose_pairs, pair_colors = dataset_info = (coco.BODY_PARTS,
                                                              coco.POSE_PAIRS,
                                                              coco.PAIR_COLORS)
    else:
        body_parts, pose_pairs, pair_colors = dataset_info = (mpi.BODY_PARTS,
                                                              mpi.POSE_PAIRS,
                                                              mpi.PAIR_COLORS)

    network = cv2.dnn.readNetFromCaffe(common.find_file(args.proto),
                                       common.find_file(args.model))

    frame_points, frame_vectors = get_pose_data(frame, args.thr, network,
                                                dataset_info)
    template_points, template_vectors = get_pose_data(template, args.thr,
                                                      network, dataset_info)

    comparison_result = compare(frame_vectors, template_vectors)

    print("   Frame Points: \n{}".format(frame_points))
    print("Template Points: \n{}".format(template_points))

    print("   Frame Vectors: \n{}".format(frame_vectors))
    print("Template Vectors: \n{}".format(template_vectors))

    print("Comparison Result: {}".format([
        (r, p) for r, p in zip(comparison_result, pose_pairs)
    ]))

    print("  Color Reference: {}".format([
        (p, c) for p, c in zip(pose_pairs, pair_colors)
    ]))

    common.draw_vectors(frame_points, pose_pairs, body_parts, pair_colors,
                        frame)
    common.draw_vectors(template_points, pose_pairs, body_parts, pair_colors,
                        template)

    cv2.imshow('Frame', frame)
    cv2.imshow('Template', template)

    cv2.waitKey()