All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
GpuAutoTune.h
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the CC-by-NC license found in the
* LICENSE file in the root directory of this source tree.
*/
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include "../Index.h"
#include "../AutoTune.h"
#include "GpuIndex.h"
#include "GpuIndicesOptions.h"
namespace faiss { namespace gpu {
class GpuResources;
// to support auto-tuning we need cloning to/from CPU
/// converts any GPU index inside gpu_index to a CPU index
faiss::Index * index_gpu_to_cpu(const faiss::Index *gpu_index);
/// set some options on how to copy to GPU
struct GpuClonerOptions {
/// how should indices be stored on GpuIndexIVFPQ?
IndicesOptions indicesOptions;
/// is the coarse quantizer in float16?
bool useFloat16CoarseQuantizer;
/// for GpuIndexIVFFlat, is storage in float16?
/// for GpuIndexIVFPQ, are intermediate calculations in float16?
bool useFloat16;
/// use precomputed tables?
bool usePrecomputed;
/// reserve vectors in the invfiles?
long reserveVecs;
/// For GpuIndexFlat, store data in transposed layout?
bool storeTransposed;
int verbose;
GpuClonerOptions ();
};
/// converts any CPU index that can be converted to GPU
faiss::Index * index_cpu_to_gpu(
GpuResources* resources, int device,
const faiss::Index *index,
const GpuClonerOptions *options = nullptr);
struct GpuMultipleClonerOptions: GpuClonerOptions {
bool shard; ///< shard rather than copying to each GPU
GpuMultipleClonerOptions ();
};
faiss::Index * index_cpu_to_gpu_multiple(
std::vector<GpuResources*> & resources,
std::vector<int> &devices,
const faiss::Index *index,
const GpuMultipleClonerOptions *options = nullptr);
/// parameter space and setters for GPU indexes
struct GpuParameterSpace: faiss::ParameterSpace {
/// initialize with reasonable parameters for the index
void initialize (const faiss::Index * index) override;
/// set a combination of parameters on an index
void set_index_parameter (
faiss::Index * index, const std::string & name,
double val) const override;
};
} } // namespace
faiss::gpu::GpuMultipleClonerOptions::shard
bool shard
shard rather than copying to each GPU
Definition: GpuAutoTune.h:57
faiss::gpu::GpuClonerOptions::storeTransposed
bool storeTransposed
For GpuIndexFlat, store data in transposed layout?
Definition: GpuAutoTune.h:44
faiss::gpu::GpuParameterSpace::initialize
void initialize(const faiss::Index *index) override
initialize with reasonable parameters for the index
Definition: GpuAutoTune.cpp:281
faiss::gpu::GpuClonerOptions
set some options on how to copy to GPU
Definition: GpuAutoTune.h:31
faiss::gpu::GpuClonerOptions::usePrecomputed
bool usePrecomputed
use precomputed tables?
Definition: GpuAutoTune.h:40
faiss::gpu::GpuResources
Definition: GpuResources.h:24
faiss::gpu::GpuMultipleClonerOptions
Definition: GpuAutoTune.h:56
faiss::gpu::GpuParameterSpace::set_index_parameter
void set_index_parameter(faiss::Index *index, const std::string &name, double val) const override
set a combination of parameters on an index
Definition: GpuAutoTune.cpp:314
faiss::gpu::GpuParameterSpace
parameter space and setters for GPU indexes
Definition: GpuAutoTune.h:71
faiss::gpu::GpuClonerOptions::useFloat16
bool useFloat16
Definition: GpuAutoTune.h:38
faiss::gpu::GpuClonerOptions::indicesOptions
IndicesOptions indicesOptions
how should indices be stored on GpuIndexIVFPQ?
Definition: GpuAutoTune.h:33
faiss::gpu::GpuClonerOptions::useFloat16CoarseQuantizer
bool useFloat16CoarseQuantizer
is the coarse quantizer in float16?
Definition: GpuAutoTune.h:35
faiss::ParameterSpace
Definition: AutoTune.h:133
faiss::Index
Definition: Index.h:61
faiss::gpu::GpuClonerOptions::reserveVecs
long reserveVecs
reserve vectors in the invfiles?
Definition: GpuAutoTune.h:42