All Projects → jgbit → Vuda

jgbit / Vuda

Licence: mit
VUDA is a header-only library based on Vulkan that provides a CUDA Runtime API interface for writing GPU-accelerated applications.

Projects that are alternatives of or similar to Vuda

Soul Engine
Physically based renderer and simulation engine for real-time applications.
Stars: ✭ 37 (-90.08%)
Mutual labels:  vulkan, cuda
Slang
Making it easier to work with shaders
Stars: ✭ 627 (+68.1%)
Mutual labels:  vulkan, cuda
Floor
A C++ Compute/Graphics Library and Toolchain enabling same-source CUDA/Host/Metal/OpenCL/Vulkan C++ programming and execution.
Stars: ✭ 166 (-55.5%)
Mutual labels:  vulkan, cuda
Ktt
Kernel Tuning Toolkit
Stars: ✭ 33 (-91.15%)
Mutual labels:  vulkan, cuda
CPP-Programming
Various C/C++ examples. DirectX, OpenGL, CUDA, Vulkan, OpenCL.
Stars: ✭ 30 (-91.96%)
Mutual labels:  vulkan, cuda
Cudahandbook
Source code that accompanies The CUDA Handbook.
Stars: ✭ 345 (-7.51%)
Mutual labels:  cuda
K2
FSA/FST algorithms, differentiable, with PyTorch compatibility.
Stars: ✭ 354 (-5.09%)
Mutual labels:  cuda
Bayadera
High-performance Bayesian Data Analysis on the GPU in Clojure
Stars: ✭ 342 (-8.31%)
Mutual labels:  cuda
Rspirv
Rust implementation of SPIR-V module processing functionalities
Stars: ✭ 332 (-10.99%)
Mutual labels:  vulkan
Libsgm
Stereo Semi Global Matching by cuda
Stars: ✭ 368 (-1.34%)
Mutual labels:  cuda
Quartz
Vulkan RTX path tracer with a declarative ES7-like scene description language.
Stars: ✭ 367 (-1.61%)
Mutual labels:  vulkan
Tutorials
Some basic programming tutorials
Stars: ✭ 353 (-5.36%)
Mutual labels:  cuda
Nimtorch
PyTorch - Python + Nim
Stars: ✭ 346 (-7.24%)
Mutual labels:  cuda
Realsr Ncnn Vulkan
RealSR super resolution implemented with ncnn library
Stars: ✭ 357 (-4.29%)
Mutual labels:  vulkan
Mango
mango fun framework
Stars: ✭ 343 (-8.04%)
Mutual labels:  vulkan
Loopy
A code generator for array-based code on CPUs and GPUs
Stars: ✭ 367 (-1.61%)
Mutual labels:  cuda
Magnum
Lightweight and modular C++11 graphics middleware for games and data visualization
Stars: ✭ 3,728 (+899.46%)
Mutual labels:  vulkan
Sleef
SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
Stars: ✭ 353 (-5.36%)
Mutual labels:  cuda
Cuda Api Wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Stars: ✭ 362 (-2.95%)
Mutual labels:  cuda
Vulkan Kompute
General purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases.
Stars: ✭ 350 (-6.17%)
Mutual labels:  vulkan

VUDA

VUDA is a header-only library based on Vulkan that provides a CUDA Runtime API interface for writing GPU-accelerated applications.

Documentation

VUDA is based on the Vulkan API. The functionality of VUDA conforms (as much as possible) to the specification of the CUDA runtime. For normal usage consult the reference guide for the NVIDIA CUDA Runtime API, otherwise check the VUDA wiki:

Usage

All VUDA functionality can be accessed by including vuda.hpp and using its namespace vuda::. Alternatively, one can utilize vuda_runtime.hpp which wraps and redirect all CUDA functionality.

#if defined(__NVCC__)
    #include <cuda_runtime.h>
#else
    #include <vuda_runtime.hpp>
#endif

int main(void)
{
    // assign a device to the thread
    cudaSetDevice(0);
    // allocate memory on the device
    const int N = 5000;
    int a[N], b[N], c[N];
    for(int i = 0; i < N; ++i)
    {
        a[i] = -i;
        b[i] = i * i;
    }
    int *dev_a, *dev_b, *dev_c;
    cudaMalloc((void**)&dev_a, N * sizeof(int));
    cudaMalloc((void**)&dev_b, N * sizeof(int));
    cudaMalloc((void**)&dev_c, N * sizeof(int));
    // copy the arrays a and b to the device
    cudaMemcpy(dev_a, a, N * sizeof(int), cudaMemcpyHostToDevice);
    cudaMemcpy(dev_b, b, N * sizeof(int), cudaMemcpyHostToDevice);
    // run kernel (vulkan shader module)
    const int blocks = 128;
    const int threads = 128;
#if defined(__NVCC__)
    add<<<blocks, threads>>>(dev_a, dev_b, dev_c, N);
#else
    const int stream_id = 0;
    vuda::launchKernel("add.spv", "main", stream_id, blocks, threads, dev_a, dev_b, dev_c, N);
#endif
    // copy result to host
    cudaMemcpy(c, dev_c, N * sizeof(int), cudaMemcpyDeviceToHost);

    // do something useful with the result in array c ...        

    // free memory on device
    cudaFree(dev_a);
    cudaFree(dev_b);
    cudaFree(dev_c);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].