You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Simulation tips section of the docs probably needs updating. For example it says
For example, if can be difficult to just view a CuArray since Julia needs to access its elements to do that. Consider the example below:
This example is contrived though; the problem is that the show method for OffsetArrays has scalar indexing. But the show method for CuArray works fine, so
julia>using Oceananigans
julia> grid =RectilinearGrid(GPU(), size=(1, 1, 1), extent=(1, 1, 1), halo=(1, 1, 1))
1×1×1 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on GPU with 1×1×1 halo
├── Periodic x ∈ [0.0, 1.0) regularly spaced with Δx=1.0
├── Periodic y ∈ [0.0, 1.0) regularly spaced with Δy=1.0
└── Bounded z ∈ [-1.0, 0.0] regularly spaced with Δz=1.0
julia> c =CenterField(grid)
1×1×1 Field{Center, Center, Center} on RectilinearGrid on GPU
├── grid:1×1×1 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on GPU with 1×1×1 halo
├── boundary conditions: FieldBoundaryConditions
│ └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: ZeroFlux
└── data:3×3×3OffsetArray(::CUDA.CuArray{Float64, 3, CUDA.Mem.DeviceBuffer}, 0:2, 0:2, 0:2) with eltype Float64 with indices 0:2×0:2×0:2
└── max=0.0, min=0.0, mean=0.0
julia> c.data.parent
3×3×3 CUDA.CuArray{Float64, 3, CUDA.Mem.DeviceBuffer}:
[:, :, 1] =0.00.00.00.00.00.00.00.00.0
[:, :, 2] =0.00.00.00.00.00.00.00.00.0
[:, :, 3] =0.00.00.00.00.00.00.00.00.0
The example also creates a model which is probably overkill, a Field would do.
Also, the example uses
julia>adapt(Array, model.velocities.u.data)
To show an array on CPU. But we have a built-in method on_archiecture(CPU(), field) that would probably be better to use, since its more flexible and also generalizes to distributed architectures, etc...
The text was updated successfully, but these errors were encountered:
will throw an error if run on the GPU (and will run more slowly than it should on the CPU).
is wrong since the above code does not error. I believe the error will pop up down the line, when we try to pass this boundary condition to a model that uses a grid that lives on the GPU.
The Simulation tips section of the docs probably needs updating. For example it says
This example is contrived though; the problem is that the
show
method forOffsetArrays
has scalar indexing. But theshow
method forCuArray
works fine, soThe example also creates a
model
which is probably overkill, aField
would do.Also, the example uses
To show an array on CPU. But we have a built-in method
on_archiecture(CPU(), field)
that would probably be better to use, since its more flexible and also generalizes to distributed architectures, etc...The text was updated successfully, but these errors were encountered: