-
Notifications
You must be signed in to change notification settings - Fork 4
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
Restructure ThermodynamicsParameters
to reduce metadata size
#233
Comments
I think that this is fine for large, flat, and "uniform" structs. Thermodynamics does have 26 properties. Unfortunately, this isn't really a compose-able solution (as mentioned here). So, if I understand correctly, applying this to I think that we will need to test a few things out in in ClimaAtmos before merging anything. |
The solution will work for nested structs:
|
Is that something we will have to do in CloudMicrophysics.jl too? We have a lot of parameters and spend some significant time to introduce structure to them. We dispatch a lot of things now based on parameter types. Are we now switching back to all flat? |
How much parameter space does the current struct use? We run into parameter space issues regularly with Oceananigans and ClimaOcean. But we find that the issue is usually highly nested structures of things like |
The above design provides a bounded metadata size of about 32 bytes, regardless of number of simple fields in struct. This pattern is prevalent in our parameter structs in various packages! |
That's great. What is the parameter size without this change? (Is the parameter size variable? Why would that be?) |
I agree with @glwagner' points about this, we should probably identify the biggest culprits w.r.t. parameter memory usage, before widely spreading a pattern that reduces our parameter memory by only (for example) 2%.
It's 8 bytes per property, so, 208 bytes for Thermodynamics. |
The concern is mostly about metadata size! |
I added support for fmb
| size: 72, fmb.pairs::Tuple{…}
| size: 16, fmb.pairs.1::Pair{…}
| size: 64, fmb.pairs.1.first::CUDA.CuArray{…}
| size: 16, fmb.pairs.1.first.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.1.first.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.1.first.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.1.first.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.1.first.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.1.first.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.1.first.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.1.first.dims::NTuple{…}
| size: 64, fmb.pairs.1.second::Base.Broadcast.Broadcasted{…}
| size: 64, fmb.pairs.1.second.args::Tuple{…}
| size: 64, fmb.pairs.1.second.args.1::CUDA.CuArray{…}
| size: 16, fmb.pairs.1.second.args.1.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.1.second.args.1.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.1.second.args.1.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.1.second.args.1.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.1.second.args.1.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.1.second.args.1.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.1.second.args.1.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.1.second.args.1.dims::NTuple{…}
| size: 24, fmb.pairs.2::Pair{…}
| size: 64, fmb.pairs.2.first::CUDA.CuArray{…}
| size: 16, fmb.pairs.2.first.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.2.first.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.2.first.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.2.first.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.2.first.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.2.first.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.2.first.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.2.first.dims::NTuple{…}
| size: 128, fmb.pairs.2.second::Base.Broadcast.Broadcasted{…}
| size: 128, fmb.pairs.2.second.args::Tuple{…}
| size: 64, fmb.pairs.2.second.args.1::CUDA.CuArray{…}
| size: 16, fmb.pairs.2.second.args.1.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.2.second.args.1.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.2.second.args.1.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.2.second.args.1.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.2.second.args.1.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.2.second.args.1.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.2.second.args.1.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.2.second.args.1.dims::NTuple{…}
| size: 64, fmb.pairs.2.second.args.2::CUDA.CuArray{…}
| size: 16, fmb.pairs.2.second.args.2.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.2.second.args.2.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.2.second.args.2.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.2.second.args.2.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.2.second.args.2.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.2.second.args.2.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.2.second.args.2.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.2.second.args.2.dims::NTuple{…}
| size: 32, fmb.pairs.3::Pair{…}
| size: 64, fmb.pairs.3.first::CUDA.CuArray{…}
| size: 16, fmb.pairs.3.first.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.3.first.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.3.first.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.3.first.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.3.first.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.first.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.3.first.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.first.dims::NTuple{…}
| size: 192, fmb.pairs.3.second::Base.Broadcast.Broadcasted{…}
| size: 192, fmb.pairs.3.second.args::Tuple{…}
| size: 64, fmb.pairs.3.second.args.1::CUDA.CuArray{…}
| size: 16, fmb.pairs.3.second.args.1.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.3.second.args.1.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.3.second.args.1.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.3.second.args.1.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.3.second.args.1.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.second.args.1.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.3.second.args.1.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.second.args.1.dims::NTuple{…}
| size: 64, fmb.pairs.3.second.args.2::CUDA.CuArray{…}
| size: 16, fmb.pairs.3.second.args.2.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.3.second.args.2.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.3.second.args.2.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.3.second.args.2.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.3.second.args.2.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.second.args.2.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.3.second.args.2.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.second.args.2.dims::NTuple{…}
| size: 64, fmb.pairs.3.second.args.3::CUDA.CuArray{…}
| size: 16, fmb.pairs.3.second.args.3.data::GPUArrays.DataRef{…}
| size: 24, fmb.pairs.3.second.args.3.data.rc::GPUArrays.RefCounted{…}
| size: 64, fmb.pairs.3.second.args.3.data.rc.obj::CUDA.Managed{…}
| size: 48, fmb.pairs.3.second.args.3.data.rc.obj.mem::CUDA.DeviceMemory
| size: 16, fmb.pairs.3.second.args.3.data.rc.obj.mem.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.second.args.3.data.rc.obj.stream::CUDA.CuStream
| size: 16, fmb.pairs.3.second.args.3.data.rc.obj.stream.ctx::CUDA.CuContext
| size: 40, fmb.pairs.3.second.args.3.dims::NTuple{…} I plan to open a PR in CUDA with this, but I think it'd be helpful to reduce the amount of information (e.g., sorting and printing the most expensive pieces). |
The Climate Modeling Alliance
Software Design Issue 📜
Purpose
Restructure
ThermodynamicsParameters
to reduce metadata size.Cost/Benefits/Risks
This will help reduce metadata size for GPU kernels
People and Personnel
Components
Restructure the
ThermodynamicsParameters
toand access parameters through functions. E.g.:
or
Inputs
Results and Deliverables
Scope of Work
Tasks
SDI Revision Log
CC
@tapios @sriharshakandala @charleskawczynski @cmbengue
The text was updated successfully, but these errors were encountered: