Faiss: Why GPU IVFPQ PQCodeLength max only support 96?

Created on 27 Aug 2019  Â·  3Comments  Â·  Source: facebookresearch/faiss

summary

When i use GPU IVFPQ train, the program throw an exception. I read the faiss code,
isSupportedPQCodeLength function max only support 96, but my pq size is 208.

  1. why the PQCode max limit 96?
  2. How train GPU IVFPQ when pq size is 208?
terminate called after throwing an instance of 'faiss::FaissException'
  what():  Error in void faiss::gpu::GpuIndexIVFPQ::verifySettings_() const at gpu/GpuIndexIVFPQ.cu:407: Error: 'IVFPQ::isSupportedPQCodeLength(subQuantizers_)' failed: Number of bytes per encoded vector / sub-quantizers (208) is not supported
bool
IVFPQ::isSupportedPQCodeLength(int size) {
  switch (size) {
    case 1:
    case 2:
    case 3:
    case 4:
    case 8:
    case 12:
    case 16:
    case 20:
    case 24:
    case 28:
    case 32:
    case 40:
    case 48:
    case 56: // only supported with float16
    case 64: // only supported with float16
    case 96: // only supported with float16
      return true;
    default:
      return false;
  }
}
GPU question

All 3 comments

Only a limited set of predefined code sizes are supported.
Have you considered using a pre-processing to reduce the code dimensionality?
https://github.com/facebookresearch/faiss/wiki/Pre--and-post-processing#pre-transforming-the-data

Due to GPU shared memory limitations (48 KiB per CTA), PQ on the GPU is restricted to 48, or 96 if useFloat16LookupTables is true (though this latter one may impact accuracy)

https://github.com/facebookresearch/faiss/blob/master/gpu/GpuIndexIVFPQ.h#L30

Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mylyu picture mylyu  Â·  3Comments

xxllp picture xxllp  Â·  3Comments

minjiaz picture minjiaz  Â·  3Comments

siva2k16 picture siva2k16  Â·  3Comments

danny1984 picture danny1984  Â·  3Comments