AscendIndexInt8FlatConfig

AscendIndexInt8Flat requires the corresponding AscendIndexInt8FlatConfig to initialize related resources.

Member Description

Member

Type

Description

dIndexMode

Int8IndexMode

Configures the index int8 retrieval mode.

dBlockSize

uint32_t

Configures the block size on the device.

API Description

API definition

AscendIndexInt8FlatConfig(uint32_t blockSize =BLOCK_SIZE, Int8IndexMode indexMode = Int8IndexMode::DEFAULT_MODE);

Function

Constructor of AscendIndexInt8FlatConfig, which is used to generate AscendIndexInt8FlatConfig, configure the block size on the device, and set the retrieval mode of int8.

Input

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 BLOCK_SIZE is 262144 (16384 × 16).

Int8IndexMode indexMode: Index int8 retrieval mode. The default value is DEFAULT_MODE.

  • DEFAULT_MODE: default mode.
  • PIPE_SEARCH_MODE: This mode optimizes the performance for the scenario where the batch size is greater than or equal to 128. When this mode is used, you are advised to set resourceSize to 1324 MB.
  • WITHOUT_NORM_MODE: not supported currently.

Output

N/A

Return value

N/A

Restrictions

  • The value of blockSize includes {16384, 32768, 65536, 131072, 262144}.
  • AscendIndexInt8Flat in PIPE_SEARCH_MODE mode supports only METRIC_L2.

API definition

AscendIndexInt8FlatConfig(std::initializer_list<int> devices, int64_t resourceSize = INT8_FLAT_DEFAULT_MEM, uint32_t blockSize = BLOCK_SIZE, Int8IndexMode indexMode = Int8IndexMode::DEFAULT_MODE);

Function

Constructor of AscendIndexInt8FlatConfig, which is used to generate AscendIndexInt8FlatConfig. The Ascend AI Processor resources on the device and the resource pool size are configured based on the value configured in Devices. It is also used to configure the block size on the device and the int8 retrieval mode.

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 INT8_FLAT_DEFAULT_MEM in the header file. This parameter is determined by the database capacity and search batch size. If the base library has 10 million records or more and the 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 BLOCK_SIZE is 262144 (16384 × 16).

Int8IndexMode indexMode: Index int8 retrieval mode. The default value is DEFAULT_MODE.

  • DEFAULT_MODE: default mode.
  • PIPE_SEARCH_MODE: This mode optimizes the performance for the scenario where the batch size is greater than or equal to 128. When this mode is used, you are advised to set resourceSize to 1324 MB.
  • WITHOUT_NORM_MODE: not supported currently.

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 16 × 1024 MB (16 × 1024 × 1024 × 1024 bytes). When the batch size is greater than or equal to 96, you are advised to set resourceSize to a value greater than or equal to 2 × 1024 MB to improve algorithm performance.
  • The value of blockSize includes {16384, 32768, 65536, 131072, 262144}.
  • AscendIndexInt8Flat in PIPE_SEARCH_MODE mode supports only METRIC_L2.

API definition

AscendIndexInt8FlatConfig(std::vector<int> devices, int64_t resourceSize = INT8_FLAT_DEFAULT_MEM, uint32_t blockSize = BLOCK_SIZE, Int8IndexMode indexMode = Int8IndexMode::DEFAULT_MODE)

Function

Constructor of AscendIndexInt8FlatConfig, which is used to generate AscendIndexInt8FlatConfig. The Ascend AI Processor resources on the device and the resource pool size are configured based on the value configured in devices. It is also used to configure the block size on the device and the int8 retrieval mode.

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 INT8_FLAT_DEFAULT_MEM in the header file. This parameter is determined by the database capacity and search batch size. If the base library has 10 million records or more and the 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 BLOCK_SIZE is 262144 (16384 × 16).

Int8IndexMode indexMode: Index int8 retrieval mode. The default value is DEFAULT_MODE.

  • DEFAULT_MODE: default mode.
  • PIPE_SEARCH_MODE: This mode optimizes the performance for the scenario where the batch size is greater than or equal to 128. When this mode is used, you are advised to set resourceSize to 1324 MB.
  • WITHOUT_NORM_MODE: not supported currently.

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 16 × 1024 MB (16 × 1024 × 1024 × 1024 bytes). When the batch size is greater than or equal to 96, you are advised to set resourceSize to a value greater than or equal to 2 × 1024 MB to improve algorithm performance.
  • The value of blockSize includes {16384, 32768, 65536, 131072, 262144}.
  • AscendIndexInt8Flat in PIPE_SEARCH_MODE mode supports only METRIC_L2.