Amplifier.NET 0.4.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package Amplifier.NET --version 0.4.5
NuGet\Install-Package Amplifier.NET -Version 0.4.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Amplifier.NET" Version="0.4.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Amplifier.NET --version 0.4.5
#r "nuget: Amplifier.NET, 0.4.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Amplifier.NET as a Cake Addin
#addin nuget:?package=Amplifier.NET&version=0.4.5

// Install Amplifier.NET as a Cake Tool
#tool nuget:?package=Amplifier.NET&version=0.4.5

Amplifier.NET

Amplifier allows .NET developers to easily run complex applications with intensive mathematical computation on Intel CPU/GPU, NVIDIA, AMD without writing any additional C kernel code. Write your function in .NET and Amplifier will take care of running it on your favorite hardware.

Below is the sample Kernel you can write in CSharp

[OpenCLKernel]
void add_float([Global]float[] a, [Global] float[] b, [Global]float[] r)
{
    int i = get_global_id(0);
    b[i] = 0.5f * b[i];
    r[i] = a[i] + b[i];
}

[OpenCLKernel]
void Fill([Global] float[] x, float value)
{
    int i = get_global_id(0);

    x[i] = value;
}

Now this kernel will be converted to C99 format which is specific instruction for OpenCL. Let's do some magic to execute the kernel using OpenCL

  1. Create an instance of OpenCL compiler. You can list all the available devices.
var compiler = new OpenCLCompiler();
Console.WriteLine("\nList Devices----");
foreach (var item in compiler.Devices)
{
    Console.WriteLine(item);
}
  1. Select a device by id and load the Sample kernel created.
compiler.UseDevice(0);
compiler.CompileKernel(typeof(SimpleKernels));

Console.WriteLine("\nList Kernels----");
foreach (var item in compiler.Kernels)
{
    Console.WriteLine(item);
}
  1. Declare variable and do some operation which will run on any hardware selected like Intel CPU/GPU, NVIDIA, AMD etc.
Array a = new float[] { 1, 2, 3, 4 };
Array b = new float[4];
Array r = new float[4];

var exec = compiler.GetExec<float>();
exec.Fill(b, 0.5f);
exec.add_float(a, b, r);

Console.WriteLine("\nResult----");
for(int i = 0;i<r.Length;i++)
{
    Console.Write(r.GetValue(i) + " ");
}

Result:

alternate text is missing from this package README image

Documentation

Any contribution is welcome

Please fork the code and suggest improvements by raising PR. Raise issues so that I can make this library robust.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Amplifier.NET:

Package Downloads
SuperchargedArray

An extended version of the Array to accelerate operation, easy to use, multi dimensional. With SuperchargedArray.Accelerated namespace you will unlock SIMD potential to run the Array operation on any hardware like Intel CPU/GPU, NVIDIA, AMD etc.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 600 8/15/2022
1.0.8 995 6/12/2020
0.5.0 1,209 12/30/2019
0.4.7 1,763 6/14/2019
0.4.6 536 6/13/2019
0.4.5 550 6/12/2019
0.4.4 524 6/11/2019
0.4.2 1,332 6/7/2019
0.4.0 702 6/7/2019