<commit_before>#!/usr/bin/env python3

import pycuda.driver
import pycuda.autoinit
import pycuda.compiler
import sys


if __name__ == "__main__":
    prog = sys.argv[0]
    cnt = pycuda.driver.Device.count()

    if cnt == 0:
        print("%s: No devices found!" % prog, file=sys.stderr)
        exit(-1)
    else:
        print("%d device(s) found in total." % cnt)

    for i in range(cnt):
        dev = pycuda.driver.Device(i)
        print("""
Device %(cnt)d:
\tName: %(name)s
\tCompute Capability: %(compute_capability)s
\tPCI Bus ID: %(pci_bus_id)s
\tTotal Memory: %(total_mem)dMB
\tMax Threads Per Block: %(max_thrds_per_blk)d
\tMax Block Dim in (X, Y, Z): %(max_blk_dim)s
\tMax Grid Dim in (X, Y, Z): %(max_grid_dim)s
\tMax Shared Memory Per Block: %(max_shared_mem_per_blk)dKB
\tTotal Constant Memory: %(total_const_mem)dKB
\tWarp Size: %(warp_sz)d
\tMax Pitch: %(max_pitch)d
\tMax Registers Per Block: %(max_regs_per_blk)d
\tClock Rate: %(clock_rate)dMHz
\tTexture Alignment: %(texture_align)d
\tGPU Overlap: %(gpu_overlap)d
\tMultiprocessor Count: %(mp_cnt)d
\tKernel Execution Timeout: %(krnl_exec_timeout)d
\tIntegrated: %(integrated)s
\tCan Map Host Memory: %(can_map_host_mem)s
\tMax Texture1D Size in (Width): %(max_texture1d_sz)s<commit_msg>Add usage and version<commit_after>#!/usr/bin/env python3

import pycuda.driver
import pycuda.autoinit
import pycuda.compiler
import getopt
import sys


def usage(prog):
    print("Usage: %s [OPTION]..." % prog)
    print()
    print("      --help    ", "display this help and exit")
    print("      --version ", "output version information and exit")
    print()


def version(prog):
    print("%s 0.01" % prog)

if __name__ == "__main__":
    prog = sys.argv[0]
    cnt = pycuda.driver.Device.count()

    try:
        opts, args = getopt.getopt(sys.argv[1:], "hv",
                                   ["help",
                                    "version"])
    except getopt.GetoptError as wrngopt:
        print("%s: invalid option -- \'%s\'" % (prog, wrngopt.opt),
              file=sys.stderr)
        exit(1)

    for op, value in opts:
        if op == "-h" or op == "--help":
            usage(prog)
            exit(0)
        elif op == "-v" or op == "--version":
            version(prog)
            exit(0)
        else:
            pass

    if cnt == 0:
        print("%s: No devices found!" % prog, file=sys.stderr)
        exit(-1)
    else:
        print("%d device(s) found in total." % cnt)

    for i in range(cnt):
        dev = pycuda.driver.Device(i)
        print("""
Device %(cnt)d:
\tName: %(name)s
\tCompute Capability: %(compute_capability)s
\tPCI Bus ID: %(pci_bus_id)s
\tTotal Memory: %(total_mem)dMB
\tMax Threads Per Block: %(max_thrds_per_blk)d
\tMax Block Dim in (X, Y, Z): %(max_blk_dim)s
\tMax Grid Dim in (X, Y, Z): %(max_grid_dim)s
\tMax Shared Memory Per Block: %(max_shared_mem_per_blk)dKB
\tTotal Constant Memory: %(total_const_mem)dKB
\tWarp Size: %(warp_sz)d
\tMax Pitch: %(max_pitch)d
\tMax Registers Per Block: %(max_regs_per_blk)d
\tClock Rate: %(clock_rate)dMHz
\tTexture Alignment: %(texture_align)d
\tGPU Overlap: %(gpu_overlap)d
\tMultiprocessor Count: %(mp_cnt)d
\tKernel Execution Timeout: %(krnl_exec_timeout)d
\tIntegrated: %(integrated)s
\tCan Map Host Memory: %(can_map_host_mem)s
\tMax Texture1D Size in (Width): %(max_texture1d_sz)s
{'fraction_non_alphanumeric': 0.1449016100178891, 'fraction_numerical': 0.005664877757901014, 'mean_word_length': 3.091463414634146, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6455228', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1275, 'n_words': 325}