Logo de Dpnp Random

Dpnp Random

Organização
intel
dpnp-random

Random number generation with dpnp on Intel CPUs and GPUs, backed by oneMKL. Use when NumPy random calls move to dpnp, when a seeded dpnp run does not reproduce a NumPy sequence, when a distribution turns out not to be implemented, when results have to be reproducible across machines, or when random data feeds a training or augmentation loop. Covers the supported distributions, what seeding does and does not guarantee, the host fallback, and where to generate data so it does not bounce between host and device.

Visão geral

Publicado porintel
Repositórioskills
Nome da habilidadedpnp-random
Estrelas
31
Forks
14
Arquivos incluídos
2
LicençaApache-2.0
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • 2 arquivos incluídos

    Scripts, modelos de documentos e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente leitura e nunca são executados.

  • Código aberto

    Publicada por intel no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Dpnp Random no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/intel/skills/tree/main/skills/dpnp-random
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse 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-random .claude/skills/dpnp-random
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Dpnp Random em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Dpnp Random automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Dpnp Random não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

dpnp random number generation

Purpose

Generates random data with dpnp.random, which is backed by oneMKL on Intel CPUs and GPUs and mirrors the NumPy API for the distributions it implements. Covers what is implemented, what seeding actually guarantees, how to fall back to NumPy for a missing distribution, and how to keep generation from becoming a stream of host-device copies.

The reproducibility part is the reason this skill exists: the API looks like NumPy's and the numbers are different, which is correct behaviour and reliably surprises people.

When to Use This Skill

Use this skill when:

  • NumPy random calls are being moved to dpnp.
  • A seeded dpnp run does not reproduce a seeded NumPy run.
  • A distribution raises NotImplementedError or is missing.
  • Results must be reproducible across machines or devices.
  • Random data feeds a training loop, dropout, augmentation, or an initializer.

Do not use this skill when the arrays are small — NumPy is the better answer there — and do not use it to claim a generation speedup: there are no measured numbers here.

Quick Start

python
import dpnp

dpnp.random.seed(42)
x = dpnp.random.randn(1000, 1000)             # standard normal
y = dpnp.random.uniform(0, 1, size=10000)     # uniform [0, 1)
z = dpnp.random.randint(0, 100, size=500)     # integers [0, 100)

Seeding twice with the same value on the same device reproduces the same sequence. It does not reproduce NumPy's sequence — see the Guide.

Implementation Guide

  1. Use the NumPy spelling for what is implemented. rand, randn, random, uniform, normal, randint, choice, shuffle, and the common univariate distributions — exponential, poisson, binomial, geometric, gamma, beta — keep their NumPy signatures. Confirm the specific one against the installed release rather than a remembered list.

  2. Set the seed once, at the top. Reseeding inside a loop resets generator state on every iteration and produces neither speed nor determinism:

    python
    dpnp.random.seed(42)
    noise = dpnp.random.randn(1000, 256, 256)      # one call, all iterations
    for index in range(1000):
        image = clean + noise[index]
  3. Do not expect NumPy's numbers. dpnp.random and numpy.random use different generators — oneMKL's on one side, NumPy's PCG64 on the other — so the same seed gives different sequences. This is expected, not a bug, and it means a reproducibility chain must not mix the two:

    python
    import numpy
    
    numpy.random.seed(42)
    dpnp.random.seed(42)
    # numpy.random.randn(5) and dpnp.random.randn(5) do not match, by design
  4. Fall back on the host for a missing distribution. Generate with NumPy, then move the batch across once — the cost is the transfer, so make the batch large:

    python
    host = numpy.random.beta(a=2.0, b=5.0, size=100_000)
    device_array = dpnp.array(host)
    result = dpnp.mean(device_array ** 2)

    Distributions commonly missing include the multivariate ones — dirichlet, multivariate_normal, multinomial — and several of the long tail such as chisquare, triangular, vonmises, wald, zipf. Check before promising one.

  5. Persist the draw when a result has to be reproducible elsewhere. Seeding guarantees a sequence on the same device and release; a different device type, or a different version, may produce a different one. When an experiment has to be replayed exactly, save the numbers rather than the seed — through NumPy, because dpnp has no binary writer of its own:

    python
    dpnp.random.seed(42)
    numpy.save("random_state.npy", dpnp.asnumpy(dpnp.random.randn(1_000_000)))
    later = dpnp.array(numpy.load("random_state.npy"))
  6. Generate where the data is consumed. Random values that feed device compute should be drawn on the device; values that immediately go back to the host should be drawn with NumPy. Offsets for a crop, a dropout mask, or an initializer belong on the device:

    python
    def dropout(x, p=0.5, training=True):
        if not training:
            return x
        mask = dpnp.random.rand(*x.shape) > p
        return x * mask / (1 - p)

Performance

No measured numbers ship with this skill. Generation is memory-bandwidth bound rather than compute bound, which shapes what is worth measuring:

  • There is a size below which kernel launch overhead dominates and NumPy wins. It is in the thousands of elements, not the millions; measure the real shapes.
  • The first call pays for plan creation, and later calls of the same size reuse it. Warm up before timing, and never time a reseeded loop.
  • One large draw beats many small ones, because the fixed cost is paid once.
  • A host fallback costs a transfer per batch. Batch size, not distribution, is what makes that acceptable.

Gotchas & Limitations

  • Same seed, different numbers from NumPy. Different generator, by design. A test that compares sequences across the two libraries is testing the wrong thing; compare distributions or statistics instead.
  • Reseeding in a loop is the classic mistake. It is slower and it does not make anything more deterministic.
  • Cross-device reproducibility is not guaranteed. Same seed on the same device reproduces; CPU versus GPU may not, and neither may two dpnp releases.
  • dpnp has no binary save. Persisting a draw goes through numpy.save(dpnp.asnumpy(...)); see dpnp-io.
  • Coverage claims expire. Any list of supported or unsupported distributions describes one release. Check dir(dpnp.random) and the documentation.
  • Not covered: parallel independent streams, counter-based generator state, and the Generator/default_rng object API.

References

FileLoad it when
references/official-sources.mdyou need the distributions a specific dpnp release implements, the oneMKL generator behind them, or NumPy's own generator semantics to explain a difference

Two questions here should not be answered from memory: which distributions the installed release implements and which generator oneMKL uses for a given call, which is what makes a cross-library difference explainable instead of suspicious.

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Dpnp Random faz?

Random number generation with dpnp on Intel CPUs and GPUs, backed by oneMKL. Use when NumPy random calls move to dpnp, when a seeded dpnp run does not reproduce a NumPy sequence, when a distribution turns out not to be implemented, when results have to be reproducible across machines, or when random data feeds a training or augmentation loop. Covers the supported distributions, what seeding does and does not guarantee, the host fallback, and where to generate data so it does not bounce between host and device.

Por que usar Dpnp Random no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Dpnp Random é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Dpnp Random no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/intel/skills/tree/main/skills/dpnp-random. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Dpnp Random?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Dpnp Random?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Dpnp Random com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Dpnp Random é gratuita?

Sim. A habilidade é publicada no GitHub por intel sob a licença Apache-2.0. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