Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Crones8 opened this issue Oct 6, 2024 · 13 comments
Assignees
Labels
implementation Unimplemented feature(s)

Comments

@Crones8
Copy link

Crones8 commented Oct 6, 2024

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
Copy link
Owner

lshqqytiger commented Oct 6, 2024

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
Copy link
Author

Crones8 commented Oct 7, 2024

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 lshqqytiger self-assigned this Oct 7, 2024
@lshqqytiger
Copy link
Owner

lshqqytiger commented Nov 11, 2024

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
Copy link
Author

Crones8 commented Nov 12, 2024

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

@Crones8
Copy link
Author

Crones8 commented Nov 14, 2024

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
Copy link
Owner

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

@Crones8
Copy link
Author

Crones8 commented Nov 15, 2024

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
Copy link
Owner

lshqqytiger commented Nov 16, 2024

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.

@lshqqytiger lshqqytiger added the implementation Unimplemented feature(s) label Nov 16, 2024
@Crones8
Copy link
Author

Crones8 commented Nov 18, 2024

Well,

I'm very glad that the functionality is possible, this is ver good news. Thank you so much. Will be expecting the support, no matter how much time it takes, honestly I've been asking the developers to implement support for AMD GPUs for almost 3 years now, and they still haven't. So, knowing it will be available eventually is great news for me, and I'm sure many others as well.

Cheers, and thank you.

@lshqqytiger
Copy link
Owner

lshqqytiger commented Dec 24, 2024

Good news, I succeeded to interpret old style fat binary.
The kernel map_f64_to_f32 was built by nvcc 3.2 14 years ago!
For now, I have to implement some assembly instructions to make it work.
I'll back with next release (hopefully) soon.

@Crones8
Copy link
Author

Crones8 commented Dec 26, 2024

This is amazing news, thank you so much for this incredible work.

Will be expecting the release to try it.

Cheers.

@lshqqytiger
Copy link
Owner

Unfortunately, although I did what I can, the application still does not work properly. What I can find out is that the inner process terminates with an error right after ZLUDA passes recompiled binary of the kernel map_f64_to_f32 that I referenced before. Because the application consists of two processes when we enable RIber, it is quite troublesome to debug. You can check the last build (version) that I tried on attempt_iber branch. (does not work) I'm planning to dig into the application more later, but not sure.

@Crones8
Copy link
Author

Crones8 commented Jan 9, 2025

Well, it's certainly a great advance, at least for me, considering no support has been given to this software for AMD for years.

So still, thank you so much for your time and effort, doesn't matter how long it takes, it's a relief to know that at least someone is trying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
implementation Unimplemented feature(s)
Projects
None yet
Development

No branches or pull requests

2 participants