pyitt is a Python binding to Intel Instrumentation and Tracing Technology (ITT) API. It provides a convenient way to mark up the Python code for further performance analysis using performance analyzers from Intel like Intel VTune or others.
pyitt supports following ITT APIs:
- Collection Control API
- Domain API
- String Handle API
- Id API (partial support)
- Task API (partial support)
- Thread Naming API
The main goal of the project is to provide the ability to instrument a Python code using ITT API in the Pythonic way. pyitt provides wrappers that simplify markup of Python code.
import pyitt
@pyitt.task
def workload():
pass
workload()
pyitt.task
can be used as a decorator. In this case, the name of a callable object (workload
function in this
example) will be used as a name of the task and the task will be attributed to a default domain named 'pyitt'.
If you want to change the default name and/or other parameters for the task (e.g. task domain), you can pass
them as arguments to pyitt.task
:
import pyitt
@pyitt.task('My Task', domain='My Task Domain')
def workload():
pass
workload()
Also, pyitt.task
returns the object that can be used as a context manager:
import pyitt
with pyitt.task():
# some code here...
pass
If the task name is not specified, the pyitt.task
uses call site information (filename and line number) to give
the name to the task. A custom name for the task and other task parameters can be specified via arguments
for pyitt.task
in the same way as for the decorator form.
The native part of pyitt module is written using C++20 standard, therefore you need a compiler that supports this standard, for example GCC-13 for Linux and Visual Studio 2022 for Windows.
-
Install the compiler and Python utilities to build module:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update sudo apt install gcc-13 g++-13 python3-pip
-
Clone the repository:
git clone --recurse-submodules https://github.com/esuldin/pyitt.git
-
Prepare the build environment: specify the compiler and the path to ITT header and static library.
export CC=`which gcc-13` export CXX=`which g++-13` export VTUNE_PROFILER_DIR=/opt/intel/oneapi/vtune/latest
-
Build and install pyitt:
cd pyitt pip install .
-
Install Python 3.8+ together with pip utility.
-
Install Visual Studio 2022. Make sure that "Desktop development with C++" workload is selected.
-
Clone the repository
git clone --recurse-submodules https://github.com/esuldin/pyitt.git
-
Prepare the build environment: specify the paths to Python and to ITT header and static library.
set PATH=C:\Program Files\Python38;C:\Program Files\Python38\Scripts;%PATH% set VTUNE_PROFILER_DIR=C:\Program Files (x86)\Intel\oneAPI\vtune\latest
-
Build and install pyitt
cd pyitt pip install .