-
Notifications
You must be signed in to change notification settings - Fork 108
Code tidying #907
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
base: master
Are you sure you want to change the base?
Code tidying #907
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #907 +/- ##
=======================================
Coverage 44.15% 44.16%
=======================================
Files 68 68
Lines 18347 18364 +17
Branches 2227 2231 +4
=======================================
+ Hits 8101 8110 +9
- Misses 8943 8947 +4
- Partials 1303 1307 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Failed on AMD GPU hardware with Cray compilers because:
|
I will review this soon. It's hard to review because I want to be sure the tests caught all the ways this could have possibly broken something. |
@@ -32,7 +32,11 @@ logical pure elemental function f_approx_equal(a, b, tol_input) result(res) | |||
if (present(tol_input)) then | |||
tol = tol_input | |||
else | |||
tol = 1.e-10_wp | |||
if (wp == selected_real_kind(15, 307)) then |
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.
does this even work? have you tested it?
@@ -62,7 +66,11 @@ logical pure function f_approx_in_array(a, b, tol_input) result(res) | |||
if (present(tol_input)) then | |||
tol = tol_input | |||
else | |||
tol = 1e-10_wp | |||
if (wp == selected_real_kind(15, 307)) then |
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.
same question here. does this if statement work as expected? wp can be either double or single but does it do what you expect?
@@ -363,6 +368,11 @@ contains | |||
real(wp), intent(out) :: vcfl_max_glb | |||
real(wp), intent(out) :: Rc_min_glb | |||
|
|||
! Initiate the global variables to the local values to avoid warnings |
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.
change comment to 'Initiate global variables'
call nvtxRangePush(tempName) | ||
else | ||
event%color = col(mod(id, 7) + 1) | ||
if (present(id)) then |
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.
does this work, too? you need to run nsys with cpu and gpu modes to find out
|
||
integer :: s !< Generic loop iterator | ||
! Initiate the variables to avoid compiler warnings |
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.
remove "to avoid compiler warnings"
real(wp), allocatable :: stored_values(:, :, :) | ||
real(wp), allocatable :: x_coords(:), y_coords(:) | ||
logical :: files_loaded = .false. | ||
real(wp) :: domain_xstart, domain_xend, domain_ystart, domain_yend | ||
real(wp) :: domain_xstart !, domain_xend, domain_ystart, domain_yend |
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.
instead of commenting out variables why not just delete them
|
||
integer, intent(in) :: patch_id | ||
integer, dimension(0:m, 0:n, 0:p), intent(inout) :: patch_id_fp | ||
type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf | ||
!type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf |
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.
delete, don't comment
@@ -1261,9 +1261,6 @@ contains | |||
!! Determines the amount of freedom available from utilizing a large | |||
!! value for the local curvature. The default value for beta is 4/3. | |||
|
|||
real(wp), parameter :: alpha_mp = 2._wp |
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.
do these not get used anywhere?
User description
Description
This is the latest progress of code tidying.
Fixes #845
Type of change
./mfc.sh build --debug
A few issues remaining
For example:
Adding a local variable only to silence a warning:
which I feel is not necessary.
@:analytical()
macro during./mfc.sh test
.An example is attached:
PR Type
Enhancement
Description
Remove unused variables and dummy arguments across modules
Fix compiler warnings for uninitialized variables
Correct MPI data type declarations for proper addressing
Add conditional compilation guards for unused code sections
Changes diagram
Changes walkthrough 📝
24 files
Remove unused variables and fix MPI types
Add conditional compilation guard for variable
Fix parameter order and optional arguments
Initialize variables and add conditional guards
Fix variable scope and initialization
Remove unused variables and fix declarations
Fix parameter order in function calls
Remove unused variables and fix comparisons
Remove unused variable declaration
Remove unused parameters from subroutines
Remove unused loop variable
Remove unused stability criterion variables
Fix parameter order in function calls
Add conditional compilation for variables
Fix parameter order in function calls
Fix parameter order in function calls
Remove unused loop variables
Remove unused variables and fix calls
Remove unused variables from subroutine
Comment out unused gradient magnitude variables
Remove unused field variables
Fix variable initialization and declarations
Comment out unused gradient variables
Remove duplicate parameter declarations
1 files
Improve precision-specific tolerance handling