AscendIndexIVFSQConfig

AscendIndexIVFSQ requires the corresponding AscendIndexIVFSQConfig to initialize related resources.

AscendIndexIVFSQConfig

API definition

AscendIndexIVFSQConfig();

Function

Default constructor. The default value of devices is 0, indicating the 0th Ascend AI Processor is used for computing. The default value of resource is 384 MB.

Input

N/A

Output

N/A

Return value

N/A

Restrictions

N/A

API definition

inline AscendIndexIVFSQConfig(std::initializer_list<int> devices, int64_t resourceSize = IVFSQ_DEFAULT_TEMP_MEM);

Function

Constructor of AscendIndexIVFSQConfig, which is used to generate AscendIndexIVFSQConfig and perform default initialization. The Ascend AI Processor resources on the device and resource pool size are set based on the value configured in devices.

Input

std::initializer_list<int> devices: device ID

int64_t resourceSize: preset memory pool size on the device, in bytes. It is the memory space for storing intermediate results during computing to prevent performance fluctuation caused by dynamic memory allocation. The default parameter is IVFSQ_DEFAULT_TEMP_MEM in the header file. This parameter is determined by the database capacity and search batch size. If the database has 10 million vectors and batch size is greater than or equal to 16, set this parameter to 1024 MB.

Output

N/A

Return value

N/A

Restrictions

  • The value of devices must be a valid and unique device ID.
  • The value of resourceSize cannot exceed 4 × 1024 MB (4 × 1024 × 1024 × 1024 bytes).

API definition

inline AscendIndexIVFSQConfig(std::vector<int> devices, int64_t resourceSize = IVFSQ_DEFAULT_TEMP_MEM);

Function

Constructor of AscendIndexIVFSQConfig, which is used to generate AscendIndexIVFSQConfig and perform default initialization. The Ascend AI Processor resources on the device and resource pool size are set based on the value configured in devices.

Input

std::vector<int> devices: device ID

int64_t resourceSize: preset memory pool size on the device, in bytes. It is the memory space for storing intermediate results during computing to prevent performance fluctuation caused by dynamic memory allocation. The default parameter is IVFSQ_DEFAULT_TEMP_MEM in the header file. This parameter is determined by the database capacity and search batch size. If the database has 10 million records and batch size is greater than or equal to 16, set this parameter to 1024 MB.

Output

N/A

Return value

N/A

Restrictions

  • The value of devices must be a valid and unique device ID.
  • The value of resourceSize cannot exceed 4 × 1024 MB (4 × 1024 × 1024 × 1024 bytes).

SetDefaultIVFSQConfig

API definition

inline void SetDefaultIVFSQConfig();

Function

Performs the default initialization, sets the number of iterations to 16, and sets a maximum of 512 points for each centroid.

Input

N/A

Output

N/A

Return value

N/A

Restrictions

N/A