AscendIndexSQConfig

AscendIndexSQ requires the corresponding AscendIndexSQConfig to initialize related resources.

API definition

inline AscendIndexSQConfig()

Function

Default constructor of AscendIndexSQConfig. By default, deviceList is set to 0, indicating that the 0th Ascend AI Processor is specified as the heterogeneous computing platform for AscendFaiss to perform retrieval. In addition, the resource pool size is fixed to the default value.

Input

N/A

Output

N/A

Return value

N/A

Restrictions

N/A

API definition

inline AscendIndexSQConfig(std::initializer_list<int> devices, int64_t resourceSize = SQ_DEFAULT_MEM, uint32_t blockSize = DEFAULT_BLOCK_SIZE)

Function

Constructor of AscendIndexSQConfig, which is used to generate AscendIndexSQConfig. The Ascend AI Processor resources 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 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 SQ_DEFAULT_MEM defined 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 restricts 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 is 262144 (16384 × 16). This value affects the maximum number of indexes that can be created and the retrieval performance.

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.
  • The value of blockSize can be {16384 × 8, 16384 × 16, 16384 × 32, 16384 × 64}.

API definition

inline AscendIndexSQConfig(std::vector<int> devices, int64_t resourceSize = SQ_DEFAULT_MEM, uint32_t blockSize = DEFAULT_BLOCK_SIZE)

Function

Constructor of AscendIndexSQConfig, which is used to generate AscendIndexSQConfig. The Ascend AI Processor resources 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 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 SQ_DEFAULT_MEM defined 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 restricts 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 is 262144 (16384 × 16). This value affects the maximum number of indexes that can be created and the retrieval performance.

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.
  • The value of blockSize can be {16384 × 8, 16384 × 16, 16384 × 32, 16384 × 64}.