Perfomance Good

This commit is contained in:
Elias Stepanik 2022-10-28 08:55:55 +02:00
parent 653e85ce83
commit f50dd3be04
4 changed files with 4 additions and 11 deletions

View File

@ -1,5 +1,4 @@
using System.Numerics; using System.Numerics;
using Hybridizer.Runtime.CUDAImports;
using Raylib_CsLo; using Raylib_CsLo;
using static Raylib_CsLo.RayMath; using static Raylib_CsLo.RayMath;
@ -61,9 +60,7 @@ public class Fluid
diffuse(2, Vy0, Vy, visc, dt); diffuse(2, Vy0, Vy, visc, dt);
project(Vx0, Vy0, Vx, Vy); project(Vx0, Vy0, Vx, Vy);
HybRunner runner = HybRunner.Cuda().SetDistrib(32, 32, 16, 16, 1, 0); advect(this, 1, Vx, Vx0, Vx0, Vy0, dt);
wrapper = runner.Wrap(new Game());
wrapper.Run(wrapper.advect(this,1, Vx, Vx0, Vx0, Vy0, dt));
advect(this,2, Vy, Vy0, Vx0, Vy0, dt); advect(this,2, Vy, Vy0, Vx0, Vy0, dt);
project(Vx, Vy, Vx0, Vy0); project(Vx, Vy, Vx0, Vy0);
@ -192,9 +189,6 @@ public class Fluid
set_bnd(2, velocY); set_bnd(2, velocY);
} }
[EntryPoint("run")]
public void advect(Fluid fluid,int b, float[] d, float[] d0, float[] velocX, float[] velocY, float dt) { public void advect(Fluid fluid,int b, float[] d, float[] d0, float[] velocX, float[] velocY, float dt) {
float i0, i1, j0, j1; float i0, i1, j0, j1;

View File

@ -7,8 +7,8 @@ namespace PixelEngine;
public class Game public class Game
{ {
private const int Size = 64; private const int Size = 256;
private const int Scale = 10; private const int Scale = 2;
private const int Iter = 10; private const int Iter = 10;
private const float Dt = 0.2f; private const float Dt = 0.2f;
private const float Diffusion = 0f; private const float Diffusion = 0f;

View File

@ -9,9 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Altimesh.Hybridizer.Runtime.CUDAImports" Version="2.0.0" />
<PackageReference Include="Raylib-CsLo" Version="4.2.0.3" /> <PackageReference Include="Raylib-CsLo" Version="4.2.0.3" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -15,6 +15,7 @@ game.PMouse = GetMousePosition();
game.Start(); game.Start();
while (!WindowShouldClose()) while (!WindowShouldClose())
{ {
game.HandleInput(); game.HandleInput();