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

[Bug Report] Installation of pyRTE+RRTMGP fails tests #69

Open
ankurmahesh opened this issue Oct 23, 2024 · 4 comments
Open

[Bug Report] Installation of pyRTE+RRTMGP fails tests #69

ankurmahesh opened this issue Oct 23, 2024 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ankurmahesh
Copy link

ankurmahesh commented Oct 23, 2024

Describe the bug
I am attempting to install pyRTE+RRTMGMP. When I follow the build instructions on the readme for installation via conda, I get this error, when I run

conda build conda.recipe

=================================== FAILURES ===================================
________________________________ test_lw_solver ________________________________

request = <FixtureRequest for <Function test_lw_solver>>

    def test_lw_solver(request):
        path = os.path.dirname(request.path)
        with open(f'{path}/lw_solver_input.json', 'r') as f:
            data = json.load(f)
    
        for key in data:
            values = data[key]
            if isinstance(values, list):
                values = np.array(values)
                data[key] = values
    
        args = list(data.values())
    
        py.rte_lw_solver_noscat(*args)
    
        test_data = np.load(f"{path}/lw_solver_output.npy")
    
>       assert(np.allclose(test_data - data['broadband_up'], 0.))
E       assert False
E        +  where False = <function allclose at 0x7fc2724e6fb0>((array([345.43212164, 204.42786215,  40.22612771,   8.80242324,\n       483.53738262, 286.1590084 ,  56.30870811,  12.32...374.10298773, 374.10298773, 374.10298773, 374.10298773,\n       523.67098538, 523.67098538, 523.67098538, 523.67098538]) - array([172.71606082, 102.21393107,  20.11306386,   4.40121162,\n       241.76869131, 143.0795042 ,  28.15435405,   6.16...187.05149387, 187.05149387, 187.05149387, 187.05149387,\n       261.83549269, 261.83549269, 261.83549269, 261.83549269])), 0.0)
E        +    where <function allclose at 0x7fc2724e6fb0> = np.allclose

tests/lw_solver_test/noscat_test/lw_solver_noscat_test.py:24: AssertionError
____________________________ test_lw_solver_noscat _____________________________

    def test_lw_solver_noscat():
        rrtmgp_gas_optics = kdist.gas_optics.load_atmosferic_conditions(rfmip)
    
        _, solver_flux_up, solver_flux_down, _, _ = lw_solver_noscat(
            tau=rrtmgp_gas_optics.tau,
            lay_source=rrtmgp_gas_optics.lay_src,
            lev_source=rrtmgp_gas_optics.lev_src,
            sfc_emis=rfmip["surface_emissivity"].data,
            sfc_src=rrtmgp_gas_optics.sfc_src,
            sfc_src_jac=rrtmgp_gas_optics.sfc_src_jac,
        )
    
>       assert np.isclose(solver_flux_up, ref_flux_up, atol=ERROR_TOLERANCE).all()
E       assert np.False_
E        +  where np.False_ = <built-in method all of numpy.ndarray object at 0x7fc2581774b0>()
E        +    where <built-in method all of numpy.ndarray object at 0x7fc2581774b0> = array([[False, False, False, ..., False, False, False],\n       [False, False, False, ..., False, False, False],\n      ...alse],\n       [False, False, False, ..., False, False, False],\n       [False, False, False, ..., False, False, False]]).all
E        +      where array([[False, False, False, ..., False, False, False],\n       [False, False, False, ..., False, False, False],\n      ...alse],\n       [False, False, False, ..., False, False, False],\n       [False, False, False, ..., False, False, False]]) = <function isclose at 0x7fc2724eb130>(array([[144.78141419, 144.8159722 , 144.84800098, ..., 228.09748602,\n        230.91920492, 239.10500159],\n       [150....3.2440728 ],\n       [143.73562813, 143.77591885, 143.80751672, ..., 217.92762   ,\n        218.58066063, 219.72328903]]), array([[289.56284, 289.63196, 289.696  , ..., 456.19498, 461.8384 ,\n        478.21   ],\n       [300.46246, 300.51285, ...    446.48816],\n       [287.47125, 287.55185, 287.61502, ..., 435.85526, 437.16132,\n        439.44656]], dtype=float32), atol=0.0001)
E        +        where <function isclose at 0x7fc2724eb130> = np.isclose

tests/test_python_frontend/test_lw_solver.py:43: AssertionError
=========================== short test summary info ============================
FAILED tests/lw_solver_test/noscat_test/lw_solver_noscat_test.py::test_lw_solver
FAILED tests/test_python_frontend/test_lw_solver.py::test_lw_solver_noscat - ...
======================== 2 failed, 54 passed in 15.09s =========================
Tests failed for pyrte_rrtmgp-0.0.6-py39h3fd9d12_0.tar.bz2 - moving package to /global/homes/a/amahesh/conda-bld/broken
WARNING:conda_build.build:Tests failed for pyrte_rrtmgp-0.0.6-py39h3fd9d12_0.tar.bz2 - moving package to /global/homes/a/amahesh/conda-bld/broken
TESTS FAILED: pyrte_rrtmgp-0.0.6-py39h3fd9d12_0.tar.bz2

To Reproduce
I ran git clone git@github.com:earth-system-radiation/pyRTE-RRTMGP.git
cd pyRTE-RRTMPG/
conda install conda-build conda-verify
conda build conda.recipe

Expected behavior
I'd expect the build tests to succeed so that I can use the package in conda

