Skip to content

Commit

Permalink
Multi-GPU support for head idnex construction (#196)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Karsin <bkarsin@prm-dgx-14.nvidia.com>
  • Loading branch information
bkarsin and Ben Karsin committed Apr 2, 2021
1 parent 4f9fc76 commit 6472b1e
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 119 deletions.
1 change: 1 addition & 0 deletions AnnService/inc/Core/BKT/ParameterDefinitionList.h
Expand Up @@ -32,6 +32,7 @@ DefineBKTParameter(m_pGraph.m_iGPUGraphType, int, 2, "GPUGraphType") // Have GPU
DefineBKTParameter(m_pGraph.m_iGPURefineSteps, int, 0, "GPURefineSteps") // Steps of GPU neighbor-refinement
DefineBKTParameter(m_pGraph.m_iGPURefineDepth, int, 30, "GPURefineDepth") // Depth of graph search for refinement
DefineBKTParameter(m_pGraph.m_iGPULeafSize, int, 500, "GPULeafSize")
DefineBKTParameter(m_pGraph.m_iheadNumGPUs, int, 1, "HeadNumGPUs")

DefineBKTParameter(m_iNumberOfThreads, int, 1L, "NumberOfThreads")
DefineBKTParameter(m_iDistCalcMethod, SPTAG::DistCalcMethod, SPTAG::DistCalcMethod::Cosine, "DistCalcMethod")
Expand Down
7 changes: 4 additions & 3 deletions AnnService/inc/Core/Common/NeighborhoodGraph.h
Expand Up @@ -47,7 +47,8 @@ namespace SPTAG
m_iGPUGraphType(2),
m_iGPURefineSteps(0),
m_iGPURefineDepth(2),
m_iGPULeafSize(500)
m_iGPULeafSize(500),
m_iheadNumGPUs(1)
{}

~NeighborhoodGraph() {}
Expand Down Expand Up @@ -105,7 +106,7 @@ namespace SPTAG
SPTAG::Helper::Convert::ConvertStringTo(index->GetParameter("NumberOfInitialDynamicPivots").c_str(), initSize);

// Build the entire RNG graph, both builds the KNN and refines it to RNG
buildGraph<T>(index, m_iGraphSize, m_iNeighborhoodSize, m_iTPTNumber, (int*)m_pNeighborhoodGraph[0], m_iGPURefineSteps, m_iGPURefineDepth, m_iGPUGraphType, m_iGPULeafSize, initSize);
buildGraph<T>(index, m_iGraphSize, m_iNeighborhoodSize, m_iTPTNumber, (int*)m_pNeighborhoodGraph[0], m_iGPURefineSteps, m_iGPURefineDepth, m_iGPUGraphType, m_iGPULeafSize, initSize, m_iheadNumGPUs);

if (idmap != nullptr) {
std::unordered_map<SizeType, SizeType>::const_iterator iter;
Expand Down Expand Up @@ -533,7 +534,7 @@ namespace SPTAG
int m_iTPTNumber, m_iTPTLeafSize, m_iSamples, m_numTopDimensionTPTSplit;
DimensionType m_iNeighborhoodSize;
float m_fNeighborhoodScale, m_fCEFScale, m_fRNGFactor;
int m_iRefineIter, m_iCEF, m_iAddCEF, m_iMaxCheckForRefineGraph, m_iGPUGraphType, m_iGPURefineSteps, m_iGPURefineDepth, m_iGPULeafSize;
int m_iRefineIter, m_iCEF, m_iAddCEF, m_iMaxCheckForRefineGraph, m_iGPUGraphType, m_iGPURefineSteps, m_iGPURefineDepth, m_iGPULeafSize, m_iheadNumGPUs;
};
}
}
Expand Down

0 comments on commit 6472b1e

Please sign in to comment.