The CuArrays package is probably the most significant part of the GPU ecosystem in Julia. It provides an array type for storing data on the GPU and operating on it. Since GPU code needs to be vectorized, an array is the primary data type that needs to be used in all cases.Â
A CuArray datatype can be created by calling its constructor with a regular Julia array. Once created, GPU kernels may be called on it. The package includes kernels for basic mathematical operators, which are typically called via dot-broadcast. As with all broadcasts in Julia, the operations are fused, which means that on the GPU, a single fused kernel is run on the array, even though multiple operations exist on the source. In other words, the power, subtraction, multiplication, addition, and squaring in the following expression is all combined into a single block of processing:Â
julia>...