ProjectPhysX / FluidX3D

The fastest and most memory efficient lattice Boltzmann CFD software, running on all GPUs via OpenCL. Free for non-commercial use.
https://youtube.com/@ProjectPhysX
Other
3.82k stars 301 forks source link

.stl file voxelization crashes on Windows #14

Closed luckylsk34 closed 1 year ago

luckylsk34 commented 1 year ago

The STL isn't being loaded into lbm for any size greater than .25f*(float)L. The output is simply black with the stats at the bottom right. For size = .25f*(float)L, I can see the STL but it is very small and pixelated.

ProjectPhysX commented 1 year ago

Can you provide me your entire main_setup() {...} function so I can reproduce it?

luckylsk34 commented 1 year ago

Hi @ProjectPhysX, here is a patch file for the changes I made. patch.txt

ProjectPhysX commented 1 year ago

Ah, I know what the problem is! The code itself is fine (just set SUBGRID to keep the Concorde simulation stable).

It's a bug in Windows: Windows on some computers will kill any GPU kernel that runs for longer than 2 seconds, and reset the graphics driver. When you make the Concorde model very small, the stl voxelization kernel only runs for less than 2 seconds and it works fine. But if it's larger it will take longer and crash. This bug has also plagued me for a long time.

The solution: In Windows Registry (Win+R, regedit, Enter) in Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers, create a 32-bit DWORD named TdrDelay and set its decimal value to 300. This increases the threshold to reset the graphics driver from 2 seconds to 5 minutes. Then reboot.

luckylsk34 commented 1 year ago

Thanks! Confirmed that it is working after making the suggested change.