def LazyConsistentWatchDiff(blob_watched, handler): handler_uuid = str(uuid.uuid1()) lbi_and_uuid = LbiAndDiffWatcherUuidPair() lbi_and_uuid.lbi.CopyFrom(blob_watched.lbi) lbi_and_uuid.watcher_uuid = handler_uuid c_api_util.CurJobBuildAndInferCtx_AddLbiAndDiffWatcherUuidPair( lbi_and_uuid) watcher_util.BindUuidAndHandler(handler_uuid, blob_watched, handler)
def LazyConsistentWatchDiff(blob_watched, handler): handler_uuid = str(uuid.uuid1()) lbi_and_uuid = LbiAndDiffWatcherUuidPair() # Copy cfg LBI to proto LBI lbi_and_uuid.lbi.op_name = blob_watched.lbi.op_name() lbi_and_uuid.lbi.blob_name = blob_watched.lbi.blob_name() lbi_and_uuid.watcher_uuid = handler_uuid c_api_util.CurJobBuildAndInferCtx_AddLbiAndDiffWatcherUuidPair( lbi_and_uuid) watcher_util.BindUuidAndHandler(handler_uuid, blob_watched, handler)
def LazyConsistentWatch(blob_watched, handler): handler_uuid = str(uuid.uuid1()) op_conf = op_conf_util.OperatorConf() op_conf.name = id_util.UniqueStr("ForeignWatch_") setattr(op_conf.foreign_watch_conf, "in", blob_watched.unique_name) op_conf.foreign_watch_conf.handler_uuid = handler_uuid device_name = blob_watched.parallel_conf.device_name(0) with oneflow.scope.placement("cpu", "0:0"): compile_context.CurJobAddOp(op_conf) watcher_util.BindUuidAndHandler(handler_uuid, blob_watched, handler)
def LazyConsistentWatch(blob_watched, handler): handler_uuid = str(uuid.uuid1()) op_conf = op_conf_util.OperatorConf() op_conf.name = id_util.UniqueStr("ForeignWatch_") setattr(op_conf.foreign_watch_conf, "in", blob_watched.unique_name) op_conf.foreign_watch_conf.handler_uuid = handler_uuid device_name = blob_watched.parallel_conf.device_name[0] tag_and_dev_ids = parallel_conf_util.GetDeviceTagAndMachineDeviceIds( blob_watched.parallel_conf) with oneflow.scope.placement(*tag_and_dev_ids): compile_context.CurJobAddOp(op_conf) watcher_util.BindUuidAndHandler(handler_uuid, blob_watched, handler)