Skip to content
Discussion options

You must be logged in to vote

Welcome @neetscience to vector search! The great news is that transitioning to the GPU in Faiss is incredibly simple. You don't need to rewrite your indexing logic—Faiss has a built-in helper function called index_cpu_to_gpu that handles copying the vectors from your system memory over to the GPU's memory.

Here is a complete, concise example that runs perfectly in a Google Colab T4 instance. Note that we are installing faiss-gpu-cu12 since Colab uses CUDA 12!

# 1. Install the modern CUDA 12 package for Google Colab
!pip install faiss-gpu-cu12

import faiss
import numpy as np

# 2. Generate dummy database and query vectors
dimension = 128
database_size = 10000
xb = np.random.random((databa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@neetscience
Comment options

Answer selected by neetscience
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants