Exemplo n.º 1
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)
    #print ('app_data', app_data)
    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7, 10, 15]:
            create_lib(build_nlmeans, app, app_data, g_size)
            for t in range(0, 5):
                print("Running for iteration #", t)
                nlmeans(app_data)
    elif app_data['mode'] == 'tune':
        auto_tune(pipe_data, app_data)
        pass
    else:
        create_lib(build_nlmeans, app, app_data)
        for i in range(0, 5):
            nlmeans(app_data)

    return
Exemplo n.º 2
0
def main():
    print_header()

    print("[main]: initializing...")
    print("")

    app_data = {}

    app_data['app'] = app
    app_data['app_name'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)
    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_unsharp, app, app_data, g_size,
                               [1, t1, t2])
                    for t in range(0, 0):
                        print("Running for iteration #", t)

    elif app_data['mode'] == 'tune':
        print("Tuning")
        auto_tune(app_data)
    else:
        create_lib(build_unsharp, app, app_data)
        min_avg = 100000
        for i in range(0, 10000000):
            min_avg = min(min_avg, unsharp_mask(app_data))

        print("minimum average ", min_avg)

    return
Exemplo n.º 3
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)
    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_pyramid, app, app_data, g_size, [t1, t2])
                    for t in range (0, 0):
                        print ("Running for iteration #", t)
                        pyramid_blending(app_data)
    elif app_data['mode'] == 'tune' or app_data['mode'] == 'tune_execute':
        auto_tune(app_data)
        pass
    else:
        create_lib(build_pyramid, app, app_data)
        min_avg = 100000
        for r in range (0,5):
            min_avg = min (min_avg, pyramid_blending(app_data))
        print ("Minimum Average Time ", min_avg)

    return
Exemplo n.º 4
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_harris, app, app_data, g_size, [t1, t2])
                    for t in range(0, 0):
                        print("Running for iteration #", t)
                        harrispipe(app_data)
    elif app_data['mode'] == 'tune':
        print("Tuning")
        auto_tune(app_data)
    else:
        create_lib(build_harris, app, app_data)
        _m = 10000000
        nsamples = 5
        for i in range(0, nsamples):
            _m = min(_m, harrispipe(app_data))
        print("[main] Minimum of averaged times across ", nsamples,
              "samples: ", _m, " ms")
    return
Exemplo n.º 5
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7, 9, 11, 200]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_interpolate, app, app_data, g_size,
                               [1, t1, t2])
                    for t in range(0, 0):
                        print("Running for iteration #", t)
                        interpolate(app_data)
    elif app_data['mode'] == 'tune':
        pass
    else:
        create_lib(build_interpolate, app, app_data)
        _min_time = 10000
        for t in range(0, 5):
            _min_time = min(_min_time, interpolate(app_data))
        print("Minimum Time = ", _min_time)

    return
Exemplo n.º 6
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_harris, app, app_data, g_size, [t1, t2])
                    for t in range (0, 0):
                        print ("Running for iteration #", t)
                        harrispipe(app_data)
    elif app_data['mode'] == 'tune':
        pass
    else:
        create_lib(build_harris, app, app_data)
        _m = 10000000
        for i in range (0,5):
            _m = min (_m, harrispipe(app_data))
        print ("min time is ", _m)
    return
Exemplo n.º 7
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_campipe, app, app_data, g_size, [t1, t2])
                    for t in range (0, 0):
                        print ("Running for iteration #", t)
                        campipe(app_data)
    elif app_data['mode'] == 'tune':
        auto_tune(app_data)
    else:
        # create shared lib
        create_lib(build_campipe, app, app_data)
        min_avg = 100000
        for t in range (0, 5):
            # execute the compiled pipeline
            min_avg = min (min_avg, campipe(app_data))
        
        print ("Minimum Average ", min_avg)

    return
