Skip to content

GPU compilation issue for body using multiple HashedLocators #30

@JulienL29

Description

@JulienL29

Hi, I am trying to do a simulation with multiple moving parametric bodies.
Here is the script that I use :

using WaterLily,StaticArrays,Plots
using ParametricBodies

function make_sim(;nb_blade=1,L=48,Re=50000,U=1,λ=0.1f0,e=0.6f0,T=Float32,mem=Array)
    X,Y=2^4*floor(Int,L),2^3*floor(Int,L)
    O = SA[0.3f0*X,0.5f0*Y]           #center of rotor
    r=T(2L)
    ω=T(U/(λ*r))   

    function NACA(s)
        return 0.6f0*(0.2969f0(s)-0.126f0(s)^2-0.3516f0(s)^4+0.2843f0(s)^6-0.1036f0(s)^8)
    end
    function foil(s,t)
        return L*SA[(1-s)^2-0.33f0,NACA(1-s)]
    end

    body = sum(1:nb_blade) do blade
        ϕ = T(2π*blade/nb_blade)
        function map(x,t)
            θ = ω*(t*U/L)
            OP = SA[r*sin(θ+ϕ), -r*cos(θ+ϕ)] 
            P=O+OP
            ON=SA[0,-e*r]
            N=O+ON
            NP=P-N
            β=atan(NP[2],NP[1])-atan(OP[2],OP[1])
            R = SA[cos(β+θ+ϕ) sin(β+θ+ϕ); -sin(β+θ+ϕ) cos(β+θ+ϕ)] #rotation matrix for the angle of attack
            ξ = -R*(x-O-OP) 
            return SA[ξ[1],abs(ξ[2])] 
        end
        ParametricBody(foil,HashedLocator(foil,(0,1);T,mem);map)
    end
    Simulation((X,Y),(U,0),L;ν=U*L/Re,body,T,mem)
end

using CUDA
sim = make_sim(nb_blade=2,mem=CuArray)

When I use make_sim with nb_blade=1, the simulation runs correctly on GPU but when nb_blade=2 or more, I have this error message :

ERROR: GPU compilation of MethodInstance for (::WaterLily.var"#gpu_##kern_#567#252"{…})(::KernelAbstractions.CompilerMetadata{…}, ::CuDeviceArray{…}, ::CuDeviceArray{…}, ::CuDeviceArray{…}, ::CuDeviceMatrix{…}, ::CartesianIndex{…}) failed
KernelError: passing non-bitstype argument

I think that this is coming from using a sum of moving parametrics bodies but I don't understand of why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions