Logo de Dpnp Migration

Dpnp Migration

Organisation
intel
dpnp-migration

Porting an existing NumPy or CuPy program to dpnp on Intel CPUs and GPUs: deciding whether a codebase can run on dpnp at all, probing the installed release for whether a named NumPy function or family is implemented, the families with no device counterpart and their fallback wrapper, and where CuPy's device model differs from dpnp's. Use when the user plans a port or asks what dpnp covers. Not for a call that already fails after the port (dpnp-troubleshooting) or for first-time setup (dpnp-quickstart).

Présentation

Éditeurintel
Dépôtskills
Nom de la compétencedpnp-migration
Étoiles
31
Forks
14
Fichiers inclus
2
LicenceApache-2.0
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont en simple Markdown, et non en code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • 2 fichiers inclus

    Des scripts, des modèles de documents et des références que le modèle peut consulter pendant son travail. Les fichiers sont en lecture seule et ne sont jamais exécutés.

  • Open source

    Publiée par intel sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Dpnp Migration dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Collez l’URL du dossier de la compétence indiquée ci-dessous, puis confirmez.
    https://github.com/intel/skills/tree/main/skills/dpnp-migration
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter → Via URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

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-migration .claude/skills/dpnp-migration
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Dpnp Migration dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Dpnp Migration dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, Dpnp Migration n’est pas lié au modèle pour lequel cette compétence a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

dpnp migration from NumPy and CuPy

Purpose

Answers one question about an existing program: which of its array calls dpnp implements, and what to do with the rest. Swapping import numpy as np for import dpnp as np moves the calls it covers and raises on the calls it does not, so a port is an inventory problem before it is a performance one.

The method here is to probe the installed release rather than consult a coverage list. A list of supported functions is the single most perishable claim about dpnp: it is accurate for the release someone wrote it against and silently wrong afterwards, in both directions. hasattr is not.

When to Use This Skill

Use this skill when:

  • A NumPy or CuPy codebase has to run on Intel hardware and the question is whether it can.
  • The user wants to know, before the import swap, which calls will raise NotImplementedError or AttributeError after it.
  • The user asks whether dpnp supports a specific function or family.
  • CuPy code needs the dpnp spelling of device selection or of a host copy.

Do not use this skill to diagnose a call that already fails after the port, a broken install or a missing SYCL runtime (dpnp-troubleshooting), to hand arrays to pandas, scikit-learn, PyTorch, or TensorFlow (dpnp-interop), to choose a device or manage buffers (dpnp-memory), to decide whether the workload belongs on a device at all (dpnp-quickstart), or to migrate a CUDA-based AI repository — model code, kernels, and framework calls are cuda-to-xpu-migration, not this skill.

Quick Start

python
import dpnp

hasattr(dpnp, "linspace")            # constructor present in this release?
hasattr(dpnp.linalg, "eigh")         # submodule member present?
hasattr(dpnp.fft, "fftn")            # same question, FFT surface

Three lines against the release the user has installed settle more than any table can. Everything below is how to act on the answers.

