Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enp1s0/curand_fp16
FP16 pseudo random number generator on GPU
https://github.com/enp1s0/curand_fp16
cuda gpu half-precision random-number-generators
Last synced: about 2 months ago
JSON representation
FP16 pseudo random number generator on GPU
- Host: GitHub
- URL: https://github.com/enp1s0/curand_fp16
- Owner: enp1s0
- License: mit
- Created: 2022-01-10T05:22:38.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-08T10:12:09.000Z (over 1 year ago)
- Last Synced: 2024-12-20T00:53:04.259Z (about 2 months ago)
- Topics: cuda, gpu, half-precision, random-number-generators
- Language: Cuda
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# curand_fp16
A library for generating pseudo random FP16 numbers
## Throughput
## Requirements
- C++ >= 17
- cmake >= 3.18
- CUDA
- cuRAND## Supported algorithms
- XORWOW
- MRG32K3A
- PHILOX4_32_10## Build
```
mkdir build
cd build
cmake .. --DCMAKE_INSTALL_PREFIX=/path/to/install
make -j4
make install
```## Sample codes
```cpp
// main.cu
// nvcc -std=c++14 -I/path/to/include -L/path/to/lib main.cu -lcurand_fp16
#includeconstexpr std::size_t N = 1lu << 30;
constexpr auto rng = CURAND_RNG_PSEUDO_XORWOW;int main() {
half* ptr;
cudaMallocManaged(&ptr, sizeof(half) * N);mtk::curand_fp16::generator_t generator;
mtk::curand_fp16::create(generator, rng);
mtk::curand_fp16::set_seed(generator, 0);mtk::curand_fp16::uniform(generator, ptr, N, pm);
mtk::curand_fp16::destroy(generator);
cudaFree(ptr);
}
```See [tests](./tests/) for more.
## License
MIT