Exemplo n.º 8
0
def main():
    print_header()

    app_data = {}
    app_data['ROOT'] = ROOT

    # init all the required data
    init_all(app_data)

    print_config(app_data)

    app_name = "nas_mg_class_"+app_data['prob_class']
    app_data['app'] = app_name
    if app_data['mode'] == 'tune':
        #app_tune(app_data)
        pass
    else:
        #-------------------------------------------------------------------
        # setting up residual norm computation
        create_lib(None, "norm", app_data)
        # setting up multigrid v-cycle computation
        create_lib(build_mg3p, app_name, app_data)
        # setting up standalone version of residual computation
        create_lib(build_resid, "resid", app_data)
        #-------------------------------------------------------------------
        init_norm(app_data)
        multigrid(app_data)
        verify_norm(app_data)
        #-------------------------------------------------------------------

    return
Exemplo n.º 9
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7, 9, 11, 200]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_interpolate, app, app_data, g_size,
                               [1, t1, t2])
                    for t in range(0, 0):
                        print("Running for iteration #", t)
                        interpolate(app_data)
    elif app_data['mode'] == 'tune':
        print("Tuning")
        auto_tune(app_data)
    else:
        create_lib(build_interpolate, app, app_data)
        min_avg = 10000
        nsamples = 5
        print("[main] Benchmarking (%d samples)" % nsamples)
        for t in range(0, nsamples):
            min_avg = min(min_avg, interpolate(app_data))

        print("[main] Minimum of averaged times across ", nsamples, "runs: ",
              min_avg, " ms")

    return
Exemplo n.º 10
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_campipe, app, app_data, g_size, [t1, t2])
                    for t in range(0, 0):
                        print("Running for iteration #", t)
                        campipe(app_data)
    elif app_data['mode'] == 'tune':
        auto_tune(app_data)
    else:
        # create shared lib
        create_lib(build_campipe, app, app_data)
        min_avg = 100000
        nsamples = 5
        print("[main] Benchmarking (%d samples)" % nsamples)
        for t in range(0, nsamples):
            # execute the compiled pipeline
            min_avg = min(min_avg, campipe(app_data))

        print("[main] Minimum of averaged times across ", nsamples,
              "samples: ", min_avg, " ms")

    return
Exemplo n.º 11
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_bilateral, app, app_data, g_size,
                               [1, t1, t2])
                    for t in range(0, 0):
                        print("Running for iteration #", t)
                        bilateralgrid(app_data)
    elif app_data['mode'] == 'tune':
        print("Tuning")
        auto_tune(app_data)
    else:
        create_lib(build_bilateral, app, app_data)
        min_avg = 10000
        # input ("wait to run amplxe " + str(os.getpid()))
        # input ("wwww")
        nsamples = 5
        print("[main] Benchmarking (%d samples)" % nsamples)
        for t in range(0, nsamples):
            min_avg = min(min_avg, bilateralgrid(app_data))
        print("[main] Minimum of averaged times across ", nsamples,
              "samples: ", min_avg, " ms")

    return
Exemplo n.º 12
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune+':
        for g_size in [3, 5, 7]:
            for t1 in [8, 16, 32, 64, 128, 256]:
                for t2 in [8, 16, 32, 64, 128, 256]:
                    create_lib(build_bilateral, app, app_data, g_size, [1, t1, t2])
                    for t in range (0, 0):
                        print ("Running for iteration #", t)
                        bilateralgrid(app_data)
    elif app_data['mode'] == 'tune':
        pass
    else:
        create_lib(build_bilateral, app, app_data)
        _min_time = 10000
        input ("wait to run amplxe " + str(os.getpid()))
        input ("wwww")
        for t in range(0, 5):
            _min_time = min (_min_time, bilateralgrid(app_data))
        print ("Minimum Time = ", _min_time)

    return
Exemplo n.º 13
0
def create_app():
    app = make_json_app(__name__)
    # setup cross domain
    setup_cross_domain(app)

    # app basic configuration
    app.config.from_object('config.base')

    # init application
    init.init_all(app)

    # apply router
    router_index.apply(app)

    return app
Exemplo n.º 14
0
def create_app():
    app = make_json_app(__name__)
    # setup cross domain
    setup_cross_domain(app)

    # app basic configuration
    app.config.from_object("config.base")

    # init application
    init.init_all(app)

    # apply router
    router_index.apply(app)

    return app
