Skip to content

Conversation

@ldeso
Copy link
Contributor

@ldeso ldeso commented Oct 5, 2022

Currently constructing ComponentArrays on the GPU with for example ComponentArray(a=CUDA.ones(2,3), b=CUDA.ones(4,5)) fails with an error.

ERROR: CuArray only supports element types that are stored inline

This fails because constructing the ComponentArray causes the creation of an array of arrays, which is not possible on the GPU. This happens in the pushcat! call at line 179 in componentarray.jl:

https://github.com/jonniedie/ComponentArrays.jl/blob/a7d6f7d126c5aeb711b65cf74eff8f8cbbeca5d0/src/componentarray.jl#L178-L182

This pull request fixes the issue by constructing the ComponentArray on the CPU and moving it back to the GPU afterwards.

Fixes #158. Needed for SciML/NeuralPDE.jl#594.

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2022

Codecov Report

Merging #166 (61801da) into master (a7d6f7d) will decrease coverage by 0.62%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #166      +/-   ##
==========================================
- Coverage   77.13%   76.50%   -0.63%     
==========================================
  Files          20       20              
  Lines         608      613       +5     
==========================================
  Hits          469      469              
- Misses        139      144       +5     
Impacted Files Coverage Δ
src/compat/gpuarrays.jl 65.78% <0.00%> (-9.97%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jonniedie jonniedie merged commit e991612 into SciML:master Oct 6, 2022
@jonniedie
Copy link
Collaborator

Cool, thanks!

@ldeso ldeso deleted the add-constructor-for-gpuarrays branch October 9, 2022 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix constructor for GPU arrays

3 participants