All Projects → altimesh → Hybridizer Basic Samples

altimesh / Hybridizer Basic Samples

Licence: mit
Examples of C# code compiled to GPU by hybridizer

Projects that are alternatives of or similar to Hybridizer Basic Samples

Vc
SIMD Vector Classes for C++
Stars: ✭ 985 (+429.57%)
Mutual labels:  parallel, vectorization, avx2, avx512, avx
Wheels
Performance-optimized wheels for TensorFlow (SSE, AVX, FMA, XLA, MPI)
Stars: ✭ 891 (+379.03%)
Mutual labels:  gpu, cuda, optimization, avx2, avx
Umesimd
UME::SIMD A library for explicit simd vectorization.
Stars: ✭ 66 (-64.52%)
Mutual labels:  vectorization, avx2, avx512, avx
Simde
Implementations of SIMD instruction sets for systems which don't natively support them.
Stars: ✭ 1,012 (+444.09%)
Mutual labels:  vectorization, avx2, avx512, avx
Boost.simd
Boost SIMD
Stars: ✭ 238 (+27.96%)
Mutual labels:  vectorization, avx2, avx512, avx
ultra-sort
DSL for SIMD Sorting on AVX2 & AVX512
Stars: ✭ 29 (-84.41%)
Mutual labels:  parallel, avx2, vectorization, avx512
Sleef
SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
Stars: ✭ 353 (+89.78%)
Mutual labels:  vectorization, cuda, avx512, avx
Ilgpu
ILGPU JIT Compiler for high-performance .Net GPU programs
Stars: ✭ 374 (+101.08%)
Mutual labels:  compiler, parallel, gpu, cuda
Nsimd
Agenium Scale vectorization library for CPUs and GPUs
Stars: ✭ 138 (-25.81%)
Mutual labels:  cuda, avx2, avx512, avx
Neanderthal
Fast Clojure Matrix Library
Stars: ✭ 927 (+398.39%)
Mutual labels:  gpu, vectorization, cuda
Quadray Engine
Realtime raytracer using SIMD on ARM, MIPS, PPC and x86
Stars: ✭ 13 (-93.01%)
Mutual labels:  avx2, avx512, avx
Xsimd
C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, NEON, AVX512)
Stars: ✭ 964 (+418.28%)
Mutual labels:  vectorization, avx512, avx
Numba
NumPy aware dynamic Python compiler using LLVM
Stars: ✭ 7,090 (+3711.83%)
Mutual labels:  compiler, parallel, cuda
Libxsmm
Library for specialized dense and sparse matrix operations, and deep learning primitives.
Stars: ✭ 518 (+178.49%)
Mutual labels:  avx2, avx512, avx
Unisimd Assembler
SIMD macro assembler unified for ARM, MIPS, PPC and x86
Stars: ✭ 63 (-66.13%)
Mutual labels:  avx2, avx512, avx
Osaca
Open Source Architecture Code Analyzer
Stars: ✭ 162 (-12.9%)
Mutual labels:  avx2, avx512, avx
Ctranslate2
Fast inference engine for OpenNMT models
Stars: ✭ 140 (-24.73%)
Mutual labels:  cuda, avx2, avx
Asm Dude
Visual Studio extension for assembly syntax highlighting and code completion in assembly files and the disassembly window
Stars: ✭ 3,898 (+1995.7%)
Mutual labels:  visual-studio, avx2, avx512
Futhark
💥💻💥 A data-parallel functional programming language
Stars: ✭ 1,641 (+782.26%)
Mutual labels:  compiler, gpu, cuda
Simd
C++ image processing and machine learning library with using of SIMD: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX-512, VMX(Altivec) and VSX(Power7), NEON for ARM.
Stars: ✭ 1,263 (+579.03%)
Mutual labels:  avx2, avx512, avx

Hybridizer Essentials is a compiler targeting CUDA-enabled GPUS from .Net. Using parallelization patterns, such as Parallel.For, or ditributing parallel work by hand, the user can benefit from the compute power of GPUS without entering the learning curve of CUDA, all within Visual Studio.

hybridizer-basic-samples

This repo illustrates a few samples for Hybridizer

These samples may be used with Hybridizer Essentials. However, C# code can run with any version of Hybridizer. They illustrate features of the solution and are a good starting point for experimenting and developing software based on Hybridizer.

All new code is added to the repo of the latest CUDA version (currently 10.0). Older CUDA versions are still supported, but don't get the new samples.

WARNING

CUDA 9/9.1/9.2 and the latest update of visual studio do not work together (v141 toolset). see devtalk.nvidia.com. Install the v140 toolset before trying to compile samples with visual 2017, or use CUDA 10.0

Requirements

Before you start, you first need to check if you have the right environment. You need an install of Visual Studio (2012 or later). You need a CUDA-enabled GPU and CUDA (8.0 or later) installed (with the CUDA driver). Obviously, you need to install Hybridizer Essentials.

Run

Checkout repository, and open Visual Studio. Require and validate license from Hybridizer->License Settings Tool window. Open HybridizerBasicSamples solution. Build solution and run example of your choice. After an update, you might need to reload the solution.

Example

using System;
using System.Linq;
using System.Threading.Tasks;

using Hybridizer.Runtime.CUDAImports;

namespace HybridizerExample
{
    class Program
    {
        [EntryPoint]
        public static void Add(float[] a, float[] b, int N)
        {
            Parallel.For(0, N, i => a[i] += b[i]);
        }

        static void Main(string[] args)
        {
            // Arrange
            const int N = 1024 * 1024 * 32;
            float[] a = Enumerable.Range(0, N).Select(i => (float)i).ToArray();
            float[] b = Enumerable.Range(0, N).Select(i => 1.0F).ToArray();

            // Run
            HybRunner.Cuda().Wrap(new Program()).Add(a, b, N);

            cuda.DeviceSynchronize();


            // Assert
            for(int i = 0; i < N; ++i)
            {
                if(a[i] != (float)i + 1.0F)
                {
                    Console.Error.WriteLine("Error at {0} : {1} != {2}", i, a[i], (float)i + 1.0F);
                    Environment.Exit(6); // abort
                }
            }

            Console.Out.WriteLine("OK");
        }
    }
}
hybridizer-cuda Program.cs -o a.exe -run

OK

Documentation

Samples are explained in the wiki.

You can find API documentation in our DocFX generated documentation

Notes

After building the csproj, you have to build the generated vcxproj manually or put it in your build dependencies using the configuration manager. After installing an update, you may need to unload/reload the solution, or even close and restart visual studio.

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].