Skip to content

Commit

Permalink
Merge pull request #508 from jlmelville/develop
Browse files Browse the repository at this point in the history
Provide a macro to override the use of std::cerr
  • Loading branch information
yurymalkov authored Oct 1, 2023
2 parents ae5ba1b + a9e62cb commit c4418ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hnswlib/hnswalg.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class HierarchicalNSW : public AlgorithmInterface<dist_t> {
if ( M <= 10000 ) {
M_ = M;
} else {
std::cerr << "warning: M parameter exceeds 10000 which may lead to adverse effects." << std::endl;
std::cerr << " Cap to 10000 will be applied for the rest of the processing." << std::endl;
HNSWERR << "warning: M parameter exceeds 10000 which may lead to adverse effects." << std::endl;
HNSWERR << " Cap to 10000 will be applied for the rest of the processing." << std::endl;
M_ = 10000;
}
maxM_ = M_;
Expand Down
9 changes: 9 additions & 0 deletions hnswlib/hnswlib.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#pragma once

// https://github.com/nmslib/hnswlib/pull/508
// This allows others to provide their own error stream (e.g. RcppHNSW)
#ifndef HNSWLIB_ERR_OVERRIDE
#define HNSWERR std::cerr
#else
#define HNSWERR HNSWLIB_ERR_OVERRIDE
#endif

#ifndef NO_MANUAL_VECTORIZATION
#if (defined(__SSE__) || _M_IX86_FP > 0 || defined(_M_AMD64) || defined(_M_X64))
#define USE_SSE
Expand Down

0 comments on commit c4418ea

Please sign in to comment.