Exemplo n.º 15
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)
    if app_data['mode'] == 'tune' or app_data['mode'] == 'tune_execute':
        auto_tune(app_data)
        pass
    else:
        create_lib(build_pyramid, app, app_data)
        pyramid_blending(app_data)

    return
Exemplo n.º 16
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune':
        auto_tune(app_data)
    else:
        create_lib(build_harris, app, app_data)
        harrispipe(app_data)

    return
Exemplo n.º 17
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune':
        auto_tune(app_data)
    else:
        create_lib(build_harris, app, app_data)
        harrispipe(app_data)

    return
Exemplo n.º 18
0
def main():
    try:
        try:
            intent = sys.argv[1]
        except:
            print("Please provide correct no of arguments")
        init.init_all()
        if intent=='scrap':
            scraper.scrap_gags()
        else:
            try:
                object_count = int(sys.argv[2])
                Gag.get_gags(sys.argv[1], object_count)
            except:
                print("Count of object should be integer")
    except:
      print("An error has occured")
Exemplo n.º 19
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune':
        #auto_tune(pipe_data,app_data)
        pass
    else:
        create_lib(build_bilateral, app, app_data)
        bilateralgrid(app_data)

    return
Exemplo n.º 20
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune':
        #auto_tune(pipe_data,app_data)
        pass
    else:
        create_lib(build_maxfilter, app, app_data)
        maxfilter(app_data)

    return
Exemplo n.º 21
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune':
        print("Tuning...")
        #auto_tune(app_data)
    else:
        create_lib(build_laplacian, app, app_data)
        for i in range(0, 5):
            laplacian(app_data)

    return
Exemplo n.º 22
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune':
        auto_tune(app_data)
    else:
        # create shared lib
        create_lib(build_campipe, app, app_data)
        # execute the compiled pipeline
        campipe(app_data)

    return
Exemplo n.º 23
0
def main():
    print_header()
    
    print("[main]: initializing...")
    print("")

    app_data = {}

    app_data['app'] = app
    app_data['app_name'] = app
    app_data['ROOT'] = ROOT

    init_all(app_data)
    print_config(app_data)
    if app_data['mode'] == 'tune':
        print("Tuning")
        auto_tune(app_data)
    else:
        create_lib(build_unsharp, app, app_data)
        unsharp_mask(app_data)

    return
Exemplo n.º 24
0
def main():
    print_header()

    print("[main]: initializing...")
    print("")

    app_data = {}

    app_data['app'] = app
    app_data['app_name'] = app
    app_data['ROOT'] = ROOT

    g_sizes = [3, 5, 7]
    tile_sizes = [8, 16, 32, 64]  #, 128, 256]

    init_all(app_data)
    print_config(app_data)
    if app_data['mode'] == 'tune+':
        for g_size in g_sizes:
            for t1 in tile_sizes:
                for t2 in tile_sizes:
                    create_lib(build_mfd, app, app_data, g_size, [1, t1, t2])
                    for t in range(0, 0):
                        print("Running for iteration #", t)

    elif app_data['mode'] == 'tune':
        print("Tuning")
        auto_tune(app_data)
    else:
        create_lib(build_mfd, app, app_data)
        min_avg = 100000
        nsamples = 5
        for i in range(0, nsamples):
            min_avg = min(min_avg, minifluxdiv(app_data))
        print("[main] Minimum of averaged times across ", nsamples,
              "samples: ", min_avg, " ms")

    return
Exemplo n.º 25
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    # init all the required data
    init_all(app_data)

    print_config(app_data)
    if app_data['mode'] == 'tune':
        auto_tune(app_data)
    else:
        #-------------------------------------------------------------------
        create_lib(None, "norm", app_data)
        create_lib(build_mg_cycle, app_data['cycle_name'], app_data)
        #-------------------------------------------------------------------
        init_norm(app_data)
        multigrid(app_data)
        #-------------------------------------------------------------------

    return
