CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyopencl

Python wrapper for OpenCL enabling GPU and parallel computing with comprehensive array operations and mathematical functions

86

1.28x
Overview
Eval results
Files

task.mdevals/scenario-3/

Built-in Kernel Discovery Tool

A utility that discovers and reports information about built-in kernels available on OpenCL devices.

Requirements

Create a tool that discovers built-in kernels on OpenCL devices and provides structured information about them. The tool should:

  1. Query available OpenCL devices for built-in kernels
  2. Return a structured list of devices with their built-in kernel names
  3. Handle devices that don't support built-in kernels gracefully

Functionality

Device and Built-in Kernel Discovery

The tool should be able to:

  • Query all available OpenCL devices in the system
  • For each device, retrieve the list of built-in kernel names (if any)
  • Return results in a structured format containing:
    • Device name
    • Device type (CPU, GPU, etc.)
    • List of built-in kernel names (empty list if none available)

Error Handling

  • Handle cases where devices don't support built-in kernels
  • Handle OpenCL initialization errors gracefully
  • Return an empty result set if no OpenCL devices are available

Test Cases

  • When querying a device with no built-in kernels, it returns an empty kernel list for that device @test
  • When querying multiple devices, it returns information for all devices @test
  • When a device has built-in kernels, they can be accessed by creating a program from built-in kernel names @test

Implementation

@generates

API

from typing import List, Dict, Any

def discover_builtin_kernels() -> List[Dict[str, Any]]:
    """
    Discovers built-in kernels available on all OpenCL devices.

    Returns:
        A list of dictionaries, each containing:
        - 'device_name': str - Name of the device
        - 'device_type': str - Type of device (e.g., 'GPU', 'CPU')
        - 'builtin_kernels': List[str] - List of built-in kernel names

    Returns an empty list if no OpenCL devices are available.
    """
    pass

Dependencies { .dependencies }

pyopencl { .dependency }

Provides OpenCL device access and built-in kernel support.

Install with Tessl CLI

npx tessl i tessl/pypi-pyopencl

tile.json