News for hackers. Stuff that matters.
Re:Vectorization: Introduction by saagarjha on Thursday June 01, 2023 @06:42PM (#36158438)
> Vectorization is a process by which floating-point computations in scientific code are compiled into special instructions that execute elementary operations (+,-,*, etc.) or functions (exp, cos, etc.) in parallel on fixed-size vector arrays.

I guess this is a scientific computing course or something but I feel like even so it’s important to point out that most processors have many vector instructions that operate on integers, bitfields, characters, and the like. The fundamental premise of “do a thing on a bunch of data at once” isn’t limited to just floating point operations.

Re:Vectorization: Introduction by westurner on Thursday June 01, 2023 @07:47PM (#36159017)
Vectorization (disambiguation) https://en.wikipedia.org/wiki/Vectorization :

> Array programming, a style of computer programming where operations are applied to whole arrays instead of individual elements

> Automatic vectorization, a compiler optimization that transforms loops to vector operations

> Image tracing, the creation of vector from raster graphics

> Word embedding, mapping words to vectors, in natural language processing

> Vectorization (mathematics), a linear transformation which converts a matrix into a column vector

Vector (disambiguation) https://en.wikipedia.org/wiki/Vector

> Vector (mathematics and physics):

> Row and column vectors, single row or column matrices

> Vector space

> Vector field, a vector for each point

And then there are a number of CS usages of the word vector for 1D arrays.

Compute kernel: https://en.wikipedia.org/wiki/Compute_kernel

GPGPU > Vectorization, Stream Processing > Compute kernels: https://en.wikipedia.org/wiki/General-purpose_computing_on_g...

sympy.utilities.lambdify.lambdify() https://github.com/sympy/sympy/blob/a76b02fcd3a8b7f79b3a88df... :

> """Convert a SymPy expression into a function that allows for fast numeric evaluation [with the CPython math module, mpmath, NumPy, SciPy, CuPy, JAX, TensorFlow, SymPt, numexpr,]

pyorch lambdify PR, sympytorch: https://github.com/sympy/sympy/pull/20516#issuecomment-78428...

sympytorch: https://github.com/patrick-kidger/sympytorch :

> Turn SymPy expressions into PyTorch Modules.

> SymPy floats (optionally) become trainable parameters. SymPy symbols are inputs to the Module.

sympy2jax https://github.com/MilesCranmer/sympy2jax :

> Turn SymPy expressions into parametrized, differentiable, vectorizable, JAX functions.

> All SymPy floats become trainable input parameters. SymPy symbols become columns of a passed matrix.

Re:Vectorization: Introduction by bee_rider on Friday June 02, 2023 @12:32AM (#36161091)
It seems odd in a scientific computing class to not mention classic cray style vectors. I mean, they haven’t been popular for a while, but you never know, RISC-V might bring them back.
Re:Vectorization: Introduction by Joker_vD on Friday June 02, 2023 @03:52AM (#36162351)
I thought I was crazy when looking at all those vector extensions piling up made me think "why not just have some generic-sized vector instructions, and then let the CPU to sort out what is the largest chunk size it actually supports internally" but apparently no, I am not! It was actually been done before and we might even have that again in the future. That's nice.
Re:Vectorization: Introduction by r3ndr on Friday June 02, 2023 @07:00AM (#36163566)
ARM's newer SVE/SVE2 instructions can do something like this now. SVE allows the vector length to vary between 128 and 2048 bits, at 128 bit increments. RISC-V's vector RVV instructions also allow the vector length to vary across different CPU implementations. This way, the same RVV vector code can run on different CPUs having different vector lengths.