Skip to content

Problem with MultiFESpace assembly #2

@bmxam

Description

@bmxam

The following code

module tmp
using Bcube
using BcubeAccelerated
using KernelAbstractions

mesh = one_cell_mesh(:line)

fs = FunctionSpace(:Lagrange, 1)
U_p = TrialFESpace(fs, mesh)
U_u = TrialFESpace(fs, mesh)

V_p = TestFESpace(U_p)
V_u = TestFESpace(U_u)

V = MultiFESpace(V_p, V_u)

dΩ = Measure(CellDomain(mesh), 1)
l((v_u, v_p)) = (v_p)dΩ

backend = BcubeAccelerated.BcubeBackendAcc(get_backend(ones(2)); kernel=BcubeAccelerated.KernelKA(), sync=false)
y = Bcube.allocate_dofs(V)
assemble_linear!(y, l, V; backend)
end

produces the following error:

ERROR: LoadError: MethodError: no method matching get_backend(::Tuple{SubArray{Float64, 1, Vector{…}, Tuple{…}, false}, SubArray{Float64, 1, Vector{…}, Tuple{…}, false}})
The function `get_backend` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  get_backend(::Bcube.BcubeBackendCPUSerial)
   @ BcubeAccelerated BcubeAccelerated\lh15Z\src\backend.jl:39
  get_backend(::RecursiveArrayTools.VectorOfArray)
   @ RecursiveArrayToolsKernelAbstractionsExt RecursiveArrayTools\jieUI\ext\RecursiveArrayToolsKernelAbstractionsExt.jl:6
  get_backend(::StaticArraysCore.MArray)
   @ KernelAbstractions KernelAbstractions\lGrz7\ext\StaticArraysExt.jl:7
  ...

Stacktrace:
 [1] KA_assemble!(y::Tuple{…}, f::Function, elts::Nothing, V::Bcube.MultiFESpace{…}, measure::Bcube.Measure{…}, backend::BcubeAccelerated.BcubeBackendAcc{…})
   @ BcubeAccelerated BcubeAccelerated\lh15Z\src\assembler.jl:49
 [2] __assemble_linear!(b::Tuple{…}, f::Function, V::Bcube.MultiFESpace{…}, measure::Bcube.Measure{…}, backend::BcubeAccelerated.BcubeBackendAcc{…})
   @ BcubeAccelerated BcubeAccelerated\lh15Z\src\assembler.jl:39
 [3] _assemble_linear!(b::Vector{…}, l::typeof(Main.tmp.l), V::Bcube.MultiFESpace{…}, integration::Bcube.Integration{…}, backend::BcubeAccelerated.BcubeBackendAcc{…})
   @ Bcube Bcube.jl\src\assembler\assembler.jl:241
 [4] assemble_linear!(b::Vector{…}, l::typeof(Main.tmp.l), V::Bcube.MultiFESpace{…}; backend::BcubeAccelerated.BcubeBackendAcc{…})
   @ Bcube Bcube.jl\src\assembler\assembler.jl:220
 [5] top-level scope
   @ BcubeMiniApps\stability\taylor-culick\tmp\tmp.jl:22
 [6] include(fname::String)
   @ Main .\sysimg.jl:38
 [7] top-level scope
   @ REPL[4]:1

This is because we reshape the vector b into a Tuple of SubArraywhen dealing with multi-fespaces. Maybe we should move

@assert backendKA == get_backend(y)
in Bcube, here :
https://github.com/bcube-project/Bcube.jl/blob/a0858c10c9a465720fefa4c9251e38baa82fec0c/src/assembler/assembler.jl#L240

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions