Skip to content

Commit

Permalink
Fix AVX512 build targets in CMakeLists.txt (#3214)
Browse files Browse the repository at this point in the history
Summary:
When `FAISS_OPT_LEVEL=avx512`, the current default target omits the `avx2` build, which conflicts with the install targets that specify both `avx2` and `avx512` builds. This PR fixes the default build targets for AVX512.

Install targets:

https://github.com/facebookresearch/faiss/blob/e19de27d72b47bb8782bc173725c45c46c9782eb/faiss/CMakeLists.txt#L332

With this PR, cmake can build and install without any error.

```bash
cmake -B build -DFAISS_OPT_LEVEL=avx512 .
cmake --build build --config Release -j
cmake --install build
```

Pull Request resolved: #3214

Reviewed By: mlomeli1

Differential Revision: D52996716

Pulled By: algoriddle

fbshipit-source-id: b8a46eee6cc15c2043a1a74c5e15d7a606e94acc
  • Loading branch information
kyamagu authored and facebook-github-bot committed Jan 24, 2024
1 parent 99c0e2b commit 63edc32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion faiss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ set(FAISS_HEADERS ${FAISS_HEADERS} PARENT_SCOPE)
add_library(faiss ${FAISS_SRC})

add_library(faiss_avx2 ${FAISS_SRC})
if(NOT FAISS_OPT_LEVEL STREQUAL "avx2")
if(NOT FAISS_OPT_LEVEL STREQUAL "avx2" AND NOT FAISS_OPT_LEVEL STREQUAL "avx512")
set_target_properties(faiss_avx2 PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
if(NOT WIN32)
Expand Down

0 comments on commit 63edc32

Please sign in to comment.