-
This question relates to #2360, but I don't think it's a repeat. Apologies if this is a naive question: I am new to Oceananigans, Julia, and GPU computing. SummaryI am running a simulation where my surface boundary condition is defined in terms of an array rather than a function. I am running the simulation on a GPU, so the array is a CuArray. When I try to read in the output data from the simulation after, using
I am using Oceananigans v0.93.1, CUDA v5.5.2 Minimal Working ExampleThe following minimal simulation can be used to reproduce the issue—the simulation runs without error, but loading the resulting output data produces the error
After running the simulation, trying to load the output data with
Note that Comparison to #2360#2360 also related to issues using
If, in my MWE, I replace More contextI am trying to run coupled simulations with Oceananigans and a sea ice discrete-element model. The ice model responds to the ocean currents and produces surface stress fields that affect the ocean, so those fields must be passed back and forth. The ice model produces stress fields as arrays.
While I can run the model like this, I don't know how to load the model output. Follow-up questionIn the various Oceananigans examples in the documentation, timeseries output is loaded to create animations of the results. Are there any simple examples available or suggested practices for further analysis/calculations using those outputs (e.g., computing various budgets, spectra, etc.)? I'm still wrapping my head around the Oceananigans/Julia variable structures and how to use them effectively. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Not a naive question! Though naive questions are fine. I would actually regard this as a bug. I am surprised we haven't run into it before... I think it's because we serialize the Oceananigans.jl/src/OutputWriters/output_writer_utils.jl Lines 133 to 141 in 6c40d7e we need an As a matter of best practice though I would try to use Qb = Field{Center, Center, Nothing}(grid) As your boundary condition, which comes with a bunch of benefits including participating in abstract operations, etc. I'm not sure that will fix your issue though...
You should be able to use
I'm not sure what you mean. I think the output writers should still work right?
The same operations that produce diagnostics for output can be used for post-processing. The horizontal convection example probably has the most post-processing. We don't have any example of computing spectra. Oceanostics might have something though. |
Beta Was this translation helpful? Give feedback.
-
Okay, PR #3893 may help. I think the example in the original post has a few elements that aren't needed. Is this more minimal? using Oceananigans
using CUDA
x = y = z = (0, 1)
grid = RectilinearGrid(GPU(); size=(1, 1, 1), x, y, z)
τx = CuArray(zeros(size(grid)...))
u_bcs = FieldBoundaryConditions(top = FluxBoundaryCondition(τx))
model = NonhydrostaticModel(; grid, boundary_conditions = (; u=u_bcs))
simulation = Simulation(model; Δt=1, stop_iteration=1)
simulation.output_writers[:jld2] = JLD2OutputWriter(model, model.velocities,
filename = "test_cuarray_bc.jld2",
schedule=IterationInterval(1),
overwrite_existing = true)
run!(simulation)
# Later, without a CPU...
using Oceananigans
ut = FieldTimeSeries("test_cuarray_bc.jld2", "u")
Actually no, this error works even when a GPU is available. Which makes sense, because the problem is that the grid is converted to CPU but the boundary conditions are not. |
Beta Was this translation helpful? Give feedback.
-
@sdbrenner #3893 is merged |
Beta Was this translation helpful? Give feedback.
Not a naive question! Though naive questions are fine.
I would actually regard this as a bug. I am surprised we haven't run into it before...
I think it's because we serialize the
CuArray
boundary condition directly (which we should not do). But when it's a function we do nothing, egOceananigans.jl/src/OutputWriters/output_writer_utils.jl
Line 147 in 6c40d7e
Oceananigans.jl/src/OutputWriters/output_writer_utils.jl
Lines 133 to 141 in 6c40d7e