A compiler for NET CIL for GP-GPU computing in .NET languages.
Clone or download
kaby76 (1) Adding in Oceania's test. (2) Adding in System.Private.CoreLib fr…
…om coreclr. Note, the CoreLib code needs to be rewritten so as in all C#, as much as possible, for portability to AMD.
Latest commit 7ee5e21 Oct 6, 2018
Permalink
Failed to load latest commit information.
Campy.Compiler Release 0.0.15 of Campy. Sep 27, 2018
Campy.Find Release 0.0.15 of Campy. Sep 27, 2018
Campy.Graphs Changes for switch CIL instruction. Aug 31, 2018
Campy.Meta Release 0.0.15 of Campy. Sep 27, 2018
Campy.Peek Release 0.0.15 of Campy. Sep 27, 2018
Campy.Runtime (1) Adding in Oceania's test. (2) Adding in System.Private.CoreLib fr… Oct 6, 2018
Campy.Utils Release 0.0.15 of Campy. Sep 27, 2018
Campy Release 0.0.15 of Campy. Sep 27, 2018
ConsoleApp1 Release 0.0.15 of Campy. Sep 27, 2018
ConsoleApp4 Release 0.0.15 of Campy. Sep 27, 2018
Tests (1) Adding in Oceania's test. (2) Adding in System.Private.CoreLib fr… Oct 6, 2018
nuget Release 0.0.15 of Campy. Sep 27, 2018
.gitignore Checkpoint. Getting Net Core applications working with Campy--needed … Apr 18, 2018
Campy.sln (1) Adding in Oceania's test. (2) Adding in System.Private.CoreLib fr… Oct 6, 2018
Campy.sln.DotSettings.user Changing to simple WriteLine(). Code works until it reaches string Le… Aug 25, 2018
README.md Stubs added for locking in tree table of valid managed pointers. Sep 23, 2018
Runtime.sln (1) Rolling forward to swigged.cuda 9.2148.2. (2) Replacing Window __… Sep 22, 2018
clean-completely.sh Clean up. Sep 2, 2018
demo.sh Upgrading to Net Core 2.1 as 2.0 will be unsupported (https://blogs.m… Jun 28, 2018
kens-campy-link-9-1.sh Moving forward to swigged.cuda 9.185.8 because 9.185.7 is messed up o… Jun 7, 2018
kens-campy-nvcc-9-1.sh Moving forward to swigged.cuda 9.185.8 because 9.185.7 is messed up o… Jun 7, 2018
license Adding license. Mar 26, 2018

README.md

Campy

Welcome! Campy is a compiler, framework, and API for GP-GPU computing in .NET languages. With Campy, one writes GP-GPU code without the usual boilerplate code you see in CUDA/OpenCL, but instead use a simplified model of a multiprocessor GPU/CPU computer, freeing the developer to focus exclusively on the algorithm. The API compiles and runs CIL code into native GPU code using LLVM. Supported are value types, reference types, methods, generics, lambdas, delegates, and closures. Other C#/GPU projects exist, but do not offer a clean, boilerplate-free interface, nor support C# beyond value types. Campy provides a base class library (BCL) for the GPU, implementing strings, arrays, generics, exceptions, delegates, dynamically memory allocation, reflection, and native calls.

This project is in the early stage of development. Releases are currently for demonstration purposes. The only available method is essentially Campy.Parallel.For(), and it will undergo wild changes in signature as I refine the programming model. There are also several debugging output switches (see example below).

public static void Campy.Parallel.For(int number_of_threads, _Kernel_type kernel)
public delegate void Campy.Types._Kernel_type(Index idx);

Targets

  • Windows 10 (x64), Ubuntu 16.04 (x64), Net Framework >= 4.6.1, Net Core 2.0; CUDA GPU Toolkit 9.2.148; Maxwell or better GPU.

Campy under a minute

(Make sure to install Net Core 2.0, https://www.microsoft.com/net/learn/get-started/windows.)

One step install: copy and paste the following code in a Bash shell.


#!/bin/bash
mkdir test
cd test
dotnet new console
cat - << HERE > Program.cs
namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 4;
            int[] x = new int[n];
            Campy.Parallel.For(n, i => x[i] = i);
            for (int i = 0; i < n; ++i)
                System.Console.WriteLine(x[i]);
        }
    }
}
HERE
dotnet add package Campy
dotnet build
unameOut="$(uname -s)"
case "${unameOut}" in
    Linux*)
	dotnet publish -r ubuntu.16.04-x64
	cd bin/Debug/netcoreapp2.1/ubuntu.16.04-x64/publish/
        ./test
	;;
    Darwin*)
	echo Cannot target Mac yet.
	exit 1
	;;
    CYGWIN*)
	dotnet publish -r win-x64
	cd bin/Debug/netcoreapp2.1/win-x64/publish/
        ./test.exe
	;;
    MINGW*)
	dotnet publish -r win-x64
	cd bin/Debug/netcoreapp2.1/win-x64/publish/
        ./test.exe
	;;
    *)
	echo Unknown machine.
	exit 1
	;;
esac
echo Output should be four lines of integers, 0 to 3.
Once an app is "published" as a self-contained deployment, it is completely sufficient.

Additional examples in Campy test area (https://github.com/kaby76/Campy/tree/master/Tests), including Reduction, various sorting algorithms, FFT, etc.

Notes on Building Campy from Scratch

  • Make sure to install VS 2017 15.8.4.
  • Net SDK 2.1.402
  • Make sure to install NVIDIA GPU Toolkit 9.2.148.
  • Through VS 2017, build Runtime.sln DEBUG first. It will prompt to upgrade--do not! Click on cancel and continue.
  • Through VS 2017, build Campy.sln DEBUG.