AscendIndexIVFConfig

API definition

inline AscendIndexIVFConfig();

Function

Default constructor. The default value of devices is 0, indicating that the 0th Ascend AI Processor is used for computation. The default value of resources is 128 MB, and the default value of useKmeansPP is false.

Input

N/A

Output

N/A

Return value

N/A

Restrictions

N/A

API definition

inline AscendIndexIVFConfig(std::initializer_list<int> devices, int64_t resourceSize = IVF_DEFAULT_MEM);

Function

Constructor of AscendIndexIVFConfig, which generates AscendIndexIVFConfig. The Ascend AI Processor resources on the device, resource pool size, and the default iteration number 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 IVF_DEFAULT_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 maximum number of device IDs is 64.
  • The value of resourceSize cannot exceed 4 × 1024 MB (4 × 1024 × 1024 × 1024 bytes). When resourceSize is set to -1, the default value 128 MB is used for the Ascend AI Processor resource on the device.

API definition

inline AscendIndexIVFConfig(std::vector<int> devices, int64_t resourceSize = IVF_DEFAULT_MEM);

Function

Constructor of AscendIndexIVFConfig, which generates AscendIndexIVFConfig. The Ascend AI Processor resources on the device, resource pool size, and the default iteration number are set based on the value configured in devices.

Input

std::vector<int> devices: device ID

int 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 IVF_DEFAULT_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 maximum number of device IDs is 64.
  • The value of resourceSize cannot exceed 4 × 1024 MB (4 × 1024 × 1024 × 1024 bytes). When resourceSize is set to -1, the default value 128 MB is used for the Ascend AI Processor resource on the device.