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
Sometimes, minimum on a field does not return the correct value on GPU. It depends on the size of the field. For the MWE, it fails when it is size 129 = 2^7 + 1.
To Reproduce
The value should be 1.0 and not 0.0.
using ClimaComms
ClimaComms.@import_required_backendsusing Logging
import ClimaCore:
Domains,
Meshes,
Operators,
Spaces,
Quadratures,
Topologies
FT = Float64
context = ClimaComms.context()
ClimaComms.init(context)
logger_stream = ClimaComms.iamroot(context) ?stderr:devnull
prev_logger =global_logger(ConsoleLogger(logger_stream, Logging.Info))
# Set up discretization
ne =129
Nq =4
ndof = ne * ne *6* Nq * Nq
@info"Configuration" device = context.device nprocs =
ClimaComms.nprocs(context) Ne = ne Nq = Nq ndof = ndof FT = FT
R =FT(6.37122e6) # radius of earth
domain = Domains.SphereDomain(R)
mesh = Meshes.EquiangularCubedSphere(domain, ne)
quad = Quadratures.GLL{Nq}()
grid_topology = Topologies.Topology2D(context, mesh)
space = Spaces.SpectralElementSpace2D(grid_topology, quad)
min_val =minimum(ones(space))
Or even better, add it as a unit test, and open pull request.
The algorithm splits all the points into threads and blocks, with each block computing 7 points. The way this is done, however, leads to the last block having fewer than nthreads.
We can see this in this line:
nblocks = cld(nitems, effective_blksize)
For the case in the first message, nitems = 1597536, nitems/2048 = 780.046875, and the algorithm picks nblock = 781. However, the last block has several threads that don't work on any point. So, the reduction shared array is not fully updated and when reducing we see our init value (0). This also explains why the bug is only in the minimum, because the maximum is always greater than the init, so the incorrect values are not propaged (for positive quantities).
Describe the bug
Sometimes,
minimum
on a field does not return the correct value on GPU. It depends on the size of the field. For the MWE, it fails when it is size 129 = 2^7 + 1.To Reproduce
The value should be
1.0
and not0.0
.Or even better, add it as a unit test, and open pull request.
Project
If not using the `examples` project:
System details
Any relevant system information:
module list
)I did not ran this on the cluster
Related issues / PRs
extrema
gives different results onFields
vs parent arrays ClimaAtmos.jl#2993The text was updated successfully, but these errors were encountered: