/usr/local/lib64/python3.6/site-packages/torch/profiler/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/torch/profiler/__pycache__/profiler.cpython-36.pyc (16181B)
3
EgWF @ s d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZm Z m
Z
d dlmZ d dl
Z
d dljjZd dlmZmZ G dd deZd d deeeeeed d
dZeedd
dZdee
e edddZdd ZG dd deZdS ) N)Enum)AnyCallableIterableOptional)warn)kineto_availableProfilerActivityc @ s e Zd ZdZdZdZdZdZdS )ProfilerActionzG
Profiler actions that can be taken at the specified intervals
r N)__name__
__module____qualname____doc__NONEWARMUPRECORDRECORD_AND_SAVE r r C/usr/local/lib64/python3.6/site-packages/torch/profiler/profiler.pyr
s
r
)repeat
skip_first)waitwarmupactiver r returnc s` t td fdd}dkrDdkrD dkrDdkrDdksLtddkr\td |S )a
Returns a callable that can be used as profiler ``schedule`` argument. The profiler will skip
the first ``skip_first`` steps, then wait for ``wait`` steps, then do the warmup for the next ``warmup`` steps,
then do the active recording for the next ``active`` steps and then repeat the cycle starting with ``wait`` steps.
The optional number of cycles is specified with the ``repeat`` parameter, the zero value means that
the cycles will continue until the profiling is finished.
)stepr c s | dkst | k rtjS | 8 } }dkrH| | krHtjS | | }|k r^tjS | k rptjS ||d k rtjS tjS d S )Nr r )AssertionErrorr
r r r r )r Z num_stepsZmod_step)r r r r r r r schedule_fn s zschedule.
.schedule_fnr z#Invalid profiler schedule argumentsz>Profiler won't be using warmup, this can skew profiler results)intr
r r )r r r r r r r )r r r r r r schedule s r" )_r c C s t jS )zy
Default profiler behavior - immediately starts recording the events,
keeps doing it on every profiler step.
)r
r )r# r r r _default_schedule_fn8 s r$ F)dir_nameworker_nameuse_gzipc s8 ddl ddlddldd fdd}|S )a
Outputs tracing files to directory of ``dir_name``, then that directory can be
directly delivered to tensorboard as logdir.
``worker_name`` should be unique for each worker in distributed scenario,
it will be set to '[hostname]_[pid]' by default.
r N)r c
s j j s@yj dd W n tk
r> td Y nX s\djj tj djt j
d }r|d }| jj j | d S )NT)exist_okzCan't create directory: z{}_{}z{}.{}.pt.trace.jsoni z.gz)
pathisdirmakedirs ExceptionRuntimeErrorformatgethostnamestrgetpidr! timeexport_chrome_tracejoin)prof file_name)r% ossocketr2 r' r&