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%
Build a data buffer management system that efficiently transfers and processes numerical data between host (CPU) and device (GPU) memory using parallel computing capabilities.
Create a Python module that provides buffer management functionality with the following capabilities:
Initialize and set up a computing context with the following:
Implement functions to handle data movement:
Upload data to device: Transfer numpy arrays from host to device memory
Download data from device: Retrieve data from device back to host
Device-to-device copy: Copy data between device buffers
@generates
import numpy as np
class BufferManager:
"""Manages GPU buffer operations for data transfer and manipulation."""
def __init__(self):
"""Initialize the buffer manager with appropriate device context and queue."""
pass
def upload_to_device(self, data: np.ndarray):
"""
Transfer numpy array from host to device memory.
Args:
data: Numpy array to upload
Returns:
Device buffer handle
"""
pass
def download_from_device(self, device_buffer, shape, dtype):
"""
Retrieve data from device buffer to host memory.
Args:
device_buffer: Device buffer handle
shape: Shape of the output array
dtype: Data type of the array
Returns:
Numpy array containing the data
"""
pass
def copy_device_buffer(self, source_buffer, dest_buffer, size_bytes: int):
"""
Copy data from one device buffer to another.
Args:
source_buffer: Source device buffer handle
dest_buffer: Destination device buffer handle
size_bytes: Number of bytes to copy
"""
pass
def cleanup(self):
"""Release resources and cleanup context."""
passProvides GPU computing and buffer management capabilities.
Provides array data structures and operations.