Implementation Guide

  1. Inventory the surface the program actually uses. Grep for the np. call sites and reduce them to a set of names; that set, not the whole NumPy API, is the scope of the port.

  2. Probe each name in the installed release. Presence is one question and signature is another:

    python
    import dpnp
    
    wanted = ["sort", "argsort", "einsum", "interp", "unique"]
    missing = [name for name in wanted if not hasattr(dpnp, name)]
    
    import inspect
    inspect.signature(dpnp.sort)      # a present name can still lack a parameter

    A name that exists but rejects a keyword the program passes fails at runtime just as hard as an absent one, so read the signature for anything called with optional arguments.

  3. Expect three outcomes, and verify each against the installed release rather than this list. The families are stable enough to plan with; the membership is not:

    OutcomeFamilies that usually land here
    Presentarray construction, element-wise arithmetic and ufuncs, reductions, linalg, fft, basic and boolean indexing
    Present with a narrower signaturesorting, some random distributions, anything with a kind= or method= parameter
    Absent by designstring arrays, datetime64/timedelta64, structured and record arrays, polynomials, masked arrays

    The last row is not a gap waiting to be filled. Those families are host data structures rather than numeric kernels, so a device implementation is not pending — plan to keep that code on NumPy.

  4. Wrap what is missing, once, at the call site. The fallback converts to the host, runs NumPy there, and comes back:

    python
    import dpnp
    import numpy
    
    def unique_counts(array):
        """dpnp where it implements this, NumPy where it does not."""
        try:
            return dpnp.unique(array, return_counts=True)
        except (NotImplementedError, AttributeError, TypeError):
            values, counts = numpy.unique(dpnp.asnumpy(array), return_counts=True)
            return dpnp.array(values), dpnp.array(counts)

    TypeError belongs in that tuple: a narrower signature is how a partially implemented function refuses, and it is the outcome step 2 warns about.

  5. Know what the conversions cost. dpnp.array(host_array) copies host to device and dpnp.asnumpy(device_array) copies device to host. dpnp.asarray avoids a copy only when its input already lives in USM memory reachable by the target queue — a NumPy array never does, so treat both directions as copies unless you have measured otherwise.

  6. From CuPy, expect the device model to differ more than the array API. CuPy's cupy.cuda.Device(0).use() has no dpnp counterpart: there is no ambient current device to set. Placement is an argument at construction time:

    python
    import dpnp
    
    x = dpnp.zeros(1024, device="gpu")             # explicit at creation
    y = dpnp.zeros(1024, sycl_queue=x.sycl_queue)  # or inherit the queue

    cupy.asnumpy maps onto dpnp.asnumpy. For anything else CuPy-specific — .get(), memory pools, RawKernel, cupyx.scipy — probe before promising an equivalent; the pool and kernel APIs in particular have no dpnp analogue to translate into.

  7. Record what fell back. A port that ends with four wrapped functions and a note saying which they are is finished. One that ends with a wrapper around every call has hidden its own status, and nothing will tell you later which calls were ever on the device.

Performance

No measured numbers ship with this skill. What to measure once the port runs:

  • The fallback rate on the hot path. Each fallback is two transfers plus a host computation, so a wrapped function called per iteration can cost more than the whole device stage saves.
  • The end-to-end time against the unported original. A program that runs on the device but falls back inside its inner loop is the failure this skill exists to prevent, and only the whole-program timing shows it.
  • Warm-up separately from steady state; first-call compilation is part of a port's measurements too (dpnp-quickstart covers the timing method).

Gotchas & Limitations

  • A coverage list is a claim with a shelf life; hasattr is not. Probe the installed release, and say which release an answer was checked against.
  • Presence does not imply the same signature. The parameter the program passes is the thing to check, not the name.
  • NotImplementedError and AttributeError are different symptoms. The first is a function that exists and declines; the second is a name that is not there at all. A fallback that catches only one of them leaves the other crashing.
  • A fallback inside a loop is correct code that loses the port. Wrap the function, not the iteration.
  • CuPy's current-device idiom has no translation. Do not offer a context-manager equivalent; pass device= or sycl_queue= instead.
  • The host-data families will not arrive. Strings, datetimes, structured arrays, polynomials, and masked arrays are not scheduled work, and telling a user to wait for them is wrong advice.
  • Not covered: CUDA kernel sources and RawKernel, cupyx.scipy, framework and model migration, and any judgement about whether the ported workload is large enough to belong on a device.

References

FileLoad it when
references/official-sources.mdyou need the API surface a specific dpnp release implements, the CuPy call whose equivalent is in question, or the array API standard the two are converging on

One question here must never be answered from memory: what the installed release implements. The probe in step 2 is cheap, and a remembered coverage table is how this skill would tell a user that a function they need is missing when it is present, or present when it is missing.

Fichiers inclus

Le modèle lit ces fichiers à la demande lorsque la compétence est chargée. Ils sont accessibles en lecture et ne sont jamais exécutés.

Foire aux questions

À quoi sert la compétence IA Dpnp Migration ?

Porting an existing NumPy or CuPy program to dpnp on Intel CPUs and GPUs: deciding whether a codebase can run on dpnp at all, probing the installed release for whether a named NumPy function or family is implemented, the families with no device counterpart and their fallback wrapper, and where CuPy's device model differs from dpnp's. Use when the user plans a port or asks what dpnp covers. Not for a call that already fails after the port (dpnp-troubleshooting) or for first-time setup (dpnp-quickstart).

Pourquoi utiliser Dpnp Migration sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Dpnp Migration se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Dpnp Migration dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/intel/skills/tree/main/skills/dpnp-migration. TypingMind lit le fichier SKILL.md, regroupe les fichiers associés et installe le tout sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Dpnp Migration ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Dpnp Migration ?

Autant que vous le souhaitez. Tant qu’un modèle prend en charge les compétences, vous pouvez utiliser Dpnp Migration avec lui : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Dpnp Migration est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par intel sous licence Apache-2.0. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, modèles de documents ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