Software Versions:

  • OS: Linux on NERSC Perlmutter: AMD EPYC 7763 (which is based on x86-64 I think)
  • Version (or most recent commit hash) of RTE+RRTMGP: 1f9205c
    Also, I get this same failure when I try to build locally, on a Mac with Apple Silicon (which I know is not officially supported, according to the README). The macOS is Sonoma 14.4. (Note on the Mac with apple silicon I had to change gfortran_osx-64 in the conda.recipe/meta.yaml to gfortran_impl_osx-arm64)
@ankurmahesh
Copy link
Author

ankurmahesh commented Oct 24, 2024

After searching the Github repo, I also came across this pull request: #52. I tried cloning into this branch. I had to change the tests/test_python_frontend/test_sw_solver.py to use the rsu and rsd files from rrtgmp-data (not from files stored at this repo), just as was done for test_lw_solver.py in the branch. However, this still leads to errors with passing the lw test cases (see below).

The updated branch appears to have made the test_lw_solver_noscat closer to the true values (though still not within the tolerance). However, the test_lw_solver is still off, seemingly by a factor of 2, just as in the failure above.

________________________________ test_lw_solver ________________________________

request = <FixtureRequest for <Function test_lw_solver>>

    def test_lw_solver(request):
        path = os.path.dirname(request.path)
        with open(f'{path}/lw_solver_input.json', 'r') as f:
            data = json.load(f)
    
        for key in data:
            values = data[key]
            if isinstance(values, list):
                values = np.array(values)
                data[key] = values
    
        args = list(data.values())
    
        py.rte_lw_solver_noscat(*args)
    
        test_data = np.load(f"{path}/lw_solver_output.npy")
    
>       assert(np.allclose(test_data - data['broadband_up'], 0.))
E       assert False
E        +  where False = <function allclose at 0x10229ccb0>((array([345.43212164, 204.42786215,  40.22612771,   8.80242324,\n       483.53738262, 286.1590084 ,  56.30870811,  12.32...374.10298773, 374.10298773, 374.10298773, 374.10298773,\n       523.67098538, 523.67098538, 523.67098538, 523.67098538]) - array([172.71606082, 102.21393107,  20.11306386,   4.40121162,\n       241.76869131, 143.0795042 ,  28.15435405,   6.16...187.05149387, 187.05149387, 187.05149387, 187.05149387,\n       261.83549269, 261.83549269, 261.83549269, 261.83549269])), 0.0)
E        +    where <function allclose at 0x10229ccb0> = np.allclose

tests/lw_solver_test/noscat_test/lw_solver_noscat_test.py:24: AssertionError
____________________________ test_lw_solver_noscat _____________________________

    def test_lw_solver_noscat():
        rrtmgp_gas_optics = kdist.gas_optics.load_atmosferic_conditions(rfmip)
    
        _, solver_flux_up, solver_flux_down, _, _ = lw_solver_noscat(
            tau=rrtmgp_gas_optics.tau,
            lay_source=rrtmgp_gas_optics.lay_src,
            lev_source=rrtmgp_gas_optics.lev_src,
            sfc_emis=rfmip["surface_emissivity"].data,
            sfc_src=rrtmgp_gas_optics.sfc_src,
            sfc_src_jac=rrtmgp_gas_optics.sfc_src_jac,
        )
    
>       assert np.isclose(solver_flux_up, ref_flux_up, atol=ERROR_TOLERANCE).all()
E       assert False
E        +  where False = <built-in method all of numpy.ndarray object at 0x16e27fb10>()
E        +    where <built-in method all of numpy.ndarray object at 0x16e27fb10> = array([[False, False, False, ..., False, False, False],\n       [False, False, False, ..., False, False, False],\n      ...alse],\n       [False, False, False, ...,  True,  True, False],\n       [False, False, False, ...,  True,  True, False]]).all
E        +      where array([[False, False, False, ..., False, False, False],\n       [False, False, False, ..., False, False, False],\n      ...alse],\n       [False, False, False, ...,  True,  True, False],\n       [False, False, False, ...,  True,  True, False]]) = <function isclose at 0x10229e1b0>(array([[289.95776422, 290.02647951, 290.09010084, ..., 456.24771837,\n        461.88459126, 478.1998788 ],\n       [300....6.47711207],\n       [287.8319806 , 287.91209465, 287.97485138, ..., 435.85481284,\n        437.15826435, 439.43587803]]), array([[289.56674, 289.63577, 289.69986, ..., 456.19098, 461.83554,\n        478.21   ],\n       [300.46246, 300.51276, ...    446.48813],\n       [287.47003, 287.55054, 287.6137 , ..., 435.85275, 437.15918,\n        439.44656]], dtype=float32), atol=0.0001)
E        +        where <function isclose at 0x10229e1b0> = np.isclose

tests/test_python_frontend/test_lw_solver.py:44: AssertionError

@ankurmahesh
Copy link
Author

ankurmahesh commented Oct 24, 2024

The second test can be passed by changing the TAG at this line to 1.8.1, to reflect the updated files in the rrtmpg-data github repository. I will submit a PR with this change.

However, the first test (test_lw_solver), where the results appear to be off by a factor of 2, is still not fixed.

@tcmetzger tcmetzger added this to the Phase 2 milestone Oct 28, 2024
@tcmetzger tcmetzger added the bug Something isn't working label Oct 28, 2024
@tcmetzger
Copy link
Collaborator

@ankurmahesh Thank you for filing this bug report! Things have been a bit slower than usual over the past weeks, but we are planning to get back to this soon!

@sehnem
Copy link
Collaborator

sehnem commented Nov 14, 2024

They were fixed, but found that there is an inconsistency in the results of the LW problem in Apple Silicon.

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
Status: In progress
Development

No branches or pull requests

4 participants