CUDA.jl - Memory Efficient Operations, Manipulations and Calculations on Large Sparse Arrays

moukann
Mon, 20 Jun 2022 20:43:12 +0000
GPU

Hello all,

I formerly created this topic, my problem is continuing until this day:

CUDA.jl - Atomic Addition Error To A Sparse Array Inside CUDA Kernel GPU

Hello all, I am trying to assemble many individual elements of a huge system to a global system. The global system is sparse, It is a certain thing. Also it is wasteful to store all zero elements in memory, I just need the nonzero elements. So I wanted to use a sparse array for my program. If I use a classical “zeros” array, I don’t get an error. However if I change the type to sparse array, I get an error. Example code: clearconsole() # Import related libraries using CUDA using StaticArrays …

The problem is related to GPU RAM and its size. The global system is a square matrix, consisting of Float64 values. However, it is mostly sparse, at least %90 of the values are zero values. If I increase the simulation size, the degree of freedom of the system increases. The degree of freedom determines the global system matrix size. At some point, I instantly get a memory error. The GPU tells me that it is not possible to allocate more memory, it is already using %100 of the memory, which is a reasonable error. I am trying to solve this memory error. Currently, I am limited to a certain simulation size due to memory constraints.

I wanted to use a sparse array type. However, atomic addition to sparse arrays is not supported, I already created a topic about this. My question is that how can I overcome this issue? I could not find a way to solve this problem. CUDA.jl provided me with over 7000x speed-up with the program, the only missing part is related to the simulation size.

1. I do not want to store all the values, my global system is mostly sparse. Which array type can I use? Is there another library compatible with CUDA threads to store giant matrices, etc.?

2. Recording the data to a TXT file is a solution but as far as I understand this does not seem possible. Is @cuprintln(filename, “text”) supported like in the original println function? Also, this would disrupt the speed-up process but I can sacrifice some speed to be able to run larger simulations. Is there a way to output thread solutions to HDD or SSD to construct sparse arrays?

3. Or any other solution that I cannot think of.

7000x speed-up is not a crucial thing, I already had a reasonable speed-up. The remaining problem is about GPU hardware, storage and simulation size. It is more important for me to run larger simulations than having a lightning-speed simulation. Running any size simulation with 1000x speed-up is much more valuable than restricted 7000x speed-up. Is there an intelligent way to store this kind of giant matrix minimally on GPU RAM or any other computer hardware? Thank you so much.

7 posts - 3 participants