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

Un-initialised variables #1017

Open
ukmo-ccbunney opened this issue May 26, 2023 · 10 comments
Open

Un-initialised variables #1017

ukmo-ccbunney opened this issue May 26, 2023 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@ukmo-ccbunney
Copy link
Collaborator

ukmo-ccbunney commented May 26, 2023

This issue will be used to log any un-initialised variables found in the code.
I will update it as/when I find any.

ww3_profsmd_pdlib.f90:

  • RD10 and RD20. Used on line 6573,6574. Declared on line 6414.
    RD1 = RD10 - DTG * REAL(ITER(IK)-IT)/REAL(ITER(IK))
    RD2 = RD20
  • fhndl: Used on line 3070 in a write statement. Unlikely to be cause any B4B reproduciblity errors, but could cause a crash if unit number is way out of range. I'm don't believe this subroutine is actually called (looks like debugging).
    WRITE(fhndl,*) 'IX=', IX, 'eSum=', eSum

ww3_ounf.F90

  • FLGFC is unitilialised if not running with namelist input:

    WW3/model/src/ww3_ounf.F90

    Lines 245 to 246 in 5cc3a01

    LOGICAL :: FLG2D(NOGRP,NGRPP), FLG1D(NOGRP), &
    VECTOR, TOGETHER, FLGNML, FLGFC

    Needs initialising here with other variables not supported via .inp files:

    WW3/model/src/ww3_ounf.F90

    Lines 414 to 419 in 5cc3a01

    ! The following are only configurable via the namelist input
    ! and are hardcoded for .inp files:
    TTYPE = "D"
    TIMEUNIT = "D"
    NOVAL = UNDEF
    VECTOR = .TRUE.

@ukmo-ccbunney ukmo-ccbunney added the bug Something isn't working label May 26, 2023
@JessicaMeixner-NOAA
Copy link
Collaborator

@ukmo-ccbunney Thank you! Can I ask how you are finding these (and therefore how we can all help you find more?)

@aronroland
Copy link
Collaborator

@ukmo-ccbunney thanks, will make a pull request this weekend.

@ukmo-ccbunney
Copy link
Collaborator Author

@ukmo-ccbunney Thank you! Can I ask how you are finding these (and therefore how we can all help you find more?)

I'm compiling selected regtests with as many compiler warning flags enabled as possible.
The only problem is you get a lot of "unused variable" messages due to the nature of our code, so it's worth disabling that warning if possible. I am grabbing the compiler output and doing some judicious grepping to find any worrisome warnings.
The above were from the ww3_tp2.21 regtest compilation.

I am not 100% sure the compiler catches everything, so I am investigating whether I can run with a tool like valgrind to capture uninitialised errors at runtime... (I'm hoping it can do this!)

@JessicaMeixner-NOAA
Copy link
Collaborator

@MatthewMasarik-NOAA has run valgrind on WW3 for a few tests, maybe he has some insights on that.

@ukmo-ccbunney
Copy link
Collaborator Author

@MatthewMasarik-NOAA has run valgrind on WW3 for a few tests, maybe he has some insights on that.

I've run it before on serial jobs, but not on an MPI job (I assume that the PDLIB tests need to be MPI?)
Any pointers on running it under MPI would be appreciated!

@MatthewMasarik-NOAA
Copy link
Collaborator

@ukmo-ccbunney I have used valgrind on WW3, but also in serial.

@ukmo-ccbunney
Copy link
Collaborator Author

@ukmo-ccbunney I have used valgrind on WW3, but also in serial.

Out of interest, what options do you use when running valgrind?

Currently, I am doing:

valgrind --tool=memcheck --track-origins=yes --leak-check=yes <exex>

@MatthewMasarik-NOAA
Copy link
Collaborator

I could clarify that i have run valgrind on WW3 on MPI jobs, but I have not done any steps like using the LD_PRELOAD that they recommend for MPI. So this is not 'MPI-safe', but I think you can still get other useful information. I'd likewise be interested to hear if you end up able to run it using those MPI precautions.

@ukmo-ccbunney
Copy link
Collaborator Author

ukmo-ccbunney commented Jul 11, 2023

@ukmo-ccbunney thanks, will make a pull request this weekend.

Hi @aronroland ,
Re: ww3_profsmd_pdlib.F90
Were you still planning on doing this? I am happy to raise a PR for this one myself if that helps.
I just need you to confirm that the initial values of zero for RD10 and RD20 are ok.

@ukmo-ccbunney ukmo-ccbunney self-assigned this Jul 11, 2023
@aronroland
Copy link
Collaborator

Hi Chris,

this is fine, I will merge it into init_bugs2, and I will also work out the comment on the triads not being initialized correctly. Let me also thank for these findings!

Cheers

Aron

aronroland added a commit to erdc/WW3 that referenced this issue Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants