Exemplo n.º 1
0
def get_gpu_list() -> List[gpu.GPU]:
    """Get list of GPU detected by the system (lspci)"""
    data = execute_command('lspci').lower()
    reg = re.compile(r'(vga|display|hdmi|3d)')
    gpu_list = []
    for device in data.split('\n'):
        if reg.search(device):
            de = re.search(r'([^ ]*).*:\s*([^ ]*)', device)
            if de:
                has_screen = re.search(r'(vga|display|hdmi)', device)
                pci_id = de.group(1).replace('.', ':')

                brand = de.group(2)

                # Fix (Alternative name for AMD Cards)
                if brand == 'advanced':
                    brand = 'amd'

                gpu_list.append(gpu.GPU(pci_id, bool(has_screen), brand))
    return gpu_list
Exemplo n.º 2
0
    def create_all_dict(self):
        data1 = cpu.CPU()
        cpu_dict = data1.clean_dict(
        )  # instantiate cpu class, creates cpu dict

        data2 = gpu.GPU()
        gpu_dict = data2.clean_dict(
        )  # instantiate gpu class, creates gpu dict

        data3 = ram.RAM()
        ram_dict = data3.clean_dict(
        )  # instantiate ram class, creates ram dict

        year1 = 1960
        value_list = []

        while year1 < 2021:
            if str(year1) in ram_dict.keys():
                if str(year1) in gpu_dict.keys():
                    if str(year1) in cpu_dict.keys(
                    ):  # checks to see if year1 value is a key in all three dictionaries (cpu, gpu, and ram)
                        ram_value = ram_dict[str(
                            year1
                        )]  # sets variable equal to value of dictionary key
                        gpu_value = gpu_dict[str(year1)]
                        cpu_value = cpu_dict[str(year1)]
                        value_list.append(ram_value)  # appends value to list
                        value_list.append(gpu_value)
                        value_list.append(cpu_value)

                        for x in value_list:  # iterate through list of values
                            x = (map(float, x))
                            valueSum = (sum(x) / 3)
                            self.all_dict[year1] = round(valueSum, 2)

            year1 += 1
Exemplo n.º 3
0
    # Tratando entrada de parâmetro
    parser = argparse.ArgumentParser(add_help=False)   # parser para linha de comando
    parser.add_argument("-i", "--input", help="arquivo X3D de entrada")
    parser.add_argument("-o", "--output", help="arquivo 2D de saída (imagem)")
    parser.add_argument("-w", "--width", help="resolução horizonta", type=int)
    parser.add_argument("-h", "--height", help="resolução vertical", type=int)
    parser.add_argument("-q", "--quiet", help="não exibe janela de visualização", action='store_true')
    args = parser.parse_args() # parse the arguments
    if args.input: x3d_file = args.input
    if args.output: image_file = args.output
    if args.width: width = args.width
    if args.height: height = args.height

    # Iniciando simulação de GPU
    gpu.GPU(width, height, image_file)
    #print(gpu.GPU.load_texture(image_file))

    # Abre arquivo X3D
    scene = x3d.X3D(x3d_file)
    scene.set_resolution(width, height)

    # funções que irão fazer o rendering
    x3d.X3D.render["Polypoint2D"] = polypoint2D
    x3d.X3D.render["Polyline2D"] = polyline2D
    x3d.X3D.render["TriangleSet2D"] = triangleSet2D
    x3d.X3D.render["TriangleSet"] = triangleSet
    x3d.X3D.render["Viewpoint"] = viewpoint
    x3d.X3D.render["Transform"] = transform
    x3d.X3D.render["_Transform"] = _transform
    x3d.X3D.render["TriangleStripSet"] = triangleStripSet
Exemplo n.º 4
0
def main():
    exitFalse = True
    while exitFalse:
        userInput = int(
            input('''
                Please select an option below:
                1) CPU Data
                2) GPU DATA
                3) RAM Data
                4) All Data
                5) Exit
                '''))

        if userInput == 1:
            cpuExitTrue = False
            choice_cpu = cpu.CPU()

            while cpuExitTrue is False:
                cpu_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if cpu_selection == 1:
                    choice_cpu.avg_perc_inc()

                elif cpu_selection == 2:
                    choice_cpu.two_year_inc()

                elif cpu_selection == 3:
                    cpuExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 2:
            gpuExitTrue = False
            choice_gpu = gpu.GPU()

            while gpuExitTrue is False:
                gpu_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if gpu_selection == 1:
                    choice_gpu.avg_perc_inc()

                elif gpu_selection == 2:
                    choice_gpu.two_year_inc()

                elif gpu_selection == 3:
                    gpuExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 3:
            ramExitTrue = False
            choice_ram = ram.RAM()

            while ramExitTrue is False:
                ram_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if ram_selection == 1:
                    choice_ram.avg_perc_inc()

                elif ram_selection == 2:
                    choice_ram.two_year_inc()

                elif ram_selection == 3:
                    ramExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 4:
            allExitTrue = False
            choice_all = all.ALL()

            while allExitTrue is False:
                all_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if all_selection == 1:
                    choice_all.avg_perc_inc()

                elif all_selection == 2:
                    choice_all.two_year_inc()

                elif all_selection == 3:
                    allExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 5:
            exitFalse = False

        else:
            print('Invalid selection')
Exemplo n.º 5
0
    image_file = "tela.png"

    # Tratando entrada de parâmetro
    parser = argparse.ArgumentParser(
        add_help=False)  # parser para linha de comando
    parser.add_argument("-i", "--input", help="arquivo X3D de entrada")
    parser.add_argument("-o", "--output", help="arquivo 2D de saída (imagem)")
    parser.add_argument("-w", "--width", help="resolução horizonta", type=int)
    parser.add_argument("-h", "--height", help="resolução vertical", type=int)
    args = parser.parse_args()  # parse the arguments
    if args.input: x3d_file = args.input
    if args.output: image_file = args.output
    if args.width: width = args.width
    if args.height: height = args.height

    # Iniciando simulação de GPU
    gpu.GPU(width, height)

    # Abre arquivo X3D
    scene = x3d.X3D(x3d_file)
    scene.set_resolution(width, height)

    # funções que irão fazer o rendering
    x3d.X3D.render["Polypoint2D"] = polypoint2D
    x3d.X3D.render["Polyline2D"] = polyline2D
    x3d.X3D.render["TriangleSet2D"] = triangleSet2D

    scene.parse()  # faz o traversal no grafo de cena
    interface.Interface(width, height,
                        image_file).preview(gpu.GPU._frame_buffer)