ClimaCoupler.jl icon indicating copy to clipboard operation
ClimaCoupler.jl copied to clipboard

animations aren't GPU compatible

Open juliasloan25 opened this issue 1 year ago • 0 comments

We want to set anim: true for GPU runs so we can see how they evolve over time, but the animations code is not GPU-compatible. There is some scalar indexing in experiments/AMIP/user_io/viz_explorer.jl that won't work on GPU. I think the fields being plotted (which are created on GPU) will need to be converted to fields on CPU before we can index into them and plot them, which would require fixing https://github.com/CliMA/ClimaCore.jl/issues/1296.

For now, we're adding the GPU runs to buildkite with anim: false, but we should address this soon. Once it's fixed, we can go back to all the GPU runs and turn on animations

ERROR: LoadError: Scalar indexing is disallowed. Invocation of getindex resulted in scalar indexing of a GPU array. This is typically caused by calling an iterating implementation of a method. Such implementations do not execute on the GPU, but very slowly on the CPU, and therefore are only permitted from the REPL for prototyping purposes. If you did intend to index this array, annotate the caller with @allowscalar. Stacktrace: [1] error(s::String) @ Base ./error.jl:35 [2] assertscalar(op::String) @ GPUArraysCore /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/GPUArraysCore/uOYfN/src/GPUArraysCore.jl:103 [3] getindex(A::CUDA.CuArray{Float64, 5, CUDA.Mem.DeviceBuffer}, I::Int64) @ GPUArrays /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/GPUArrays/dAUOE/src/host/indexing.jl:48 [4] getindex @ ./subarray.jl:297 [inlined] [5] _getindex @ ./abstractarray.jl:1321 [inlined] [6] getindex @ ./abstractarray.jl:1288 [inlined] [7] get_struct @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/ClimaCore/wYSFf/src/DataLayouts/struct.jl:218 [inlined] [8] getindex @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/ClimaCore/wYSFf/src/DataLayouts/DataLayouts.jl:730 [inlined] [9] getindex @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/ClimaCore/wYSFf/src/DataLayouts/DataLayouts.jl:728 [inlined] [10] rmatmul1(W::SMatrix{10, 4, Float64, 40}, S::ClimaCore.DataLayouts.IJF{Float64, 4, SubArray{…}}, i::Int64, j::Int64) @ ClimaCore.RecursiveApply /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/ClimaCore/wYSFf/src/RecursiveApply/RecursiveApply.jl:225 [11] tensor_product!(out::ClimaCore.DataLayouts.IJFH{…}, indata::ClimaCore.DataLayouts.IJFH{…}, M::SMatrix{…}) @ ClimaCore.Operators /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/ClimaCore/wYSFf/src/Operators/spectralelement.jl:2175 [12] _unfolded_pannel_matrix(field::ClimaCore.Fields.Field{…}, interpolate::Int64) @ ClimaCorePlots /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/ClimaCorePlots/F0ti0/src/ClimaCorePlots.jl:424 [13] macro expansion @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/ClimaCorePlots/F0ti0/src/ClimaCorePlots.jl:478 [inlined] [14] apply_recipe(plotattributes::AbstractDict{…}, field::ClimaCore.Fields.Field{…} where {…}) @ ClimaCorePlots /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/RecipesBase/BRe07/src/RecipesBase.jl:300 [15] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any) @ RecipesPipeline /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/RecipesPipeline/BGM3l/src/user_recipe.jl:38 [16] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any) @ RecipesPipeline /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/RecipesPipeline/BGM3l/src/RecipesPipeline.jl:72 [17] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any) @ Plots /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/Plots/HyyIK/src/plot.jl:223 [18] #plot#188 @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/Plots/HyyIK/src/plot.jl:102 [inlined] [19] plot @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/Plots/HyyIK/src/plot.jl:93 [inlined] [20] macro expansion @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/2597/climacoupler-ci/experiments/AMIP/user_io/viz_explorer.jl:18 [inlined] [21] macro expansion @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/depot/cpu/packages/Plots/HyyIK/src/animation.jl:251 [inlined] [22] plot_anim(cs::CoupledSimulation{…}, out_dir::String) @ Main /central/scratch/esm/slurm-buildkite/climacoupler-ci/2597/climacoupler-ci/experiments/AMIP/user_io/viz_explorer.jl:17 [23] top-level scope @ /central/scratch/esm/slurm-buildkite/climacoupler-ci/2597/climacoupler-ci/experiments/AMIP/coupler_driver.jl:725 in expression starting at /central/scratch/esm/slurm-buildkite/climacoupler-ci/2597/climacoupler-ci/experiments/AMIP/coupler_driver.jl:700

juliasloan25 avatar Feb 09 '24 20:02 juliasloan25