Exemple #1
0
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")
Exemple #2
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)
Exemple #3
0
  return
  import os, psutil, time
  if pid == -1:
    pid = os.getpid()
  import multiprocessing
  def task():
    with open(output_fn, 'w') as f:
      process = psutil.Process(pid)
      while True:
        try:
          mem = process.memory_info().rss
        except:
          mem = -1
        time.sleep(interval)
        print(time.time(), mem, file=f)
        f.flush()
  proc = multiprocessing.Process(target=task, daemon=True)
  proc.start()


@atexit.register
def clean_libs():
  pass

at_startup()

print('[Taichi version {}]'.format(tc_core.get_version_string()))

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