MJ Rutter's Accelerated Linpack Sources

This page follows on from my page of very unofficial Linpack sources, but concentrates on sources using some form of offloading.

cuSOLVER and C

Nvidia's cuSOLVER library has some LAPACK-equivalent routines, but they use different arguments and do not handle copying data from the CPU to the GPU themselves. So I wrote a rather poor wrapper (it does not check error codes!) to represent cuSOLVER in the expected form for dgesv and sgesv.

So, from the C section of the previous page of sources, take one of

linpack.c (using Fortran dgesv and C rand()) or
linpack_with_rand.c (ditto, but own random number generator)

Add cuda_gesv.c, and compile as

gcc linpack.c cuda_gesv.c -lcusolver -lcudart

One can also use this with linpack_s.c, which is linpack.c rewritten as single precision. This will give much better performance on consumer grade GPUs.

MAGMA and C

linpack_magma.c (double precision) and
linpack_magma_s.c (single precision)

The MAGMA library library supports offloading to various different devices.

Python and PyTorch

linpack_torch_numpy.py lightly modified numpy code
linpack_torch.py numpy-free code.

To change this version to single precision, change the one instance of torch.float64 to torch.float32.

Python and JAX

linpack_jax_numpy.py lightly modified numpy code
linpack_jax.py numpy-free code.

To change this version to single precision, remove the jax.config.update line.

Back to Linpack page.