Exemplo n.º 1
0
def _print_taichi_header():
    dev_mode = not is_release()

    header = '[Taichi] '
    if dev_mode:
        header += '<dev mode>, '
    else:
        header += f'version {ti_core.get_version_string()}, '

    supported_archs = ['cpu']
    if ti_core.with_cuda():
        supported_archs.append('cuda')
    if ti_core.with_opengl():
        supported_archs.append('opengl')
    if ti_core.with_metal():
        supported_archs.append('metal')
    if len(supported_archs) == 1:
        supported_archs[0] = 'cpu only'
    archs_str = ', '.join(sorted(supported_archs))
    header += f'supported archs: [{archs_str}], '

    commit_hash = ti_core.get_commit_hash()
    commit_hash = commit_hash[:8]
    header += f'commit {commit_hash}, '

    py_ver = '.'.join(str(x) for x in sys.version_info[:3])
    header += f'python {py_ver}'

    print(header)
Exemplo n.º 2
0
def _print_taichi_header():
    dev_mode = not is_release()

    header = '[Taichi] '
    if dev_mode:
        header += '<dev mode>, '
    else:
        header += f'version {ti_core.get_version_string()}, '

    llvm_version = ti_core.get_llvm_version_string()
    header += f'llvm {llvm_version}, '

    commit_hash = ti_core.get_commit_hash()
    commit_hash = commit_hash[:8]
    header += f'commit {commit_hash}, '

    py_ver = '.'.join(str(x) for x in sys.version_info[:3])
    header += f'python {py_ver}'

    print(header)
Exemplo n.º 3
0
    proc.start()


def require_version(major, minor=None, patch=None):
    versions = [
        int(tc_core.get_version_major()),
        int(tc_core.get_version_minor()),
        int(tc_core.get_version_patch()),
    ]
    match = major == versions[0] and (
        minor < versions[1] or minor == versions[1] and patch <= versions[2])
    if match:
        return
    else:
        print("Taichi version mismatch. required >= {}.{}.{}".format(
            major, minor, patch))
        print("Installed =", tc_core.get_version_string())
        raise Exception("Taichi version mismatch")


at_startup()

device_string = 'cpu only' if not tc_core.with_cuda() else 'cuda {}'.format(
    tc_core.cuda_version())
print('[Taichi version {}, {}, commit {}]'.format(
    tc_core.get_version_string(), device_string,
    tc_core.get_commit_hash()[:8]))

if not is_release():
    tc_core.set_core_trigger_gdb_when_crash(True)