tessl install tessl/pypi-pyopencl@2025.2.0Python wrapper for OpenCL enabling GPU and parallel computing with comprehensive array operations and mathematical functions
Agent Success
Agent success rate when using this tile
86%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.28x
Baseline
Agent success rate without this tile
67%
A tool to measure and analyze the execution time of OpenCL kernels with high precision timing.
Create a profiler that measures how long a kernel takes to execute on the GPU device. The profiler should capture precise timing information and calculate the duration.
The profiler should support measuring multiple operations sequentially and track each operation's timing independently.
@generates
import pyopencl as cl
from typing import Dict, Any
class KernelProfiler:
"""
A profiler for measuring OpenCL kernel execution times.
"""
def __init__(self, context: cl.Context):
"""
Initialize the profiler with an OpenCL context.
Args:
context: OpenCL context for creating command queues
"""
pass
def profile_kernel(self, kernel: cl.Kernel, queue_args: tuple, kernel_args: tuple) -> Dict[str, Any]:
"""
Profile a single kernel execution.
Args:
kernel: The compiled OpenCL kernel to profile
queue_args: Tuple of (global_size, local_size) for kernel execution
kernel_args: Tuple of arguments to pass to the kernel
Returns:
Dictionary containing:
- 'execution_time_ns': Execution time in nanoseconds (int)
- 'kernel_name': Name of the kernel (str)
"""
pass
def profile_operation(self, operation_fn, operation_name: str) -> Dict[str, Any]:
"""
Profile an arbitrary OpenCL operation (buffer transfer, kernel execution, etc.).
Args:
operation_fn: A callable that performs an OpenCL operation and returns an event
operation_name: Descriptive name for this operation
Returns:
Dictionary containing:
- 'execution_time_ns': Execution time in nanoseconds (int)
- 'operation_name': Name of the operation (str)
"""
passProvides OpenCL interface for GPU computing and event profiling.
@satisfied-by