Dpnp Interop logo

Dpnp Interop

Organization
intel
dpnp-interop

Passing dpnp arrays to and from other Python libraries on Intel CPUs and GPUs. Use when dpnp numeric work has to feed pandas, scikit-learn, PyTorch, or TensorFlow, when one of those libraries raises a type error on a dpnp array, when a pipeline mixes device math with host-only libraries, or when the user asks where in a pipeline the conversion belongs. Covers the boundary conversion pattern per library, the Intel extensions that accelerate the host side, and why a conversion inside a loop erases the benefit.

Overview

Publisherintel
Repositoryskills
Skill namedpnp-interop
Stars
31
Forks
14
Bundled files
2
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by intel on GitHub. Read the source before you install it.

Installation

Install the Dpnp Interop AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/intel/skills/tree/main/skills/dpnp-interop
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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-interop .claude/skills/dpnp-interop
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Dpnp Interop in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Dpnp Interop on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Dpnp Interop is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

dpnp interoperability

Purpose

Connects dpnp to the libraries around it. None of pandas, scikit-learn, PyTorch, or TensorFlow accepts a dpnp array: they check for a NumPy array, so every handoff is a dpnp.asnumpy() on the way out and a dpnp.array() on the way back. This skill is where that conversion goes, per library, and what it costs.

Prefer it when dpnp is one stage of a longer pipeline. The failure it prevents is not a crash — it is a pipeline that converts on every iteration and ends up slower than the NumPy version it replaced.

When to Use This Skill

Use this skill when:

  • A dpnp result has to reach pandas, scikit-learn, PyTorch, or TensorFlow.
  • One of those libraries raises a type error on a dpnp array.
  • A pipeline alternates between device math and host-only libraries.
  • The user asks where the conversion belongs.

Do not use this skill for file formats (dpnp-io), for device placement (dpnp-memory), or to decide whether the numeric stage belongs on a device at all (dpnp-quickstart).

Quick Start

python
import dpnp

x = dpnp.random.randn(10000, 100)      # device
gram = dpnp.dot(x, x.T)                # device
host_gram = dpnp.asnumpy(gram)         # one conversion, at the boundary

Do the arithmetic first, convert once, then call the host library. The rule is the whole skill; the sections below are the per-library spelling of it.

Implementation Guide

  1. pandas. Frames hold NumPy arrays, so convert both ways explicitly:

    python
    import pandas
    
    frame = pandas.DataFrame(dpnp.asnumpy(x), columns=list("abcde"))
    values = dpnp.array(frame.values)
    column = dpnp.array(frame["a"].values)
  2. scikit-learn. fit and predict take host arrays; convert the features and the target once before training:

    python
    from sklearn.linear_model import LinearRegression
    
    features = dpnp.asnumpy(x)
    target = dpnp.asnumpy(y)
    model = LinearRegression().fit(features, target)
    predictions = dpnp.array(model.predict(features))

    The host side of this has its own Intel acceleration — the scikit-learn extension patches estimators in place:

    python
    from sklearnex import patch_sklearn
    
    patch_sklearn()
  3. PyTorch. Go through NumPy in both directions, and bring a device tensor to the host first:

    python
    import torch
    
    tensor = torch.from_numpy(dpnp.asnumpy(x))
    back = dpnp.array(tensor.cpu().numpy())

    PyTorch has its own Intel GPU path: with a recent build, or with Intel Extension for PyTorch on older ones, tensors move with .to("xpu") and stay in the framework rather than passing through dpnp at all. When the whole pipeline is a model, that is the better route — this skill is for the case where array math and a model each own part of it.

  4. TensorFlow. Same shape, through tf.constant and .numpy():

    python
    import tensorflow as tf
    
    x_tf = tf.constant(dpnp.asnumpy(x))
    back = dpnp.array(x_tf.numpy())
  5. Put the conversions at the ends of a mixed pipeline, not between stages:

    python
    frame = pandas.read_csv("data.csv")                     # host
    features = dpnp.array(frame[["f1", "f2", "f3"]].values) # -> device
    normalized = (features - dpnp.mean(features, axis=0)) / dpnp.std(features, axis=0)
    inputs = torch.from_numpy(dpnp.asnumpy(normalized))     # -> host, once
  6. Check the boundary when a library refuses the array. The symptom is a type error naming ndarray, and it means the library ran an isinstance check. dpnp.asnumpy() at that call site is the fix; a wrapper that converts on every call is not.

Performance

No measured numbers ship with this skill. What to measure when a handoff is on the hot path:

  • Count conversions per unit of work. One at each boundary is the target; one per loop iteration is the anti-pattern, and it is usually the reason a converted pipeline is no faster.
  • Time the whole pipeline, not the numeric stage. A faster dpnp stage surrounded by more transfers can be a net loss.
  • Compare against the all-NumPy original. If the host library dominates the runtime, the numeric stage is not where the time is.
  • The Intel extensions for scikit-learn and PyTorch accelerate the host and framework side respectively; they do not remove the conversion.

Gotchas & Limitations

  • No library here takes a dpnp array directly. Treat the compatibility question as settled: convert, do not probe for support.
  • A conversion in a loop is the common failure. It is correct code, and it can be slower than never having used a device.
  • A CUDA tensor needs .cpu() first. torch.Tensor.numpy() on a device tensor raises; the host copy is not optional.
  • asnumpy copies. It is not a view, and peak memory holds both copies during the call.
  • The Intel extensions are separate packages with their own release cadence; whether patch_sklearn or an explicit extension import is needed depends on the installed versions, so check rather than assume.
  • Not covered: zero-copy exchange protocols such as DLPack or the array API interchange, and any library not named above.

References

FileLoad it when
references/official-sources.mdyou need the current interoperability surface of dpnp, whether a library has gained direct support, or the install and activation steps for the Intel extensions for scikit-learn and PyTorch

Two questions here must not be answered from memory: whether a library has gained direct support for device arrays (the interchange protocols are moving, and a claim that it has not can go stale) and how the Intel extensions are activated in the installed version, which has changed more than once.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Dpnp Interop AI skill do?

Passing dpnp arrays to and from other Python libraries on Intel CPUs and GPUs. Use when dpnp numeric work has to feed pandas, scikit-learn, PyTorch, or TensorFlow, when one of those libraries raises a type error on a dpnp array, when a pipeline mixes device math with host-only libraries, or when the user asks where in a pipeline the conversion belongs. Covers the boundary conversion pattern per library, the Intel extensions that accelerate the host side, and why a conversion inside a loop erases the benefit.

Why use Dpnp Interop on TypingMind?

Because you install it once and use it with any model. Dpnp Interop is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Dpnp Interop in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/intel/skills/tree/main/skills/dpnp-interop. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Dpnp Interop?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Dpnp Interop?

As many as you like. As long as a model supports skills, you can use Dpnp Interop with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Dpnp Interop AI skill free?

Yes. It is published on GitHub by intel under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