-
Notifications
You must be signed in to change notification settings - Fork 11
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
Matlab #45
Comments
I have created a new branch called https://github.com/KineticPreProcessor/KPP/tree/matlab @ShaddyAhmed: Does this work for you? @yantosca, @msl3v: There were two problems. First, Matlab does not have |
Thanks @RolfSander. I am out sick but will take a look by early next week. I think it should be fine to shunt those write statements for Matlab (as they are only needed for F90). |
Get well soon! |
I'll have a look this week.
ML
|
@RolfSander Yes I can now compile the mechanism successfully! I still need to perform some tests to check that the mechanism works (there are some warnings regarding continuation lines in the rate laws that will need to be fixed). I will report any bugs/issues on this thread. |
Hi all, sorry for the late response, I was out sick since coming back from the IGC10 meeting last week. @RolfSander, I took a look at the matlab branch and ran the C-I tests on that vs. the dev branch. We get identical results.. the only diffs are the ros_split test and the seulex90 test which are in one branch but not the other. So unless there are any other issues in generating the Matlab code, I think we are good to go. |
Also tagging Katie Travis (@ktravis213) at EPA. Katie uses the FOAM box modeling framework, which runs in Matlab. Would be great if we can test a KPP-generated Matlab mechanism w/ FOAM at some point. |
@jenniethomas, @ShaddyAhmed, @ktravis213: We are making good progress
If these are generic problems (not specific to PACT-1D or FOAM), we
Which option do you prefer? I think it would be nice to have this fixed |
Also posting here - |
Hi all - sorry for the delay in getting back to you on this! I did some tests compiling the PACT-1D mechanism with KPP 2.5.0 and there are just a few minor bugs which I think can be fixed in the KPP source code:
I also checked the monitor file and this seems to be working fine from KPP with no need for any changes. The KPP-generated files, fixed files and KPP output are all attached. KPP output: KPP generated files: Fixed files: |
Thanks, @ShaddyAhmed ! I think I will be able to transfer these fixes into the KPP source code. I also noticed that your fix added |
@RolfSander Great - Sorry I forgot to remove those lines as they were simulation specific for our case and not needed for other cases. These lines can be ignored |
@RolfSander these were rather specific hacks for our model. They should not be added. :) |
sorry - we responded at the same time. We agree on this. So, don't add. |
@yantosca: While looking at Vdotout and Vdot in Matlab, I noticed that we have |
I have written some bug fixes and pushed them into the The line continuation error is still not fixed properly. As a Q&D bug |
@RolfSander Thanks! I just tested the updates and they are working fine for me! |
Great! I've merged the Matlab updates updates into the Is there anything else that needs to be done for Matlab? If not, I will close this issue. |
Sounds great! No other updates from me for now. @jenniethomas anything to add? |
No more from me! I think we will just have Jochen and Thorsten test with their running versions. I will ask them now and you should have the answer shortly. |
Thanks, @jenniethomas and @ShaddyAhmed! I will close this issue now. If you find any additional bugs, feel free to re-open this issue any time (or create a new issue). |
@RolfSander Thorsten is just checking one things works for him - we will confirm Monday. We are just checking he used the right branch and will follow up. |
No problem. Just re-open this issue if there is anything else to do... You can use the |
@RolfSander These issues are fixed and KPP compiled and runs successfully. This is in a Apple M1 Pro with MacOS Monterey (12.4). Thanks for your work on the code to make compiling it on Mac work! There were additinonal workaround needed to compile it on 12.4 related to native gcc not running well (so one has to use homebrew version instead) and to the location of the library which Apple seems to shift around with every update. Happy to share those. |
Thanks @ThorBarRa! Please do let us know the changes you made for KPP to work on macOS 12.4. Perhaps we can include the macOS-related information in the Installation section of the online documentation (https://kpp.readthedocs.io/en/latest/getting_started/01_installation.html). I think we briefly mention |
Thanks @ThorBarRa and @jimmielin. I can add the info for MacOS to the doc later this week. I believe I was using GCC 11.4. |
Thanks all for this excellent progress, let's hope this is really useful for users within the community. @yantosca and @RolfSander thanks for contacting us to mobilize to work on this. |
I successfully tested the KPP 2.6 version with two of our current models. I did not encounter any issues. |
One additional question: Is there a way to eliminate the use of global variables in KPP for Matlab. Matlab is quite inefficient in its use of global variables, i.e. it makes the code slow. In addition, the use of global variable prevents parallelization of our model. |
Thanks for the positive feedback, @JPSTUTZ! I'm not using Matlab, so I don't know if it is possible to eliminate |
I'm not familiar enough with Matlab's issue on global variables but I was wondering if we can tie this with the move to derived types (equivalent to It seems like moving KPP global variables to a structure array in Matlab could help with parallelization, and maybe make the slowness a bit better. I would love to hear your thoughts on how to move away with global variables, @JPSTUTZ! |
From what I can find on the performance of structures in Matlab is that they would be faster than global variables. They are a little slower than just using arrays, but I think the benefit of cleaner code outweighs that. Structures in matlab work pretty much like in C, so I think that would be the way to go. |
@ThorBarRa, I added some documentation for MacOS to ReadTheDocs. It should be visible at https://kpp.readthedocs.io/en/latest/. |
@yantosca Thanks! I'll try it over the weekend and come back to you? Remind me. Was that for silicone Macs and macOS 12? |
I can just copy that. Structure would slimmer and one could rely more on newer built-in features and functions that Mathworks introduced for structures (and similar data containers). Happy to contribute, once its time for 4.0. |
@jenniethomas, @ThorBarRa, @JPSTUTZ, @ShaddyAhmed: We have removed
from the Matlab output. We don't think it is needed but please let us know if it is... |
@RolfSander Yes I imagine this should work fine for matlab! |
OK, thanks @ShaddyAhmed! |
This is for all matlab-related issues
The text was updated successfully, but these errors were encountered: