Amplifier.NET
0.4.2
See the version list below for details.
dotnet add package Amplifier.NET --version 0.4.2
NuGet\Install-Package Amplifier.NET -Version 0.4.2
<PackageReference Include="Amplifier.NET" Version="0.4.2" />
paket add Amplifier.NET --version 0.4.2
#r "nuget: Amplifier.NET, 0.4.2"
// Install Amplifier.NET as a Cake Addin #addin nuget:?package=Amplifier.NET&version=0.4.2 // Install Amplifier.NET as a Cake Tool #tool nuget:?package=Amplifier.NET&version=0.4.2
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
- 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);
}
- 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);
}
- 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:
Documentation
Coming soon....
Any contribution is welcome
Product | Versions 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. |
-
.NETFramework 4.6
- ICSharpCode.Decompiler (>= 4.0.0.4521)
-
.NETStandard 2.0
- ICSharpCode.Decompiler (>= 4.0.0.4521)
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.