예제 #1
0
    def __init__(self, time_sql, mysql_w, model="", batch_size=1, gpu_card="p4"):
        """
        init
        """
        try:
            cf = ConfigParser.ConfigParser()
            #cf.read("./conf/load_config.conf")
            cf.read("../conf/load_config.conf")
            conf_name = "conf_%s" % model
            try:
                self.gpu_card = gpu_card
                self.time_pk_path = cf.get(conf_name, "time_pk_path")
            except Exception as e:
                print ("\033[0;31;m[error]: Pls Check The Modle input wrong!\033[0m")
                sys.exit(1)
            
            # init mysql
            self.mysql = LoadCommon(model, batch_size, self.gpu_card)

            # init the initing time
            # the qps table has the same primary key: time
            self.time_sql = time_sql

            # init env: truncate table top_list_1sec 
            self.mysql.create_table_sql_anakin2_yolo_qps()
            self.mysql.create_table_sql_tensorrt_qps()
            self.db_onoff = mysql_w
        except Exception as exception:
            print exception
            return
예제 #2
0
    def __init__(self, mysql_w, model="", batch_size=1):
        """
        init
        """
        try:
            #TODO
            self.multithread_pk_file = "/home/qa_work/CI/workspace/sys_anakin_compare_output/%s/multithread_time/Multi_thread_time.txt" % model
            
            if os.path.exists(self.multithread_pk_file):
                self.file = open(self.multithread_pk_file)
            else:
                print "[error]: the %s does not exist" % self.multithread_pk_file
                sys.exit(1)

            # top's list
            self.batch_size = []
            self.thread_num = []
            self.qps = []

            # init mysql
            self.mysql = LoadCommon(model, batch_size)

            # init the initing time
            # the qps table has the same primary key: time
            time_now = int(time.time())
            time_local = time.localtime(time_now)
            self.time_sql = time.strftime("%Y-%m-%d %H:%M:%S",time_local)

            self.mysql.create_table_sql_multithread_qps()
            self.db_onoff = mysql_w
            if self.db_onoff == "on":
                self.mysql.truncate_table_sql("multithread_qps")
        except Exception as exception:
            print exception
            return
예제 #3
0
 def __init__(self, db_name, model, batch_size):
     """
     init
     """
     # init mysql
     self.mysql = LoadCommon(db_name)
     self.batch_size = batch_size
     self.model = model
예제 #4
0
 def __init__(self, db_name, model, thread_size):
     """
     init
     """
     # init mysql
     self.mysql = LoadCommon(db_name)
     self.thread_size = thread_size
     self.model = model
예제 #5
0
    def __init__(self,
                 mysql_w,
                 time_sql,
                 model="",
                 thread_size=1,
                 cpu_card="5117"):
        """
        init
        """
        try:
            cf = ConfigParser.ConfigParser()
            cf.read("../conf/load_config.conf")
            #TODO
            conf_name = "conf_%s" % model
            try:
                #write dead---no need from config
                #self.filename_top = cf.get(conf_name, "top_result_filename")
                self.cpu_card = cpu_card
                self.filename_top = "lego_top_result_filename_%s.txt" % self.cpu_card
            except Exception as e:
                print(
                    "\033[0;31;m[error]: Pls Check The Modle input wrong!\033[0m"
                )
                sys.exit(1)

            # get pid in top's file
            pid_set = set()
            temp_f1 = open(self.filename_top)
            for line in temp_f1.readlines():
                if "qa_work" in line:
                    pid_set.add(line.split()[0])
            temp_f1.close()
            if len(pid_set) != 1:
                sys.exit(1)
            self.pid = pid_set.pop()

            self.file_top = open(self.filename_top)

            # top's list
            self.cpu_list_1sec = []
            self.phy_mem_list_1sec = []
            self.virt_mem_list_1sec = []
            self.top_pertime = []

            # init mysql
            self.mysql = LoadCommon(model, thread_size, self.cpu_card)

            # init the initing time
            self.time_sql = time_sql

            # init env: truncate table top_list_1sec
            self.mysql.create_database()

            self.mysql.create_table_sql_top_avg_model_lego()
            self.db_onoff = mysql_w
        except Exception as exception:
            print exception
            return
예제 #6
0
    def __init__(self,
                 mysql_w,
                 time_sql,
                 model="",
                 batch_size=1,
                 gpu_card="p4"):
        """
        init
        """
        try:
            cf = ConfigParser.ConfigParser()
            cf.read("../conf/load_config.conf")
            #TODO
            conf_name = "conf_%s" % model
            try:
                #write dead---no need from config
                #self.filename_top = cf.get(conf_name, "top_result_filename")
                #self.filename_gpu = cf.get(conf_name, "gpu_result_filename")
                self.gpu_card = gpu_card
                self.filename_top = "tensorrt_top_result_filename_%s.txt" % self.gpu_card
                self.filename_gpu = "tensorrt_gpu_result_filename_%s.txt" % self.gpu_card
            except Exception as e:
                print(
                    "\033[0;31;m[error]: Pls Check The Modle input wrong!\033[0m"
                )
                sys.exit(1)

            # get pid in top's file
            pid_set = set()
            temp_f1 = open(self.filename_top)
            for line in temp_f1.readlines():
                if "qa_work" in line:
                    pid_set.add(line.split()[0])
            temp_f1.close()
            if len(pid_set) != 1:
                sys.exit(1)
            self.pid = pid_set.pop()

            self.file_top = open(self.filename_top)
            self.file_gpu = open(self.filename_gpu)

            # top's list
            self.cpu_list_1sec = []
            self.phy_mem_list_1sec = []
            self.virt_mem_list_1sec = []
            self.top_pertime = []

            # gpu's list
            self.gpu_pertime = []

            self.gpu_usage_percent_1 = []
            self.gpu_usage_percent_2 = []
            self.gpu_usage_percent_3 = []
            self.gpu_usage_percent_4 = []
            self.gpu_usage_percent_all = []

            self.gpu_mem_1 = []
            self.gpu_mem_2 = []
            self.gpu_mem_3 = []
            self.gpu_mem_4 = []
            self.gpu_mem_all = []

            self.gpu_temper_1 = []
            self.gpu_temper_2 = []
            self.gpu_temper_3 = []
            self.gpu_temper_4 = []
            self.gpu_temper_max = []

            # init mysql
            self.mysql = LoadCommon(model, batch_size, self.gpu_card)

            # init the initing time
            self.time_sql = time_sql

            # init env: truncate table top_list_1sec
            self.mysql.create_database()

            self.mysql.create_table_sql_top_avg_model_tensorRT()
            self.mysql.create_table_sql_nvidia_version_model_tensorRT()
            self.db_onoff = mysql_w
            if self.db_onoff == "on":
                self.mysql.truncate_table_sql("top_list_1sec_avg_tensorRT_%s" %
                                              self.gpu_card)
                self.mysql.truncate_table_sql(
                    "nvidia_list_1sec_version_tensorRT_%s" % self.gpu_card)
        except Exception as exception:
            print exception
            return
