TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
philox_fill.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// Fills an array with draws 0..n-1 of the RNG stream (seed, stage, item).
4//
5// The first GPU kernel and its CPU reference. It proves the toolchain end to end and establishes the
6// equivalence-test pattern every later kernel follows: same inputs, bit-identical outputs.
7#include <cstdint>
8#include <string>
9#include <vector>
10
11namespace tmk::gpu {
12
13std::vector<std::uint64_t> philox_fill_cpu(std::uint64_t seed, std::uint32_t stage, std::uint64_t item,
14 std::size_t n);
15
16struct GpuStatus {
17 bool ok = false;
18 std::string error; // why the GPU path was not used; the caller falls back to the CPU path
19};
20
21// GPU version. On failure (no CUDA, not enough free memory, launch error) returns !ok and leaves `out` empty.
22GpuStatus philox_fill_cuda(int cuda_index, std::uint64_t seed, std::uint32_t stage, std::uint64_t item, std::size_t n,
23 std::vector<std::uint64_t>& out);
24
25} // namespace tmk::gpu
GpuStatus philox_fill_cuda(int cuda_index, std::uint64_t seed, std::uint32_t stage, std::uint64_t item, std::size_t n, std::vector< std::uint64_t > &out)
GPU version. On failure (no CUDA, not enough free memory, launch error) returns !ok and leaves out em...
std::vector< std::uint64_t > philox_fill_cpu(std::uint64_t seed, std::uint32_t stage, std::uint64_t item, std::size_t n)
std::string error
why the GPU path was not used; the caller falls back to the CPU path