Dpnp Interopのロゴ

Dpnp Interop

組織
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.

概要

公開者intel
リポジトリskills
スキル名dpnp-interop
スター
31
フォーク
14
同梱ファイル
2
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    intelがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルDpnp InteropをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/intel/skills/tree/main/skills/dpnp-interop
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでDpnp Interopを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にDpnp Interopを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Dpnp Interopは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「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.

TypingMindでDpnp Interopを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Dpnp Interopはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにDpnp Interopをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/intel/skills/tree/main/skills/dpnp-interopを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Dpnp Interopを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Dpnp Interopは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもDpnp Interopを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Dpnp Interop」は無料ですか?

はい。intelがGitHubでApache-2.0ライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