Skip to content

RAM usage during training of the IVF65536,PQ64 index #2301

@XingxingZhang

Description

@XingxingZhang

Summary

I intended to train an "IVF65536,PQ64" index with 20 million 1024d vectors on a server with 400G RAM and 4 x V100 (16G) GPUs.
It ran out of memory. I know these vectors already take ~80G RAM even without doing anything.

My questions are

  1. How much RAM is needed to train such an index (i.e., "IVF65536,PQ64") with 20M 1024d vectors?
  2. Are there ways to optimize the RAM usage?

Thanks

Platform

OS: Ubuntu 18.04.6 LTS

Faiss version: 1.7.2

Installed from: pip install faiss-gpu

Faiss compilation options:

Running on:

  • GPU

Interface:

  • Python

Reproduction instructions

dim = 1024
index_type = "IVF65536,PQ64"
index = faiss.index_factory(dim, index_type)

# move to gpus
co = faiss.GpuMultipleClonerOptions()
co.useFloat16 = True
gpu_index = faiss.index_cpu_to_all_gpus(index, co)

# train
# x.shape = (20*1000*1000, 1024)
gpu_index.train(x)
# Error Message from OS: "Killed PID"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions