lshqqytiger / ZLUDA

CUDA on AMD GPUs
Apache License 2.0
297 stars 39 forks source link

Feature Request, get Zluda to work on iber Hydrologic and Hydraulic 2D modelling software #48

Open Crones8 opened 1 month ago

Crones8 commented 1 month ago

So, when using the Hydrologic and Hydraulic modelling 2D software Iber, there are some modules that speed up processing time significantly, using GPU. These modules or plug-ins are called R-Iber and IberPlus (in Iber_Tools window), however, these plug-ins, only work with nVidia cards. Tried using Zluda to get it to work on my 6800 XT, on different versions of Iber, 3.2.2, 3.3, 3.1, not a lot of success there. On Iber 3.1 it won't even load, it will finish the calculations prematurely (even though GPU is identified), in 3.2.2 and 3.3, the model runs for a little while, but then it hangs, and it stops calculating.

So anyways, this would be a great help.

Cheers, and thank you for all the hard work.

lshqqytiger commented 1 month ago

The software does not seem to be powered by CUDA, but OpenGL. If there is CUDA mode, please let me know how to reproduce the problems you had.

Crones8 commented 1 month ago

Hello,

Actually, it uses both, I believe it uses OpenGL for Graphical purposes (maybe postprocessing also), however calculations in R-Iber (Rapid Iber) and Iberplus are made through CUDA, check these papers for further information:

https://doi.org/10.1016/j.envsoft.2023.105628 https://doi.org/10.3390/w10101459

Anyways, I get these hangs in Iber 3.1 for AMD 6800 XT (actually it doesn't hang, but it won't even start processing and finishes process early) but not for RTX 3050 Laptop (in Iber 3.2.2 Model hangs in both GPUs):

Iber3 1 Zluda Hangs

iber3 1 3050 works1

iber3 1 3050 works2

To get Iber 3.1 here is the link (free softwatre): https://iberaula.es/1152/iber-model/version-repository

Model which was used is in this link: https://1drv.ms/f/s!AnLXxRasc_tL2BPx8-7eUIRPvUr3?e=PQPRZk

To get it to calculate with GPU, in the software, after you open the model, you have to go to Iber_Tools>Plug-ins then on "Select GPU parallelization", check the R-Iber box.

image

Any other thing you need, please do tell.

Cheers and thank you.

To get it complete, I'all also add the hang in Iber 3.2.2, which happens in both GPUs, though this is a problem with changing versions of the software and not the GPUs, since it prompts errors loading the model on Iber 3.2.2, which doesn't happen in Iber 3.1 (the model was developed in 3.1):

Zluda Iber

lshqqytiger commented 1 week ago

Sorry for the late reply. I was quite busy. All I could reveal is that the magic number that the fatbin wrapper holds is being changed for unknown reasons. I need to compare how it's going in the original CUDA. Unfortunately, however, I don't have an NVIDIA card to do so. If you are willing to dump CUDA logs and kernels, please follow troubleshooting manual (see dumper) and upload the results.

Crones8 commented 5 days ago

Hello, no problem, will get to it during this week possibly.

Crones8 commented 3 days ago

Hello Ishqytiger,

So, I'm not sure I'm doing this correctly since it didn't work.

Set Environment variable like this:

image

then tried this command in cmd Powershel:

image

Program started, so I started running the simulation, and it started working correctly:

image

Did notice that simulation was going much slower than usual when using the GPU normally without Zluda.

Finally, stopped the process and closed the program, so as to return to the powershell, however it seems it didn't work, since I Saw no special lines written in PowerShell, the folder "C:\temp\zluda_dump" was not created, and obviusly, no log file was created.

Please help.

Cheers and thank you.

lshqqytiger commented 3 days ago

Did you create zluda_dump folder? I remember dumper does not create if the path doesn't exist.

Crones8 commented 2 days ago

Ok,

So now it worked, after I created the folder, was confused, since tthe instructions said that if the folder wasn't created, it would be created:

image

Anyways, here are the files.

RIber.exe.zip

Cheers and thank you.

lshqqytiger commented 1 day ago

I found out the reason. Iber uses two different kind (version) of CUDA fatbin. One is supported, another one (known as old-style) is unsupported by ZLUDA currently. I'll try to add support of later one. However, as supporting both is not so easy, it might take some time.