LSSTDESC / lsstdesc-diffsky

Library for differentiable generation of synthetic skies for LSST DESC
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Add monthly cron testing against warnings #106

Open aphearin opened 6 months ago

aphearin commented 6 months ago

Add monthly cron testing against warnings. The something workflow is identical to tests.yml except for this workflow is run after first invoking export PYTHONWARNINGS=error so that any warnings raised by our code during test suite execution will be treated as test failures.

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 75.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 61.57%. Comparing base (9abe5c1) to head (60ed68e).

Files Patch % Lines
lsstdesc_diffsky/diffstarpop/mc_diffstar.py 66.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #106 +/- ## ======================================= Coverage 61.57% 61.57% ======================================= Files 99 99 Lines 7157 7160 +3 ======================================= + Hits 4407 4409 +2 - Misses 2750 2751 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

aphearin commented 6 months ago

Currently, I think the only warnings=errors raised by our test suite appear to be limited to calls to mc_diffstar.py. The offending warning is this:

FutureWarning: scatter inputs have incompatible types: cannot safely cast value from dtype=float64 to dtype=float32. In future JAX releases this will result in an error.

I am accustomed to resolving this particular error by adding the following lines to the top of the problematic module:

from jax import config
config.update("jax_enable_x64", True)

Adding these two lines to mc_diffstar.py did not resolve the warning. It is possible that jax_enable_x64 also needs to be added to all modules called by this module, e.g., modules within diffstar. I have not checked that though, because our current code pins diffstar to an older version, diffstar==0.2.2, and so checking this hypothesis would require creating a custom branch of diffstar that begins from 0.2.2 and then makes a single change with jax_enable_x64 enabled, and then either modifying our workflow to run the test, or just running it locally in a suitable prepared environment.