예제 #7
0
#
# Copyright (c) 2018 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
Compare TensorRT Main File!

Authors: sysqa([email protected])
Date:    2018/04/04
"""

import os
import re
import sys
import time
import json
import logging
import random

import mylogging
from load_common import LoadCommon

if __name__ == '__main__':
    #init mylogging
    logger = mylogging.init_log(logging.DEBUG)

    mysql = LoadCommon("language", 1, "5177")
    #mysql.create_table_sql_top_avg_model_tensorRT()
    #mysql.create_table_sql_nvidia_version_model_tensorRT()
    mysql.create_database()
예제 #8
0
#    print ("\033[0;36;m[no_right_data]    = (%s)\033[0m" % (no_right_data))
#    print ("\033[0;36;m[no_right_weight]  = (%s)\033[0m" % (no_right_weight))
#    print ("\033[0;36;m[no_right_c_and_h] = (%s)\033[0m" % (no_right_c_and_h))

    time_now = int(time.time())
    time_local = time.localtime(time_now)
    time_sql = time.strftime("%Y-%m-%d %H:%M:%S",time_local)

    if len(sys.argv) == 1:
        print ("\033[0;36;mno right input model: python logdata_collect.py \"model\"\033[0m")
        sys.exit(1)
    elif len(sys.argv) == 2:
        model = sys.argv[1]
        thread_size = 1
        cpu_card = "5117"
        mysql = LoadCommon(model, thread_size, cpu_card)
    elif len(sys.argv) == 3:
        model = sys.argv[1]
        thread_size = sys.argv[2]
        cpu_card = "5117"
        mysql = LoadCommon(model, thread_size, cpu_card)
    elif len(sys.argv) == 4:
        model = sys.argv[1]
        thread_size = sys.argv[2]
        cpu_card = sys.argv[3]
        mysql = LoadCommon(model, thread_size, cpu_card)
    elif len(sys.argv) == 5:
        model = sys.argv[1]
        thread_size = sys.argv[2]
        cpu_card = sys.argv[3]
        mysql = LoadCommon(model, thread_size, cpu_card)
예제 #9
0
Compare TensorRT Main File!

Authors: sysqa([email protected])
Date:    2018/04/04
"""

import os
import re
import sys
import time
import json
import logging
import random

import mylogging
from load_common import LoadCommon

if __name__ == '__main__':
    #init mylogging
    logger = mylogging.init_log(logging.DEBUG)

    mysql = LoadCommon("cnn_seg_8")
    #mysql.create_table_sql_top_avg_model_tensorRT()
    #mysql.create_table_sql_nvidia_version_model_tensorRT()
    mysql.create_database()
    #mysql.create_table_sql_top_avg_model_tensorRT()
    #mysql.create_table_sql_nvidia_version_model_tensorRT()

#    mysql.truncate_table_sql("top_list_1sec_avg_tensorRT")
#    mysql.truncate_table_sql("nvidia_list_1sec_version_tensorRT")
예제 #10
0
    #    print ("\033[0;36;m[no_right_c_and_h] = (%s)\033[0m" % (no_right_c_and_h))

    time_now = int(time.time())
    time_local = time.localtime(time_now)
    time_sql = time.strftime("%Y-%m-%d %H:%M:%S", time_local)

    if len(sys.argv) == 1:
        print(
            "\033[0;36;mno right input model: python logdata_collect.py \"model\"\033[0m"
        )
        sys.exit(1)
    elif len(sys.argv) == 2:
        model = sys.argv[1]
        batch_size = 1
        gpu_card = "p4"
        mysql = LoadCommon(model, batch_size, gpu_card)
    elif len(sys.argv) == 3:
        model = sys.argv[1]
        batch_size = sys.argv[2]
        gpu_card = "p4"
        mysql = LoadCommon(model, batch_size, gpu_card)
    elif len(sys.argv) == 4:
        model = sys.argv[1]
        batch_size = sys.argv[2]
        gpu_card = sys.argv[3]
        mysql = LoadCommon(model, batch_size, gpu_card)
    elif len(sys.argv) == 5:
        model = sys.argv[1]
        batch_size = sys.argv[2]
        gpu_card = sys.argv[3]
        mysql = LoadCommon(model, batch_size, gpu_card)