Code review: bug fixes, MPI tests, API hygiene - #58
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
===========================================
+ Coverage 67.40% 94.00% +26.60%
===========================================
Files 12 12
Lines 589 617 +28
===========================================
+ Hits 397 580 +183
+ Misses 192 37 -155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coverage 67.4% → 94.0%. Both MPI optimizers were at 0%, which is where the worst bug was.
Bug fixes
_compute_single_step_costdirectly, but onlycompute_costcalledbuild→KeyError: :assess_policy_fix.buildnow runs intrain!.print(model)always threw — readmodel.forecast.network, field isnetworks.JuMP.num_constraints(::Model)always threw — missing requiredcount_variable_in_set_constraintskwarg..plan/.assessflattened N-D arrays and droppedDenseAxisArrayaxes (v[i=2:4].plan[2]returned the wrong element). Nowmap.train!mutated the caller'sOptions(filter!/delete!), so reuse changed behaviour.Options(GradientMode())threwTypeErrorinstead ofArgumentError._solve_bilevelunsupported-layer branch threwUndefVarError(ilayervsi_layer).dCdz/dCdywereFloat32while duals/sensitivities areFloat64→ silent precision loss.Base.print/show_*_summaryignoredio, wrote to stdout.forecastwas exported but never defined.MethodError(train!took noMatrixforY).Breaking
Solution→Solution{C<:Real,P<:Real}(wasVector{Real}, boxed every param).set_optimizer: dropped the unused third argevaluate_duals._-prefixed (docstrings kept, removed from API docs).forecastremoved fromexport.Added
train!acceptsY::Matrix; both entry points error clearly if no forecast model is set.PredictiveModel.networks→AbstractVector: mixed model types and non-Denselayers (Flux.Scale,Chains with a bare activation) now work.flux_utilswidened to match.Tests
test/test_mpi.jllaunchestest/mpi/mpi_modes.jlunderMPI.mpiexec(). Each MPI mode is asserted to match its serial counterpart from an identical start (8 checks, stochastic case seeded). Coverage flags propagate to the ranks.ADL_SKIP_MPI_TESTS=1skips.test/test_api.jl: 86 assertions — JuMP interface,Options, bound warnings, array shape/axes,flux_utils,aggregate=false, bilevel-after-build, matrix/dicttrain!, mixed & non-Denselayers.test/utils.jland unusedDistributionsdep.gradient_mpi.jlbilevel.jlnelder_mead_mpi.jlsimulation.jlApplicationDrivenLearning.jlflux_utils.jlpredictive_model.jl/nelder_mead.jl/gradient.jl/options.jl/solution.jl/jump.jlRemaining gaps are solver-failure
catchblocks and MPI early-exits that have covered serial twins.Docs
mpi_modes.md(was empty, unreferenced). Documents thatmpi_finalize=true(the default) makesJQM.is_controller_process()unusable aftertrain!.PredictiveModelexample (duplicateDictkeys, wrong types, wrong arity).batch_sizesamples with replacement.Pkg.addsyntax, stale "not registered" claim.VariableIndexedVectorinnewsvendor.mdno longer exists; escapedR\$10/MWh(parsed as interpolation).CI
format_check.ymltriggered onmaster; default branch ismain(so it only ran on PRs).1.10to the matrix, matching the declared compat bound.Dead code
tracearray (written, never read), theT×epochsbatchesmatrix in the deterministic path, unconditional"Final solution:"print.Not changed
scheduling.mdassess objective uses10*y.assess(demand) where plan uses10*z.plan(dispatch). Documented output is self-consistent with it, so intent is unclear — maintainer call.