Logotipo de Dpnp Memory

Dpnp Memory

Organización
intel
dpnp-memory

Device memory for dpnp arrays on Intel CPUs and GPUs: USM allocation kinds, checking which device and queue an array lives on with dpctl, reusing an output buffer inside a loop, chunking an in-memory workload that is larger than the device, and tools that report device memory use. Use when a dpnp script grows in memory until it fails, when an array lands on a device other than the one expected, or when a loop allocates a new array every iteration. Not for reading or writing files (dpnp-io).

Descripción general

Editorintel
Repositorioskills
Nombre de la habilidaddpnp-memory
Estrellas
31
Forks
14
Archivos incluidos
2
LicenciaApache-2.0
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando una petición es realmente relevante.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • 2 archivos incluidos

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por intel en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Dpnp Memory en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/intel/skills/tree/main/skills/dpnp-memory
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → Desde URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/intel/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/dpnp-memory .claude/skills/dpnp-memory
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Dpnp Memory en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición es relevante, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Dpnp Memory automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Dpnp Memory no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición relevante, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

dpnp memory and device placement

Purpose

Answers where a dpnp array lives, how much room the device has, and how to keep a long-running script from filling it. dpnp arrays are allocated in SYCL unified shared memory on a device, not on the CPU heap the way NumPy arrays are, so the questions that matter are different: which device, whose queue, and when the allocation is released.

Prefer this skill over guessing from symptoms — a script that slows down over hours, an out-of-memory error, or a GPU that turns out to have been a CPU all along are all answered by reading state the runtime already exposes.

When to Use This Skill

Use this skill when:

  • Memory use climbs over the life of a script or a notebook session.
  • A dataset is larger than the device and has to be processed in pieces.
  • The user needs to confirm which device or queue an array is on.
  • A tight loop allocates a new array per iteration.
  • The user asks how to see device memory use from outside Python.

Do not use this skill for host-side NumPy memory questions, for file I/O (that is dpnp-io), or to decide whether dpnp is worth using at all.

Quick Start

python
import dpnp

arr = dpnp.arange(1000)
print(arr.sycl_device)                                  # e.g. level_zero:gpu:0
print(arr.sycl_device.name)                             # human-readable name
print(arr.sycl_device.global_mem_size / 1e9, "GB")      # capacity, not free space

global_mem_size is the total the device reports. There is no dpnp API for free memory — that comes from the tools in Gotchas.

Implementation Guide

  1. Read the placement before changing anything. Every array carries sycl_device and sycl_queue; dpctl.get_devices() lists what is visible. Filter strings are backend:device_type:index, so level_zero:gpu:0 and opencl:cpu:0 name specific devices. Level Zero is the lower-overhead backend for Intel GPUs.

    python
    import dpctl
    
    for device in dpctl.get_devices():
        print(device.filter_string, device.name)
  2. Target a device explicitly when the default is wrong. dpnp picks a default device at import time using the SYCL default selector, which scores the visible devices — it is not "the first GPU". Pass device= or sycl_queue= rather than relying on it:

    python
    gpu = dpctl.SyclDevice("level_zero:gpu:0")
    arr = dpnp.arange(1000, device=gpu)
    
    queue = dpctl.SyclQueue(gpu)
    shared = dpnp.arange(1000, sycl_queue=queue)
  3. Reuse the output buffer in loops. Universal functions take out=, which writes into an existing allocation instead of making one:

    python
    a = dpnp.arange(10000, dtype=dpnp.float64)
    b = dpnp.arange(10000, dtype=dpnp.float64)
    result = dpnp.empty(10000, dtype=dpnp.float64)   # allocate once
    
    for _ in range(1000):
        dpnp.add(a, b, out=result)                   # no new allocation

    Use dpnp.empty() rather than dpnp.zeros() when the initial values are overwritten anyway, and pre-allocate the output of dpnp.matmul(A, B, out=C) the same way.

  4. Keep conversions out of the loop body. dpnp.asnumpy() copies device to host and dpnp.array() copies host to device. Calling a NumPy function on a dpnp array, or mixing the two in one expression, does the same thing implicitly. Hoist the conversion above the loop.

  5. Chunk a workload that does not fit. Size each chunk so the input and the intermediates together stay under the device capacity — roughly half to two thirds of it is a workable starting point — then release the arrays before the next iteration:

    python
    import gc
    import numpy
    import dpnp
    
    chunk = 10_000_000
    for start in range(0, 100_000_000, chunk):
        host = numpy.load(f"data_chunk_{start}.npy")
        device_array = dpnp.array(host)
        total = dpnp.sum(device_array ** 2)
        numpy.save(f"result_{start}.npy", dpnp.asnumpy(total))
        del device_array, total, host
        gc.collect()
  6. Watch the device while it runs rather than reasoning about it afterwards: xpu-smi dump -m 1 on data center GPUs, intel_gpu_top on client GPUs, clinfo for OpenCL limits, ze_info for Level Zero. Steadily climbing memory is the signature of a leak.

Performance

No measured numbers ship with this skill. Whether pre-allocation or chunking is worth it depends on array size, device, and driver, so measure the specific case:

  • Pre-allocation matters most for small arrays in loops with many iterations, where allocation is a large share of the work. For large arrays the allocation cost is amortized over the compute.
  • Chunking trades memory for repeated allocation and transfer. If disk I/O dominates, that trade is invisible; if compute dominates, it is not.
  • Warm up before timing anything: the first call on a new shape includes compilation.

Gotchas & Limitations

  • del does not free device memory immediately. It drops a reference. The allocation goes back when the object is collected, and in a notebook an output cell can hold the last reference. gc.collect() encourages collection; it does not guarantee the allocator returns the memory at that instant.
  • There is no memory_summary(). No device memory accounting API is exposed at the time of writing — global_mem_size is capacity, and free memory comes from xpu-smi or intel_gpu_top. SYCL_UR_TRACE=1 traces allocations (verbose; it replaced SYCL_PI_TRACE).
  • Integrated and discrete devices are not comparable. An integrated GPU shares host RAM; a discrete one has its own. The same chunk size can fit on one and not the other.
  • A leak looks like a slowdown first. Device memory fills, then the run either falls back or fails. If a script degrades over hours, check memory before profiling compute.
  • Not covered: multi-process or multi-device sharing of one allocation, and USM allocation kinds (device, host, shared) beyond the default.

References

FileLoad it when
references/official-sources.mdyou need the current dpctl device or queue API, the USM allocation kinds, or which release added a property — memory APIs move between releases and must not be answered from memory

Two things here should never be answered from memory: which dpctl properties exist in the installed version, and how much memory the device actually has free. The first is in the documentation, the second only in the running system.

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Se ofrecen como archivos de lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Dpnp Memory?

Device memory for dpnp arrays on Intel CPUs and GPUs: USM allocation kinds, checking which device and queue an array lives on with dpctl, reusing an output buffer inside a loop, chunking an in-memory workload that is larger than the device, and tools that report device memory use. Use when a dpnp script grows in memory until it fails, when an array lands on a device other than the one expected, or when a loop allocates a new array every iteration. Not for reading or writing files (dpnp-io).

¿Por qué usar Dpnp Memory en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Dpnp Memory está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Dpnp Memory en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/intel/skills/tree/main/skills/dpnp-memory. TypingMind lee su archivo SKILL.md, empaqueta sus archivos y la instala como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Dpnp Memory?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Dpnp Memory?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Dpnp Memory con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Dpnp Memory?

Sí. intel la ha publicado en GitHub bajo la licencia Apache-2.0. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