As I mentioned in my previous posts I am new to Julia and am planning to dive into it.
For the following question I have been looking into the Julia 1.7 Documentation, but have not found an answer or explanation - if I have overlooked something then please point me towards it.
I would like to store an array whose elements consist of numbers only in the range 0…9, that means a 4bit-array with elements of 4bit size filled with UInt4 numbers would be enough, but neither such arrays nor Uint4 do exist. Storing numbers in the range 0…9 in an UInt8 array would be certainly possible, but the latter seems to be a waste of RAM as the planned array is of huge size anyway. These numbers are only results, they would not be used in further calculations.
Now my question is:
To store such single numbers in the range 0…9, what is not only the EASIEST way but also the FASTEST way in Julia at program execution time to store them in an array?
Yes, we’re mostly just performing elementwise byte operations of bit shifting, >> or << and or &. This can be done in parallel. CPU vector instructions via SIMD are quite fast at this, but GPUs are also fast. The question is if the GPU is fast enough to overcome the time needed to transfer memory to the GPU and back, assuming that your other workflows use the CPU. You might be able to use GPUDirect technology to transfer data directly from GPU memory to and from disk.