Skip to content

Commit

Permalink
Merge pull request #430 from spotify/fix-402
Browse files Browse the repository at this point in the history
fix avx 512 problem
  • Loading branch information
Erik Bernhardsson authored Oct 11, 2019
2 parents 7acd413 + 52cdbd0 commit 86e13c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
extra_compile_args = []
extra_link_args = []

if os.environ.get('TRAVIS') == 'true':
# Resolving some annoying issue
extra_compile_args += ['-mno-avx']

# Not all CPUs have march as a tuning parameter
cputune = ['-march=native',]
if platform.machine() == 'ppc64le':
Expand Down
12 changes: 8 additions & 4 deletions src/annoylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ typedef unsigned __int64 uint64_t;
#define popcount cole_popcount
#endif

#ifndef NO_MANUAL_VECTORIZATION
#if defined(__AVX512F__)
#if !defined(NO_MANUAL_VECTORIZATION) && defined(__GNUC__) && (__GNUC__ >6) && defined(__AVX512F__) // See #402
#pragma message "Using 512-bit AVX instructions"
#define USE_AVX512
#elif defined(__AVX__) && defined (__SSE__) && defined(__SSE2__) && defined(__SSE3__)
#elif !defined(NO_MANUAL_VECTORIZATION) && defined(__AVX__) && defined (__SSE__) && defined(__SSE2__) && defined(__SSE3__)
#pragma message "Using 128-bit AVX instructions"
#define USE_AVX
#endif
#else
#pragma message "Using no AVX instructions"
#endif

#if defined(USE_AVX) || defined(USE_AVX512)
Expand Down Expand Up @@ -989,6 +991,8 @@ template<typename S, typename T, typename Distance, typename Random>
// Delete file if it already exists (See issue #335)
unlink(filename);

printf("path: %s\n", filename);

FILE *f = fopen(filename, "wb");
if (f == NULL) {
showUpdate("Unable to open: %s\n", strerror(errno));
Expand Down

0 comments on commit 86e13c0

Please sign in to comment.