faiss/c_api/gpu/CMakeLists.txt
Ramil Bakhshyiev a757309408 ROCm CMake configuration cleanup (#3716)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3716

Renaming `USE_ROCM` to `FAISS_ENABLE_ROCM` in CMake files, `FAISS_ENABLE_ROCM` in SWIG files, and `USE_AMD_ROCM` in other source files to follow the existing naming convention.

Reviewed By: mnorris11

Differential Revision: D60673731

fbshipit-source-id: 1aaa3f2ff6836830c4eb733ee7f41554f79f9695
2024-08-02 15:07:01 -07:00

29 lines
914 B
CMake

# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
target_sources(faiss_c PRIVATE
DeviceUtils_c.cpp
GpuAutoTune_c.cpp
GpuClonerOptions_c.cpp
GpuIndex_c.cpp
GpuResources_c.cpp
StandardGpuResources_c.cpp
)
file(GLOB FAISS_C_API_GPU_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
faiss_install_headers("${FAISS_C_API_GPU_HEADERS}" c_api/gpu)
if (FAISS_ENABLE_ROCM)
target_link_libraries(faiss_c PUBLIC hip::host roc::hipblas)
else()
find_package(CUDAToolkit REQUIRED)
target_link_libraries(faiss_c PUBLIC CUDA::cudart CUDA::cublas
$<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft>
$<$<BOOL:${FAISS_ENABLE_RAFT}>:nvidia::cutlass::cutlass>)
endif()
add_executable(example_gpu_c EXCLUDE_FROM_ALL example_gpu_c.c)
target_link_libraries(example_gpu_c PRIVATE faiss_c)