AscendIndexIVFSPConfig

AscendIndexIVFSP requires the corresponding AscendIndexIVFSPConfig to initialize the related resources.

Common Parameters

Parameter

Data Type

Description

handleBatch

int

Number of candidate buckets for each computing during retrieval. The default value is 64.

nprobe

int

Total number of candidate buckets during retrieval. The default value is 64.

searchListSize

int

Maximum number of samples in each bucket for each computing during retrieval. The default value is 32768.

If the bucket is too large, the program automatically splits the bucket into multiple operators based on searchListSize for distance calculation.

API Description

API definition

inline AscendIndexIVFSPConfig();

Function

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

Input

N/A

Output

N/A

Return value

N/A

Restrictions

N/A

API definition

inline explicit AscendIndexIVFSPConfig(std::initializer_list<int> devices, int64_t resources = IVF_SP_DEFAULT_MEM, uint32_t blockSize = DEFAULT_BLOCK_SIZE);

Function

Constructor of AscendIndexIVFSPConfig, which is used to generate AscendIndexIVFSPConfig and specify the device ID and resource pool size on the device.

Input

std::initializer_list<int> devices: device ID

int64_t resources: 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_SP_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.

uint32_t blockSize: size of the preset memory block, in bytes. The default parameter is DEFAULT_BLOCK_SIZE in the header file.

Output

N/A

Return value

N/A

Restrictions

  • The value of devices must be a valid and unique device ID. Currently, only one NPU is supported.
  • The value of resources cannot exceed 4 × 1024 MB (4 × 1024 × 1024 × 1024 bytes).

API definition

inline explicit AscendIndexIVFSPConfig(std::vector<int> devices, int64_t resources = IVF_SP_DEFAULT_MEM, uint32_t blockSize = DEFAULT_BLOCK_SIZE);

Function

Constructor of AscendIndexIVFSPConfig, which is used to generate AscendIndexIVFSPConfig and specify the device ID and resource pool size on the device.

Input

std::vector<int> devices: device ID

int64_t resources: 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_SP_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.

uint32_t blockSize: size of the preset memory block, in bytes. The default parameter is DEFAULT_BLOCK_SIZE in the header file.

Output

N/A

Return value

N/A

Restrictions

  • The value of devices must be a valid and unique device ID. Currently, only one NPU is supported.
  • The value of resources cannot exceed 4 × 1024 MB (4 × 1024 × 1024 × 1024 bytes).