Exemplo n.º 26
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    # init all the required data
    init_all(app_data)

    print_config(app_data)
    if app_data['mode'] == 'tune':
        auto_tune(app_data)
    else:
        #-------------------------------------------------------------------
        create_lib(None, "norm", app_data)
        create_lib(build_mg_cycle, app_data['cycle_name'], app_data)
        #-------------------------------------------------------------------
        init_norm(app_data)
        multigrid(app_data)
        #-------------------------------------------------------------------

    return
Exemplo n.º 27
0
def main():
    print_header()

    app_data = {}
    app_data['app'] = app
    app_data['ROOT'] = ROOT

    # init all the required data
    init_all(app_data)
    print_config(app_data)

    if app_data['mode'] == 'tune':
        print("Tuning...")
        auto_tune(app_data)
    else:
        #-------------------------------------------------------------------
        create_lib(None, "norm", app_data)
        create_lib(build_jacobi, app, app_data)
        #-------------------------------------------------------------------
        init_norm(app_data)
        exec_jacobi(app_data)
        #-------------------------------------------------------------------

    return
Exemplo n.º 28
0
from flask import Flask, session, request, render_template, redirect
import time
import order_def
import holding_def
import init
import math
import func_def
myWeb = Flask(__name__)

trade_board_length = 60  # 交易面板容纳的最大订单数量
price_queue_length = 4  # 价格队列的长度
order_limit = 6  # 单个用户订单上限
# 运行中
admin_pwd, user_pwd, buy_order, sell_order, user_holding, price_order, market_price, order_cnt = init.init_all(
)


# 主页
@myWeb.route("/")
def root():
    return render_template("index.html", MSG="请登录")


# 用户登陆,成功则返回main_page.html,否则返回index.html
@myWeb.route("/login", methods=["post", "get"])
def login():
    # print(request.method, type(request.method))
    if request.method == "GET":
        return render_template("index.html", MSG="请登录")

    username = request.form['username']
Exemplo n.º 29
0
@app.route('/qrcode.jpg')
def qr_jpg():
    key = get_qr_key()
    f = BytesIO()
    img = qrcode.make(request.url_root + 'control/?key=' + key)
    img = img.convert('RGB').resize((240, 240))
    img.save(f, format='jpeg')
    f.seek(0)
    return send_file(f, mimetype='image/jpeg')


if __name__ == '__main__':
    print('Starting...')
    plant = session.query(Plant).first()
    if not plant:
        init_all(session)
        plant = session.query(Plant).first()
    sched = Scheduler()
    sched.start()
    sched.add_cron_job(fetch_and_save_data,
                       minute="*/{}".format(FETCH_DATA_INTERVAL),
                       args=[session, plant])
    sched.add_cron_job(fetch_and_save_image,
                       minute="*/{}".format(FETCH_IMAGE_INTERVAL),
                       args=[session, plant])
    if MODE != 'demo':
        sched.add_cron_job(trigger_led,
                           minute="*/{}".format(TRIGGER_INTERVAL),
                           args=[plant])
        sched.add_cron_job(trigger_pump,
                           minute="*/{}".format(TRIGGER_INTERVAL),
Exemplo n.º 30
0
        port2 = "4725"
        case_common.setappiumimput(deviceid1)
        case_common.setappiumimput(deviceid2)

        case_common.clearAppdata(deviceid1)
        case_common.clearAppdata(deviceid2)
        driver1 = startDemo(deviceid1, device_list[1], port1)
        driver2 = startDemo(deviceid2, device_list[3], port2)
        test_login(driver1, username="******", password="******")
        test_login(driver2, username="******", password="******")
        case_common.change_appkeyandserver(driver1, appkey, resturl, imserver,
                                           test_env, test_type)
        case_common.change_appkeyandserver(driver2, appkey, resturl, imserver,
                                           test_env, test_type)

        init.init_all()

        driver1 = startDemo(deviceid1, device_list[1], port1)
        driver2 = startDemo(deviceid2, device_list[3], port2)

        testset_account(driver1)

        test_login(driver1, username=accountA, password="******")
        test_login(driver2, username=accountB, password="******")
        del_conversation(driver1)
        del_conversation(driver2)

        testset_call(driver1, driver2, userA=accountA, userB=accountB)

        testset_single_chat(driver1,
                            driver2,