zpzim / SCAMP

The fastest way to compute matrix profiles on CPU and GPU!
http://www.cs.ucr.edu/~eamonn/MatrixProfile.html
MIT License
155 stars 35 forks source link

Allow SCAMP binaries to be optionally redistributable #99

Closed zpzim closed 2 years ago

zpzim commented 2 years ago

Since the beginning of the project, SCAMP has used -march=native and the like to maximize CPU performance on the host system. Unfortunately, this also makes it so we can't redistribute SCAMP binaries or pyscamp wheels, etc.

This PR adds an optional flag to remove compiler flags which are not redistributable SCAMP_ENABLE_BINARY_DISTRIBUTON

In order to retain some semblance of performance in this mode. I have added code paths in the cpu kernel library which will execute based on runtime checks of the host CPU architecture.

In particular, there is a code path for AVX and AVX2. These paths will only be triggered if the FMA instruction is also available (this should be true the vast majority of the time).

I did not add an AVX512 path as I don't have a way to test that locally. It might be useful to add one in the future.