Python APIs - Python APIs - 57368

uProf User Guide

Document ID
57368
Release Date
2025-06-09
Revision
5.1 English

To use these Python APIs:

  1. Set environment variable PYTHONPATH to the path of the module amd_instrument.py, located in: <uProf Install Directory>/lib/x64/python/.
  2. Import the module amd_instrument, which defines the domain/task APIs.

There are two groups of APIs: Python APIs and C++ based APIs, for supporting domain and task. APIs from one group cannot be mixed with APIs for another group.

Table 1. Python APIs: Group 1 contains 2 APIs
API and Description Parameters Returns

amd_start_task(domain_task_name)

This creates the domain and the task and begins the task.

domain_task_name: This is "::" separated domain task combination string in the format <domain>::<task>

Example: high_compute::img_segmentation, where high_compute is domain name and img_segmentation is the task name.

Nothing

amd_end_task(domain)

This marks the end of the last (latest) task in the specified domain.

domain: the domain from which the last task to be marked as end. Nothing
Example
import amd_instrument as a
#... other code e.g. function calls and/or statements
a. amd_start_task("DomainABC::TaskPQR")
 
# ... blocking function calls and/or statements, considered within this task
# or non-blocking function calls and/or statements, not considered within tasks
a.amd_end_task(“DomainABC”)
Table 2. Python APIs: Group 2 contains 3 APIs
API and Description Parameters Returns

domain_create(domain_name : str)

This API take a domain name string and return a domain, which is used in the task_begin(...) API.

domain: the domain name as string under which current task is being considered. domain that was created.

task_begin(domain, name)

This API takes, a domain created in and returned by domain_create(...) API and takes the task name. It defines the starting point of the task.

domain: the domain returned from the domain_create(...) call.

task: the task name as string

Nothing

task_end(domain)

This API takes the domain_create(...) created in and returned by domain_create(...) API and marks the end of the task which was last created within the same domain.

domain: the domain returned from the domain_create(...) call. Nothing
Example
import amd_instrument as a
#... other code e.g. function calls and/or statements
d = a.domain_create("DomainABC")
a.task_begin(d, "TaskPQR")
 
# ... blocking function calls and/or statements, considered within this task
# or non-blocking function calls and/or statements, not considered within tasks
a.task_end(d)