Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pyopencl@2025.2.x
tile.json

tessl/pypi-pyopencl

tessl install tessl/pypi-pyopencl@2025.2.0

Python 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%

task.mdevals/scenario-2/

Kernel Execution Profiler

A tool to measure and analyze the execution time of OpenCL kernels with high precision timing.

Capabilities

Profile kernel execution time

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.

  • A simple matrix multiplication kernel execution is profiled and returns timing in nanoseconds @test
  • A vector addition kernel execution is profiled and returns accurate timing @test

Measure multiple operations

The profiler should support measuring multiple operations sequentially and track each operation's timing independently.

  • Profile two different kernel executions and return separate timings for each @test
  • Profile a buffer write followed by a kernel execution and report both timings @test

Implementation

@generates

API

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)
        """
        pass

Dependencies { .dependencies }

pyopencl { .dependency }

Provides OpenCL interface for GPU computing and event profiling.

@satisfied-by