Added test for multi GPU
このコミットが含まれているのは:
1 親
666f7e67de
コミット
131bc5fdce
2ファイル変更
+42
-17
検索条件に一致するファイルはありません
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ComputeSharp.Graphics;
|
||||
using ComputeSharp.Graphics.Buffers;
|
||||
using ComputeSharp.NetCore.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ComputeSharp.NetCore.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[TestCategory("Initialization")]
|
||||
public class InitializationTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void CheckIsSupportedAndGetDefaultDevice()
|
||||
{
|
||||
if (Gpu.IsSupported) Assert.IsNotNull(Gpu.Default);
|
||||
else Assert.ThrowsException<NotSupportedException>(() => Gpu.Default);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RunShaderOnAllDevices()
|
||||
{
|
||||
foreach (GraphicsDevice gpu in Gpu.EnumerateDevices())
|
||||
{
|
||||
using (ReadWriteBuffer<float> buffer = gpu.AllocateReadWriteBuffer<float>(100))
|
||||
{
|
||||
Action<ThreadIds> action = id => buffer[id.X] = id.X;
|
||||
|
||||
gpu.For(100, action);
|
||||
|
||||
float[] array = buffer.GetData();
|
||||
float[] expected = Enumerable.Range(0, 100).Select(i => (float)i).ToArray();
|
||||
|
||||
Assert.IsTrue(array.AsSpan().ContentEquals(expected));
|
||||
}
|
||||
|
||||
gpu.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ComputeSharp.NetCore.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[TestCategory("Misc")]
|
||||
public class MiscTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void CheckIsSupportedAndGetDefaultDevice()
|
||||
{
|
||||
if (Gpu.IsSupported) Assert.IsNotNull(Gpu.Default);
|
||||
else Assert.ThrowsException<NotSupportedException>(() => Gpu.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする