InitWithExtraVal

API definition

APP_ERROR InitWithExtraVal(uint32_t deviceId, uint32_t dim, uint32_t tokenNum, uint64_t resources, AlgorithmType algType = AlgorithmType::FLAT_HAMMING, MemoryStrategy memoryStrategy = MemoryStrategy::PURE_DEVICE_MEMORY, uint32_t customAttrLen = 0, uint32_t customAttrBlockSize = 0, uint64_t maxFeatureRowCount = std::numeric_limits<uint64_t>::max());

Function

Initialization function of an instance with extra attributes.

Input

uint32_t deviceId: device ID used by the index.

uint32_t dim: vector dimension.

uint32_t tokenNum: maximum number of tokens in the spatiotemporal database. The value must be the same as the number of tokens of the corresponding mask operator.

uint64_t resources: size of the shared memory.

AlgorithmType algType: distance comparison algorithm used at the bottom layer. The default value is AlgorithmType::FLAT_HAMMING.

MemoryStrategy memoryStrategy: memory policy used at the bottom layer. The default value is MemoryStrategy::PURE_DEVICE_MEMORY.

customAttrLen: length of a custom attribute

customAttrBlockSize: block size of a custom attribute

maxFeatureRowCount: maximum number of vectors

Output

N/A

Return value

APP_ERROR: return status. For details, see Return Code Reference.

Restrictions

  • It needs to be called immediately after the constructor.
  • deviceId must be a valid device ID. The value range is [0, 1024].
  • The value range of tokenNum is (0, 3e5].
  • The valid range of uint64_t resources is [1 × 1024 × 1024 × 1024, 32 × 1024 × 1024 × 1024]. When extra attributes are used, you are advised to allocate 4 GB.
  • For the binarized feature retrieval (Hamming distance) algorithm, dim ∈ {256, 512, 1024}.
  • The value range of customAttrLen is [0, 32]. The default value is 0, indicating that there is no custom attribute.
  • The value range of customAttrBlockSize is [0, 262144 × 64]. The value must be an integer multiple of 1024 × 256. The default value is 0, indicating that there is no custom attribute.
  • The extra attribute of maxFeatureRowCount does not support HPP. The default value is the maximum value of uint64.