AscendIndexConfig
AscendIndex requires the corresponding AscendIndexConfig to initialize related resources. In AscendIndexConfig, you need to configure the hardware resources and memory pool size during the retrieval process.
The unit of the memory pool size is byte, and the value specifies the size of the memory pool reserved on the device. The memory pool is used to store the distance calculation results on the Ascend hardware. If the database is large, you are advised to reserve a larger memory pool size.
Member Description
Member |
Type |
Description |
|---|---|---|
deviceList |
std::vector<int> |
Device ID |
resourceSize |
int64_t |
Memory pool size on the device, in byte. The default parameter is INDEX_DEFAULT_MEM in the header file. |
slim |
bool |
AscendIndexConfig member variable, indicating whether to dynamically increase the memory. |
filterable |
bool |
AscendIndexConfig member variable, indicating whether to perform filtering by ID. |
dBlockSize |
uint32_t |
Block size on the device. |
API Description
API definition |
AscendIndexConfig() |
|---|---|
Function |
Default constructor of AscendIndexConfig. By default, the specified device list is 0 (that is, the 0th Ascend AI Processor is specified as the heterogeneous computing platform for AscendFaiss to perform retrieval). The default resource pool size is 32 MB (32 × 1024 × 1024 bytes). |
Input |
N/A |
Output |
N/A |
Return value |
N/A |
Restrictions |
N/A |
API definition |
AscendIndexConfig(std::initializer_list<int> devices, int64_t resources = INDEX_DEFAULT_MEM, uint32_t blockSize = DEFAULT_BLOCK_SIZE) |
|---|---|
Function |
Constructor of AscendIndexConfig, which is used to generate AscendIndexConfig. The Ascend AI Processorresources on the device and the resource pool size are configured based on the value configured in devices. |
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 INDEX_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: block size on the device, which limits the amount of data calculated by the TIK operator at a time and the size of each vector stored after database sharding. The default value of DEFAULT_BLOCK_SIZE is 262144 (16384 × 16). |
Output |
N/A |
Return value |
N/A |
Restrictions |
|
API definition |
AscendIndexConfig(std::vector<int> devices, int64_t resources = INDEX_DEFAULT_MEM, uint32_t blockSize = DEFAULT_BLOCK_SIZE) |
|---|---|
Function |
Constructor of AscendIndexConfig, which is used to generate AscendIndexConfig. The Ascend AI Processorresources on the device and the resource pool size are configured based on the value configured in devices. |
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 INDEX_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: block size on the device, which limits the amount of data calculated by the TIK operator at a time and the size of each vector stored after database sharding. The default value of DEFAULT_BLOCK_SIZE is 262144 (16384 × 16). |
Output |
N/A |
Return value |
N/A |
Restrictions |
|