Add log to debug #678 (#733)

* Add log to debug #678

* Rename nsg_mix to RNSG in C++ sdk #735

* [skip ci] change __function__
This commit is contained in:
Yukikaze-CZR 2019-12-10 16:47:35 +08:00 committed by Jin Hai
parent 77d2d9b6ee
commit f37509213b
4 changed files with 18 additions and 3 deletions

View File

@ -70,6 +70,7 @@ FaissBaseIndex::SealImpl() {
faiss::Index* index = index_.get();
auto idx = dynamic_cast<faiss::IndexIVF*>(index);
if (idx != nullptr) {
KNOWHERE_LOG_DEBUG << "Test before to_readonly:" << " IVF READONLY " << std::boolalpha << idx->is_readonly();
idx->to_readonly();
}
#endif

View File

@ -24,6 +24,7 @@
#include <thrust/host_vector.h>
#include <unordered_map>
#include <numeric>
#include <chrono>
namespace faiss { namespace gpu {
@ -70,12 +71,14 @@ IVFFlat::copyCodeVectorsFromCpu(const float* vecs,
// list; the length is in sizeof(char)
FAISS_ASSERT(deviceData_->size() + lengthInBytes <= std::numeric_limits<int64_t>::max());
std::chrono::high_resolution_clock::time_point time1 = std::chrono::high_resolution_clock::now();
deviceData_->append((unsigned char*) vecs,
lengthInBytes,
stream,
true /* exact reserved size */);
std::chrono::high_resolution_clock::time_point time2 = std::chrono::high_resolution_clock::now();
copyIndicesFromCpu_(indices, list_length);
std::chrono::high_resolution_clock::time_point time3 = std::chrono::high_resolution_clock::now();
maxListLength_ = 0;
size_t listId = 0;
@ -94,6 +97,7 @@ IVFFlat::copyCodeVectorsFromCpu(const float* vecs,
pos += size;
++ listId;
}
std::chrono::high_resolution_clock::time_point time4 = std::chrono::high_resolution_clock::now();
deviceListDataPointers_ = hostPointers;
@ -102,6 +106,16 @@ IVFFlat::copyCodeVectorsFromCpu(const float* vecs,
if (stream != 0) {
streamWait({stream}, {0});
}
std::chrono::high_resolution_clock::time_point time5 = std::chrono::high_resolution_clock::now();
double span1 = (std::chrono::duration<double, std::micro>(time2 - time1)).count();
double span2 = (std::chrono::duration<double, std::micro>(time3 - time2)).count();
double span3 = (std::chrono::duration<double, std::micro>(time4 - time3)).count();
double span4 = (std::chrono::duration<double, std::micro>(time5 - time4)).count();
std::cout << "Span1: " << span1 * 0.001 << "ms" << std::endl;
std::cout << "Span2: " << span2 * 0.001 << "ms" << std::endl;
std::cout << "Span3: " << span3 * 0.001 << "ms" << std::endl;
std::cout << "Span4: " << span4 * 0.001 << "ms" << std::endl;
}
void

View File

@ -94,7 +94,7 @@ Utils::IndexTypeName(const milvus::IndexType& index_type) {
return "IVFFLAT";
case milvus::IndexType::IVFSQ8:
return "IVFSQ8";
case milvus::IndexType::NSG:
case milvus::IndexType::RNSG:
return "NSG";
case milvus::IndexType::IVFSQ8H:
return "IVFSQ8H";

View File

@ -35,7 +35,7 @@ enum class IndexType {
FLAT = 1,
IVFFLAT = 2,
IVFSQ8 = 3,
NSG = 4,
RNSG = 4,
IVFSQ8H = 5,
IVFPQ = 6,
SPTAGKDT = 7,