-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix gfortran compilation and some warnings #410
Conversation
@micaeljtoliveira I was able to build your
However the compiled executable crashes with segmentation fault (for both MPI and serial executables). This is probably outside the scope of this pull request but I will document this here for now. For the serial case I ran the example serial configuration in the CABLE repository:
which outputs:
I was able to trace the segmentation fault to the For the MPI case I ran the crujra_accessN96_1h config which crashes similarly to the serial case. Building your branch with the Intel compiler and running the executable seems to work fine so it looks like this is specific to the gfortran build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug configuration for gfortran
has some pretty pedantic flags enabled and currently doesn't build on Gadi - is it worth ironing these out?
@mcuntz I recall I used your compiler flags when adding the GNU compiler. The debug flags currently contain |
@SeanBryan51 -O is there simply for speed even in debug mode. I basically debug with print statements and do not use much the debuggers. No worry to change it. However, I think that the compilation should work with the pretty pedantic flags. If it works with another compiler means that that compiler assumes something and it is not always what you'd assume if you had coded properly. So I would be 100% for ironing out the places where it is not compiling. |
@SeanBryan51 I'm able to reproduce your error. I've compiled cable with the
|
Okay, I think I understand the problem, but I'm not sure how you want to fix it. In the following call in CALL generate_out_write_acc(output%SoilMoist, ovid%SoilMoist, 'SoilMoist', out%SoilMoist, REAL(ssnow%wb, 4), ranges%SoilMoist, patchout%SoilMoistIce, out_settings)
There are basically two solutions:
I would recommend against option 1., as the array bounds check is actually very useful when debugging. |
Actually, even with the checks disabled, it fails (as I should have realized from the segfault message obtained by @SeanBryan51). This means one really cannot call an elemental function over an array that has not been allocated, which makes total sense. I would thus argue that in this case gfortran is actually doing the right thing and it's the Intel compiler that is misbehaving. |
There's a few more problematic cases in the same module were several non-allocated arrays are being accessed. For example, here
it might happen that I think the only sensible solution is to fence all calls to |
@micaeljtoliveira thanks for looking into it.
This seems appropriate to me. I'm happy to let you decide if you want to fix this in this pull request. |
I think I rather do it in a separate PR. |
@micaeljtoliveira FYI the build-ci action has been fixed (#409) - if you rebase off main you should get a green light on the CI checks |
…odule, as gfortran provides a similar function that takes no arguments.
…g unused variables and arguments.
70d6560
to
d0e1995
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving - other issues related to the gfortran build can be addressed at a later point
CABLE
Thank you for submitting a pull request to the CABLE Project.
Description
This PR fixes compilation with gfortran. I also fixes several compiler warnings (mostly about unused variables) in the MPI master/driver modules.
Type of change
Please delete options that are not relevant.
Checklist
📚 Documentation preview 📚: https://cable--410.org.readthedocs.build/en/410/