export_protobuf¶
- paddle.profiler. export_protobuf ( dir_name: str, worker_name: Optional[str] = None ) Callable [source]
- 
         Return a callable, used for outputing tracing data to protobuf file. The output file will be saved in directory dir_name, and file name will be set asworker_name. ifworker_nameis not set, the default name is [hostname]_[pid].- Parameters
- 
           - dir_name (str) – Directory to save profiling data. 
- worker_name (str, optional) – Prefix of the file name saved, default is [hostname]_[pid]. 
 
- Returns
- 
           A callable, which takes a Profiler object as parameter and calls its export method to save data to protobuf file. 
 Examples The return value can be used as parameter on_trace_readyin Profiler .# required: gpu import paddle.profiler as profiler with profiler.Profiler( targets=[profiler.ProfilerTarget.CPU, profiler.ProfilerTarget.GPU], scheduler = (3, 10), on_trace_ready = profiler.export_protobuf('./log')) as p: for iter in range(10): #train() p.step() 
