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)
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( f'[Taichi] version {tc_core.get_version_string()}, {device_string}, commit {tc_core.get_commit_hash()[:8]}, python {sys.version_info[0]}.{sys.version_info[1]}.{sys.version_info[2]}' ) if not is_release(): tc_core.set_core_trigger_gdb_when_crash(True)