Skip to main content

Setup & Installation

This tutorial gets you from zero to a working Hybridizer environment. By the end, you'll have compiled and run your first GPU-accelerated build.

Hybridizer supports Windows and Linux, using .NET 8 (or later).

Prerequisites

ComponentMinimumRecommended
OSWindows 10 x64 / Ubuntu 22.04Windows 11 x64 / Ubuntu 24.04
.NET SDK.NET 8.0.NET 8.0 (latest patch)
GPUAny NVIDIA (Compute ≥ 5.0)RTX 2060 or newer
RAM8 GB16 GB
Disk10 GB freeSSD recommended

Step 1: Install NVIDIA Drivers

  1. Go to nvidia.com/drivers or open NVIDIA GeForce Experience
  2. Download and install the latest driver
  3. Verify:
nvidia-smi

You should see your GPU name, driver version, and CUDA version:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 560.xx Driver Version: 560.xx CUDA Version: 12.6 |
|-------------------------------+----------------------+----------------------+
| GPU Name | ... | |
| GeForce RTX 4070 | ... | |
+-------------------------------+----------------------+----------------------+

Step 2: Install CUDA Toolkit

Download from developer.nvidia.com/cuda-downloads.

  1. Choose Windows → x86_64 → exe (local)
  2. Run the installer — default options are fine
  3. Verify:
nvcc --version
tip

If nvcc is not found, add C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.x\bin to your system PATH.

Expected output:

nvcc: NVIDIA (R) Cuda compiler driver
Cuda compilation tools, release 12.x, V12.x.xxx

Step 3: Install .NET 8 SDK

Download and install from dotnet.microsoft.com/download.

Alternatively, if using Visual Studio 2022 (17.8+), .NET 8 is included with the .NET desktop development workload.

Step 4: Install a C++ Toolchain

Hybridizer generates C++ code that needs to be compiled by nvcc and a host C++ compiler.

Install Visual Studio 2022 with the following workloads:

  • .NET desktop development
  • Desktop development with C++ (provides MSVC, needed by nvcc)

Or install the Build Tools for Visual Studio (lighter, no IDE).

Step 5: Install Hybridizer

Create a new .NET 8 console project and add the Hybridizer packages:

dotnet new console -n MyFirstHybridizer --framework net8.0
cd MyFirstHybridizer
dotnet add package Hybridizer.Runtime.CUDAImports
tip

On Windows with Visual Studio, you can also install the Hybridizer Community Edition extension from the Visual Studio Marketplace for integrated project templates.

Step 6: Verify Your Setup

Replace the content of Program.cs with:

using System;
using Hybridizer.Runtime.CUDAImports;

class Program
{
[EntryPoint]
public static void TestKernel(int[] output, int N)
{
for (int i = threadIdx.x + blockDim.x * blockIdx.x;
i < N;
i += blockDim.x * gridDim.x)
{
output[i] = i * 2;
}
}

static void Main()
{
// Check GPU
cuda.GetDeviceProperties(out cudaDeviceProp prop, 0);
Console.WriteLine($"GPU: {new string(prop.name)}");
Console.WriteLine($"SMs: {prop.multiProcessorCount}");
Console.WriteLine($"Memory: {prop.totalGlobalMem / (1024*1024)} MB");

// Run kernel
int N = 1024;
int[] output = new int[N];

dynamic wrapper = HybRunner.Cuda()
.SetDistrib(32, 256);
wrapper.TestKernel(output, N);
cuda.DeviceSynchronize();

// Verify
bool ok = true;
for (int i = 0; i < N; i++)
{
if (output[i] != i * 2) { ok = false; break; }
}

Console.WriteLine(ok ? "✅ Hybridizer is working!" : "❌ Something went wrong");
}
}

Build and run:

dotnet build
dotnet run

Expected output:

GPU: NVIDIA GeForce RTX 4070
SMs: 46
Memory: 12282 MB
✅ Hybridizer is working!

Troubleshooting

ProblemSolution
nvidia-smi not foundInstall/update NVIDIA drivers
nvcc not foundReinstall CUDA Toolkit, check PATH
dotnet not foundInstall .NET 8 SDK
Build error "Hybridizer not found"Verify NuGet package: dotnet list package
Runtime "No CUDA device"Check GPU with nvidia-smi, update drivers
libcudart.so not found (Linux)Set LD_LIBRARY_PATH to CUDA lib directory
DLL not found at runtime (Windows)Ensure CUDA bin directory is in PATH

Next

You're ready! Proceed to Your First Kernel →