Skip to content

Submodules for everything! #591

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

Merged
merged 25 commits into from
Jan 14, 2020
Merged

Submodules for everything! #591

merged 25 commits into from
Jan 14, 2020

Conversation

ali-ramadhan
Copy link
Member

@ali-ramadhan ali-ramadhan commented Jan 11, 2020

This PR felt so good!

The internal code base had to be massively refactored thus the size of this PR but I think it's taking the code base in the right direction with submodules for everything, and will make implementing big new features (like vertically stretched grid and MPI) much easier and cleaner.

There were a few breaking changes, e.g. Face and Cell moving to Oceananigans.Fields. In particular, Oceananigans does not export day, minute, second, and hour anymore as they conflict with the Dates module used by the logger. And it might also confuse users as to why Oceananigans is exporting these common names. They are now exported by Oceananigans.Utils.

But otherwise, the impact to user scripts is pretty minimal (the examples barely changed).

This should be merged as the next PR ASAP as merging anything else in will probably create some form of merge conflict hell.

Resolves #456
Resolves #495
Resolves #497
Resolves #563

@ali-ramadhan ali-ramadhan added the cleanup 🧹 Paying off technical debt label Jan 11, 2020
@ali-ramadhan ali-ramadhan requested a review from glwagner January 11, 2020 14:28
@codecov
Copy link

codecov bot commented Jan 12, 2020

Codecov Report

Merging #591 into master will increase coverage by 0.18%.
The diff coverage is 65.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #591      +/-   ##
==========================================
+ Coverage   73.14%   73.33%   +0.18%     
==========================================
  Files          70      117      +47     
  Lines        2011     2014       +3     
==========================================
+ Hits         1471     1477       +6     
+ Misses        540      537       -3
Impacted Files Coverage Δ
src/Forcing/simple_forcing.jl 50% <ø> (ø)
src/OutputWriters/netcdf_output_writer.jl 86.53% <ø> (ø) ⬆️
src/Models/clock.jl 50% <ø> (ø)
src/Solvers/solver_utils.jl 82.6% <ø> (ø) ⬆️
src/Models/model.jl 100% <ø> (ø)
src/TimeSteppers/TimeSteppers.jl 74.35% <ø> (ø) ⬆️
src/OutputWriters/jld2_output_writer.jl 84.61% <ø> (ø) ⬆️
src/AbstractOperations/AbstractOperations.jl 33.33% <ø> (ø) ⬆️
src/TurbulenceClosures/TurbulenceClosures.jl 42.85% <ø> (ø) ⬆️
src/Diagnostics/horizontal_average.jl 84.61% <ø> (ø) ⬆️
... and 119 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91a9f6d...0d67ad9. Read the comment docs.

@christophernhill
Copy link
Member

christophernhill commented Jan 12, 2020 via email

instantiate(L::NTuple{N, <:DataType}) where N = Tuple(X() for X in L)
instantiate(L::NTuple{N, <:DataType}) where N = (L[1](), L[2](), L[3]()) # Tuple(X() for X in L)
Copy link
Member Author

@ali-ramadhan ali-ramadhan Jan 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason Tuple(X() for X in L) errors here now (see sample stacktrace below), which is why I changed it to the less general (L[1](), L[2](), L[3]()) which should still work as all the interpolation operators have 3 dimensions and I don't think we're changing this soon.

I mostly just reorganized code so I have no idea why it would error now.

I spent over two hours trying to figure out why Base.Generator errors but couldn't reproduce it in a minimal working example so I'm going to leave it in for now. I can't spend more time on this line.


Unary operations and derivatives [Float32]: Error During Test at /home/alir/Oceananigans.jl/test/test_abstract_operations.jl:243
  Test threw exception
  Expression: typeof((op(ψ))[2, 2, 2]) <: Number
  UndefVarError: I not defined
  Stacktrace:
   [1] Base.Generator(::Oceananigans.AbstractOperations.var"#5#7", ::Tuple{#s267,#s267,#s267} where #s267<:DataType) at ./generator.jl:32
   [2] instantiate(::Tuple{#s267,#s267,#s267} where #s267<:DataType) at /home/alir/Oceananigans.jl/src/AbstractOperations/interpolation_utils.jl:30
   [3] interpolation_operator(::Tuple{#s267,#s267,#s267} where #s267<:DataType, ::Tuple{DataType,DataType,DataType}) at /home/alir/Oceananigans.jl/src/AbstractOperations/interpolation_utils.jl:42
   [4] _unary_operation(::Tuple{DataType,DataType,DataType}, ::Function, ::Field{Face,Cell,Cell,OffsetArray{Float32,3,Array{Float32,3}},RegularCartesianGrid{Float32,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}, ::Tuple{DataType,DataType,DataType}, ::RegularCartesianGrid{Float32,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}) at /home/alir/Oceananigans.jl/src/AbstractOperations/unary_operations.jl:27
   [5] sqrt(::Tuple{DataType,DataType,DataType}, ::Field{Face,Cell,Cell,OffsetArray{Float32,3,Array{Float32,3}},RegularCartesianGrid{Float32,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}) at /home/alir/Oceananigans.jl/src/AbstractOperations/unary_operations.jl:92
   [6] sqrt(::Field{Face,Cell,Cell,OffsetArray{Float32,3,Array{Float32,3}},RegularCartesianGrid{Float32,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}) at /home/alir/Oceananigans.jl/src/AbstractOperations/unary_operations.jl:95
   [7] top-level scope at /home/alir/Oceananigans.jl/test/test_abstract_operations.jl:243
   [8] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107
   [9] top-level scope at /home/alir/Oceananigans.jl/test/test_abstract_operations.jl:240
   [10] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107
   [11] top-level scope at /home/alir/Oceananigans.jl/test/test_abstract_operations.jl:231

@ali-ramadhan ali-ramadhan merged commit 15aa586 into master Jan 14, 2020
@ali-ramadhan ali-ramadhan deleted the ar/more-submodules branch January 14, 2020 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup 🧹 Paying off technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conflicting identifiers More local import statements. What should be split into submodules? More modules / hierarchical code structure
2 participants