-
Notifications
You must be signed in to change notification settings - Fork 237
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
Clean unused var #579
Clean unused var #579
Conversation
clean-up to keep all local variables declared in single place (and no longer in middle of src file)
also bring more consistent upper/lower case writing
- add missing CTRL_OPTIONS.h (S/R was mostly empty without ALLOW_DEPTH_CONTROL being defined); - comment out resetting of "writeBinaryPrec" (which is not safe); - call PRINT_ERROR & PRINT_MESSAGE with myThid argument; - avoid un-used variables.
- remove/avoid un-used variables - separate S/R arg and local var - fix/improve indentation - more consistent upper/lower case writing
Some stats: for all AD verification exp, the number of used variable warnings in all built when down from 31,700 before PR #471 to 1062 with current master, and now down to 40 with this PR (including 38 from halfpipe_streamice built). Also will remove few more unused var that don't show up in AD built log file because TAF remove them. |
also simplify and clean a bit some src files (e.g., skip copy of tile loop range into local vars itlo,ithi & jtlo,jthi )
@jm-c just a comment/suggestion: These variables defined as parameters in tamc.h:
are not used anywhere in the code, as far as I can see. They do not produce unused-warning messages, because of the parameter statements, but they are unused, nevertheless. Maybe we can remove them in the PR as well? |
@mjlosch Thaks for the sugestion. I will remove these unsed "parameters" |
Not yet a review, but just a comment: in the context of #529 I already removed a few unused variables from pkg/streamice. Further I noticed that "ECCO_CPPOPTIONS.h" is still being used in "global_ocean_ebm" and "halfpipe_streamice". I cannot remember why. I have started a branch to fix that, and this may be yet another chance to clean up some TAF-related aspects of streamice (by no means everything). I will wait for this and #529 to be merged before proceeding and turning that branch into a PR. |
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.
This is a very useful (and tedidious) clean-up PR. Obviously, I did not check all 96 files. With
grep -B4 "Warning: Unused variable" */build/make.tr_log
I found only 39 warnings, all but one in halfpipe_streamice. The only other one in bottom_ctrl_5x5, which could be suppressed by a cpp-flag in ctrl_unpack.F (in analogy to ctrl_pack.F):
#if (defined ALLOW_OBCS || defined ECCO_CTRL_DEPRECATED)
character*( 80) weighttype
#endif
Should be we add that? Otherwise, LGTM and should be merged quickly, because it affects so many files and hence current PRs, for which we need to make sure, that they don't break this cleanup. The earlier we do this, the better.
@mjlosch Thanks for the review. I fixed ctrl_unpack.F the way you suggested (I probably missed this one in the first round of changes). |
And regarding this:
I avoided changing anything in pkg/streamice so no risk of conflicts. And regarding CPP header files from verification code_ad dir I also noticed #577 which could be cleaned-up as well. |
@jm-c it's not clear to me why Lines 895 to 896 in 3b6c79e
but three times in "ctrl_pack.F". To me this appears totally inconsistent. Plus, weighttype is not used in any of the generic controls, as far as I can see. So instead of 28566e3 we could remove (or comment out) weighttype consistently with "ctrl_pack.F". Maybe we can have an opinion from the ECCO crowd (@owang01 , @ifenty).
|
@mjlosch I agree that, since this PR involves many files, it would be easier if it could be merged relatively soon. |
@jm-c your latest changes look good to me. Let's merge this. |
OK, unless someone disagree, will merge this PR tomorrow. |
just to avoid un-used variables
* BLING "spring cleaning" * clean up store directives and restructure a little for easier AD This change speeds up ADTHE_MAIN_LOOP in verification/global_oce_bio_bling by a factor of 7 (!), mainly because it fixes the extensive recomputations. Relative to the version prior to this PR the speed up is small. With this commit (on my laptop): User/System/Wall clock time: 51.93 sec / 0.30 sec / 52.59 sec Before: User/System/Wall clock time: 358.49 sec / 0.35 sec / 360.67 sec * clean up diagnostics, chl_sat * clean up diagnostics, chl_sat * adjust cpp-flags to reduce number of taf-not-necessary-warnings * make s/r bling_min_val visible to taf, adjust store directives - remove bling_write_pickup.f from bling_ad_diff.list because the call is not visible to taf anyway - remove bling_read_pickup.f from bling_ad_diff.list because there are flow directives (avoid another warning) * add chlsat_t parameters to namelist and set default values * remove double blank line * improve new chl_sat time-window - rename the 2 new params to "chlsat_locTimWindow(2)" (in decimal hour) - use "decimal hour" consistently (this fix inaccurate time-window criteria). - allow to be used without pkg/cal * bring back PR #579 changes just to avoid un-used variables * minor adjustment * document improvements in pkg/bling --------- Co-authored-by: averdy <averdy@mist.ucsd.edu> Co-authored-by: Jean-Michel Campin <jmc@mit.edu> Co-authored-by: mjlosch <Martin.Losch@awi.de> Co-authored-by: Jean-Michel Campin <jmc@ocean.mit.edu>
What changes does this PR introduce?
Remove or avoid un-used (local) variables in (TAF) AD built and clean-up (a little) pkg/smooth.
What is the current behaviour?
Most un-used variables have been removed from FWD verification experiment built but still many seen in AD verification exp. built (although the number went down by > x 31 after merging PR #471).
What is the new behaviour
clean up by removing or just avoiding some un-used variables
Does this PR introduce a breaking change?
no real code change, zero change in results.
Other information:
a) for now, no changes in pkg/streamice (left AD exp halfpipe_streamice on the side).
b) there is still unused variables left in src files that are processed by TAF, but, since TAF remove them, it's less an issue + don't notice any warning.
Suggested addition to
tag-index
o pkgs:
halfpipe_streamice (pkg/streamice); also clean-up a bit pkg/smooth.