GPU support
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
Direzione di ricerca
Inizia riproducendo i due casi segnalati: eseguire il broadcasting di una RuntimeGeneratedFunction su un CuVector e chiamare un kernel generato con @cuda. Traccia come RuntimeGeneratedFunction viene abbassata in ciascun percorso; il lavoro è completato quando il broadcasting GPU e i kernel vengono compilati senza argomenti non-isbits né un ritorno Any.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I've been using this project to circumvent the world age problems when generating functions and it has worked great so far.
Now I'm trying to also generate functions to run on the GPU, CUDA for now to be specific. There are two ways that I've tried to do that. The first is simply broadcasting the function on a CuVector, however, this does not work because RuntimeGeneratedFunctions are not isbits, which CUDA.jl does not like:
julia> func.(cu_inputs)
ERROR: GPU compilation of MethodInstance for (::GPUArrays.var"#34#36")(::CUDA.CuKernelContext, ::CuDeviceVector{ComplexF64, 1}, ::Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{…}, Tuple{…}, RuntimeGeneratedFunction{…}, Tuple{…}}, ::Int64) failed
KernelError: passing and using non-bitstype argument
Argument 4 to your kernel function is of type Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{1, CUDA.Mem.DeviceBuffer}, Tuple{Base.OneTo{Int64}}, RuntimeGeneratedFunction{(:data_input,), ComputableDAGs.var"#_RGF_ModTag", var"#_RGF_ModTag", (0x3d86ea6b, 0x46940344, 0xf0c50769, 0x501ce261, 0x5c3fa2fa), Expr}, Tuple{Base.Broadcast.Extruded{CuDeviceVector{<LongArgumentType...>, 1}, Tuple{Bool}, Tuple{Int64}}}}, which is not isbits:
.f is of type RuntimeGeneratedFunction{(:data_input,), ComputableDAGs.var"#_RGF_ModTag", var"#_RGF_ModTag", (0x3d86ea6b, 0x46940344, 0xf0c50769, 0x501ce261, 0x5c3fa2fa), Expr} which is not isbits.
.body is of type Expr which is not isbits.
.head is of type Symbol which is not isbits.
.args is of type Vector{Any} which is not isbits.
The other option is to use @cuda and call a (generated) kernel. However, this also does not work as RuntimeGeneratedFunctions seem to always return an Any, and GPU kernels are not allowed to return anything:
julia> @cuda kernel(cu_inputs, cu_outputs, 1000)
ERROR: GPU compilation of MethodInstance for (::RuntimeGeneratedFunction{(:input_vector, :output_vector, :n), CUDAExt.var"#_RGF_ModTag", var"#_RGF_ModTag", (0x26ea8e24, 0xf73e2d2a, 0xb1e0f07e, 0x53860e81, 0xc0771049), Expr})(::CuDeviceVector{PhaseSpacePoint{…}, 1}, ::CuDeviceVector{Float64, 1}, ::Int64) failed
KernelError: kernel returns a value of type `Any`
Make sure your kernel function ends in `return`, `return nothing` or `nothing`.
It would be great if compatibility for GPU broadcasting and kernels could be added. Looking at the code in this package, I don't understand how it is doing what it is doing so I don't think I can add support myself. It seems that fixing the return nothing problem with kernels might not be too hard though.
- Lingua principale
- Julia
- Stelle
- 114
- Fork
- 19
- Merge medio
- 2h 42m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SciML/RuntimeGeneratedFunctions.jl
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
RGFs built after a module is re-evaluated at the same path get the old module's id and run its codeAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Can crash julia on 1.13?Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
SciML/RuntimeGeneratedFunctions.jl#114 · 1 commento ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
SciML/RuntimeGeneratedFunctions.jl#100 · 1 commento ·
-
bug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
SciML/RuntimeGeneratedFunctions.jl#92 · 1 commento ·
Tutte le issue di SciML/RuntimeGeneratedFunctions.jl
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
MagneticResonanceImaging/MRIReco.jl#366 ·
I maintainer di solito rispondono entro 3 giorni
-
`AdamW` gives `NaN` for zero-gradient entries of `Float16` parameters (epsilon underflows to 0)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
FluxML/Optimisers.jl#253 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
JuliaGraphs/GraphNeuralNetworks.jl#736 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno