CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-pycuda

Python wrapper for Nvidia CUDA parallel computation API with object cleanup, automatic error checking, and convenient abstractions.

62%

Overall

Evaluation62%

0.94x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-7/

GPU Memory Pool Manager

A Python utility for managing GPU memory allocations efficiently using memory pools and unified memory features.

Capabilities

Memory Pool Configuration

  • Creates a device memory pool with a specified initial allocation size @test
  • Creates a page-locked host memory pool for faster transfers @test

Managed Memory Operations

  • Allocates managed memory that can be accessed from both CPU and GPU @test
  • Writes data to managed memory from CPU and reads it from GPU kernel @test

Pool-based Allocation

  • Allocates multiple device memory buffers from a memory pool @test
  • Frees memory back to the pool for reuse @test

Memory Statistics

  • Retrieves active allocation count from a device memory pool @test
  • Returns total managed memory currently allocated @test

Implementation

@generates

API

class MemoryManager:
    """Manages GPU memory allocations using pools and unified memory."""

    def __init__(self):
        """Initialize the memory manager with device and host memory pools."""
        pass

    def allocate_device_pooled(self, size_bytes: int) -> int:
        """
        Allocate device memory from the pool.

        Args:
            size_bytes: Number of bytes to allocate

        Returns:
            Memory address as integer
        """
        pass

    def allocate_managed(self, size_bytes: int, attach: str = "global") -> int:
        """
        Allocate managed/unified memory accessible from both CPU and GPU.

        Args:
            size_bytes: Number of bytes to allocate
            attach: Memory attachment mode ("global", "host", or "single")

        Returns:
            Memory address as integer
        """
        pass

    def allocate_pagelocked(self, size_bytes: int) -> int:
        """
        Allocate page-locked host memory from the pool.

        Args:
            size_bytes: Number of bytes to allocate

        Returns:
            Memory address as integer
        """
        pass

    def free_pooled(self, address: int) -> None:
        """
        Return memory to the pool for reuse.

        Args:
            address: Memory address to free
        """
        pass

    def get_pool_allocation_count(self) -> int:
        """
        Get the number of active allocations in the device memory pool.

        Returns:
            Number of active allocations
        """
        pass

    def get_managed_memory_total(self) -> int:
        """
        Get total bytes of managed memory currently allocated.

        Returns:
            Total managed memory in bytes
        """
        pass

Dependencies { .dependencies }

pycuda { .dependency }

Provides GPU computing capabilities with memory management features.

@satisfied-by

tessl i tessl/pypi-pycuda@2025.1.0

tile.json