earth-system-radiation / rte-rrtmgp

RTE+RRTMGP is a set of codes for computing radiative fluxes in planetary atmospheres.
BSD 3-Clause "New" or "Revised" License
74 stars 65 forks source link

`make tests` fails with an error #289

Closed sriharshakandala closed 2 months ago

sriharshakandala commented 2 months ago

Following the recommended build procedure in https://earth-system-radiation.github.io/rte-rrtmgp/how-tos/build-and-test.html

make libs
make tests

I see that the make libs works fine but make tests fails with the following error

% make tests
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tests                    tests
make[1]: *** No rule to make target `mo_heating_rates.o', needed by `check_variants.o'.  Stop.
make: *** [tests] Error 2

Please advise on how this can be fixed!

skosukhin commented 2 months ago

There is a chance that it can be fixed by changing the operating system. Sorry :)

Can you, please, try installing GNU make with macports or homebrew and try building with it (you will need to run gmake instead of make, I guess)?

sriharshakandala commented 2 months ago
% gnumake --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

I see the same error with gnumake

skosukhin commented 2 months ago

Yes, the default version of make that is available on macOS is GNU make but of a rather old version. It might be that the makefiles of the library rely on features of the tool that are available in the newer versions only. If a newer version from one of the aforementioned package managers does not work, I will try to reproduce the problem tomorrow on my machine.

sriharshakandala commented 2 months ago

I installed the latest version of gmake through homebrew but still see the same error!

% gmake tests
gmake -C tests                    tests
gmake[1]: Entering directory '/Users/sriharshakandala/work/rte-rrtmgp/tests'
gmake[1]: *** No rule to make target 'mo_heating_rates.o', needed by 'check_variants.o'.  Stop.
gmake[1]: Leaving directory '/Users/sriharshakandala/work/rte-rrtmgp/tests'
gmake: *** [Makefile:11: tests] Error 2

% gmake --version
GNU Make 4.4.1
Built for aarch64-apple-darwin23.0.0
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
skosukhin commented 2 months ago

Thank you for checking.

I think that you need to set the RRTMGP_ROOT shell variable to the absolute path of the root source directory:

export RRTMGP_ROOT=$(pwd)
make tests

@RobertPincus I remember that the variable was mentioned in the README.md but #246 removed it and I can't find the information in the new documentation. Is it missing there?

sriharshakandala commented 2 months ago

I am able to compile with gmake tests with the following changes:

I am able to run gmake check, but the test fails with the following output:

% gmake check
gmake -C tests                    check
gmake[1]: Entering directory '/Users/sriharshakandala/work/rte-rrtmgp/tests'
echo "Nothing to check in tests/"
Nothing to check in tests/
gmake[1]: Leaving directory '/Users/sriharshakandala/work/rte-rrtmgp/tests'
gmake -C examples/rfmip-clear-sky check
gmake[1]: Entering directory '/Users/sriharshakandala/work/rte-rrtmgp/examples/rfmip-clear-sky'
${PYTHON-python3} /Users/sriharshakandala/work/rte-rrtmgp/examples/compare-to-reference.py \
       --ref_dir /Users/sriharshakandala/work/rrtmgp-data/examples/rfmip-clear-sky/reference --tst_dir /Users/sriharshakandala/work/rte-rrtmgp/examples/rfmip-clear-sky \
       --var rld rlu rsd rsu --file r??_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc
Variable rld: No diffs
Variable rlu: No diffs
Variable rsd differs (max abs difference: 6.103516e-04; max percent difference: 7.136186e-05%)
Variable rsu differs (max abs difference: 1.831055e-04; max percent difference: 7.249035e-05%)
Tests failed
gmake[1]: *** [Makefile:61: check] Error 1
gmake[1]: Leaving directory '/Users/sriharshakandala/work/rte-rrtmgp/examples/rfmip-clear-sky'
gmake: *** [Makefile:17: check] Error 2

Is this expected?

RobertPincus commented 2 months ago

@skosukhin Thanks for help @sriharshakandala. The documentation clearly needs updating though I guess #290 will address the issues as well?

RobertPincus commented 2 months ago

"clearly needs updating" above means to document that one needs to set environment variables RRTMGP_ROOT, RRTMGP_DATA, and FAILURE_THRESHOLD at least, and potentially add to FCINCLUDE to make netCDF module files available.

sriharshakandala commented 2 months ago

Thank you @RobertPincus !

sriharshakandala commented 2 months ago

Thanks, @skosukhin . I will increase the tolerance a bit for the clear sky tests!

RobertPincus commented 2 months ago

@sriharshakandala If you're able to run the tests as expected and have the guidance you need out of the box please feel free to close this issue.

sriharshakandala commented 2 months ago

Yes. Thanks, @RobertPincus !