Doing my first steps in Julia, I often find that good examples from “official” sources don’t work because things change so quickly. This stiff PDE example returning error
"Scalar indexing is disallowed "
I googled this type of error and wrapped finite differences with exclusion condition:
CUDA.allowscalar() do du[II[i, j, 1]] = α * (u[II[im1, j, 1]] + u[II[ip1, j, 1]] + u[II[i, jp1, 1]] + u[II[i, jm1, 1]] - 4u[II[i, j, 1]]) + B + u[II[i, j, 1]]^2 * u[II[i, j, 2]] - (A + 1) * u[II[i, j, 1]] + brusselator_f(x, y, t) end
Now it works but performance is abysmal. Utilization of my 4090 is ~20-30% and this example is FP32! Computational time ~35 min:
What else need to be changed to perform well?