Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix avx 512 problem #430

Merged
merged 3 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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