Removed BenchmarkDotNet, switched to manual
このコミットが含まれているのは:
1 親
0caff1f479
コミット
df032526f3
3ファイル変更
+38
-8
検索条件に一致するファイルはありません
@@ -5,10 +5,6 @@
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -17,17 +17,17 @@ namespace ComputeSharp.Benchmark
|
||||
/// <summary>
|
||||
/// The nummber of rows in the <see cref="X"/> matrix
|
||||
/// </summary>
|
||||
private const int N = 100;
|
||||
private const int N = 128;
|
||||
|
||||
/// <summary>
|
||||
/// The number of columns in the <see cref="X"/> matrix (same as the number of rows in the <see cref="W"/> matrix)
|
||||
/// </summary>
|
||||
private const int M = 100;
|
||||
private const int M = 128;
|
||||
|
||||
/// <summary>
|
||||
/// The number of columns in the <see cref="W"/> matrix
|
||||
/// </summary>
|
||||
private const int P = 100;
|
||||
private const int P = 128;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor
|
||||
@@ -81,5 +81,15 @@ namespace ComputeSharp.Benchmark
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the CPU
|
||||
/// </summary>
|
||||
public void Cpu() => Dnn.FullyConnectedForwardCpu(C, N, M, P, X, W, B, Y);
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the GPU
|
||||
/// </summary>
|
||||
public void Gpu() => Dnn.FullyConnectedForwardGpu(C, N, M, P, X, W, B, Y);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Benchmark
|
||||
{
|
||||
@@ -6,7 +7,30 @@ namespace ComputeSharp.Benchmark
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
var benchmark = new FullyConnectedLayerBenchmark();
|
||||
benchmark.Gpu(); // Warmup
|
||||
return;
|
||||
|
||||
Stopwatch timer = new Stopwatch();
|
||||
TimeSpan cpuTime = TimeSpan.Zero, gpuTime = TimeSpan.Zero;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
benchmark.Cpu();
|
||||
cpuTime += timer.Elapsed;
|
||||
Console.WriteLine($"CPU: {timer.Elapsed:g}");
|
||||
timer.Restart();
|
||||
benchmark.Gpu();
|
||||
gpuTime += timer.Elapsed;
|
||||
Console.WriteLine($"GPU: {timer.Elapsed:g}");
|
||||
timer.Restart();
|
||||
}
|
||||
|
||||
Console.WriteLine("======== AVERAGE ========");
|
||||
Console.WriteLine($"CPU: {cpuTime:g}");
|
||||
Console.WriteLine($"GPU: {gpuTime:g}");
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする