Skip to content

Legendre transforms

Martin Reinecke requested to merge legtrans into master

Created by: dagss

Legendre transforms copied from the Commander 2 project, then modified to use Libsharp's vecsupport.h.

I've added some extra functions in vecsupport, in particular loadu for vector loads, and single precision versions of the functions I needed.

The Makefile now depends on md5sum and cut to verify that legendre_transform.c.in hasn't changed. If it does change, a Python installation with Jinja is needed to build.

I've also added a very small Python wrapper for Legendre transforms, which I used to write the test suite. Like the Fortran wrapper it doesn't affect the rest, just lies there, except make pytest will build it and run tests.

It's tested on VLEN=1,2,4 and USE_FMA=0,1. It is not tested on MIC. Currently building on MIC will fail; we could change this to exclude the Legendre transforms, or Martin tests this on MIC..

There's three new compilation flags:

  • -DVLEN=2: Override detection by defining a vector length (in order to test VLEN 2 and 1 on an AVX machine)
  • -DUSE_FMA4=0 To turn off FMA4 on a machine supporting it
  • -DNO_LEGENDRE=1 To turn off Legendre transforms. This is currently needed to build on MIC until the feature is tested...
  • -DSHARP_LEGENDRE_CS=4 How many vectors to put in CPU pipeline at the time; I once benchmarked 4 to be best and simply default to this rather than tune for now.

Tested cases:

  • VLEN=1
  • VLEN=2
  • VLEN=4 with FMA
  • [x ] VLEN=4 without FMA
  • VLEN=8

To test

make && make pytest

Merge request reports