Skip to content

Commit

Permalink
v1.5.1 pypi is available
Browse files Browse the repository at this point in the history
  • Loading branch information
masajiro committed Jan 17, 2019
1 parent bc5a163 commit 9929c12
Show file tree
Hide file tree
Showing 51 changed files with 431 additions and 144 deletions.
79 changes: 47 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 2.8)

project(ngt)

set(ngt_VERSION_MAJOR 1)
set(ngt_VERSION_MINOR 5)
set(ngt_VERSION_PATCH 0)
file(STRINGS "VERSION" ngt_VERSION)
message(STATUS "VERSION: ${ngt_VERSION}")
string(REGEX MATCH "^[0-9]+" ngt_VERSION_MAJOR ${ngt_VERSION})

set(ngt_VERSION ${ngt_VERSION_MAJOR}.${ngt_VERSION_MINOR}.${ngt_VERSION_PATCH})
set(ngt_VERSION ${ngt_VERSION})
set(ngt_SOVERSION ${ngt_VERSION_MAJOR})

if (NOT CMAKE_BUILD_TYPE)
Expand All @@ -22,39 +22,54 @@ if(${UNIX})
set(GIT_DATE_OPTION "-DGIT_DATE=\"\\\"`git log -1 --format='%cd'`\\\"\"")
set(GIT_TAG_OPTION "-DGIT_TAG=\"\\\"`git describe --abbrev=0`\\\"\"")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

if(CMAKE_VERSION VERSION_LESS 3.1)
set(BASE_OPTIONS "-Wall -std=gnu++0x -lrt ${BUILD_DATE_OPTION} ${GIT_HASH_OPTION} ${GIT_DATE_OPTION} ${GIT_TAG_OPTION}")
if(${NGT_AVX_DISABLED})
message(STATUS "AVX will not be used to compute distances.")
else()
set(BASE_OPTIONS "${BASE_OPTIONS} -mavx")
endif()
if(${NGT_OPENMP_DISABLE})
message(STATUS "OpenMP is disabled.")
else()
set(BASE_OPTIONS "${BASE_OPTIONS} -fopenmp")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g ${BASE_OPTIONS}")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native ${BASE_OPTIONS}")
set(BASE_OPTIONS "-Wall -std=gnu++0x -lrt ${BUILD_DATE_OPTION} ${GIT_HASH_OPTION} ${GIT_DATE_OPTION} ${GIT_TAG_OPTION}")

if(${NGT_AVX_DISABLED})
message(STATUS "AVX will not be used to compute distances.")
else()
set(BASE_OPTIONS "${BASE_OPTIONS} -mavx")
endif()

if(${NGT_OPENMP_DISABLE})
message(STATUS "OpenMP is disabled.")
else()
set(BASE_OPTIONS "${BASE_OPTIONS} -fopenmp")
endif()

set(CMAKE_CXX_FLAGS_DEBUG "-g ${BASE_OPTIONS}")

if(${NGT_MARCH_NATIVE_DISABLED})
message(STATUS "Compile option -march=native is disabled.")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${BASE_OPTIONS}")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native ${BASE_OPTIONS}")
endif()
else()
add_definitions(${BUILD_DATE_OPTION} ${GIT_HASH_OPTION} ${GIT_DATE_OPTION} ${GIT_TAG_OPTION})
if (CMAKE_BUILD_TYPE_LOWER STREQUAL "release")
if (CMAKE_BUILD_TYPE_LOWER STREQUAL "release")
set(CMAKE_CXX_FLAGS_RELEASE "")
add_compile_options(-Ofast -march=native -DNDEBUG)
if(${NGT_MARCH_NATIVE_DISABLED})
message(STATUS "Compile option -march=native is disabled.")
add_compile_options(-O2 -DNDEBUG)
else()
add_compile_options(-Ofast -march=native -DNDEBUG)
endif()
endif()
add_compile_options(-Wall -lrt)
if(${NGT_AVX_DISABLED})
message(STATUS "AVX will not be used to compute distances.")
else()
add_compile_options(-mavx)
endif()
if(${NGT_OPENMP_DISABLE})
message(STATUS "OpenMP is disabled.")
else()
add_compile_options(-fopenmp)
endif()
add_compile_options(-Wall -lrt)
if(${NGT_AVX_DISABLED})
message(STATUS "AVX will not be used to compute distances.")
else()
add_compile_options(-mavx)
endif()
if(${NGT_OPENMP_DISABLE})
message(STATUS "OpenMP is disabled.")
else()
add_compile_options(-fopenmp)
endif()
set(CMAKE_CXX_STANDARD 11) # for std::unordered_set, std::unique_ptr
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11) # for std::unordered_set, std::unique_ptr
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

add_subdirectory("${PROJECT_SOURCE_DIR}/lib")
Expand Down
4 changes: 2 additions & 2 deletions README-jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Neighborhood Graph and Tree for Indexing High-dimensional Data
$ cmake ..
$ make
$ make install
$ ldconfig
$ ldconfig /usr/local/lib

#### 共有メモリの利用

Expand Down Expand Up @@ -86,5 +86,5 @@ Neighborhood Graph and Tree for Indexing High-dimensional Data
##### [ANNG](bin/ngt/README-jp.md#anng)
- Iwasaki, M.: Proximity search in metric spaces using approximate k nearest neigh-bor graph (in Japanese). IPSJ Trans. on Database 3(1) (2010) 18-28. ([pdf](https://s.yimg.jp/i/docs/research_lab/articles/miwasaki-ipsj-tod-2010.pdf))

Copyright © 2015-2018 Yahoo Japan Corporation All Rights Reserved.
Copyright © 2015-2019 Yahoo Japan Corporation All Rights Reserved.

2 changes: 1 addition & 1 deletion README.jp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ READMEは以下の場所に移動致しました。
https://github.com/yahoojapan/NGT/blob/master/README-jp.md

---
Copyright (C) 2015-2018 Yahoo! JAPAN Research
Copyright (C) 2015-2019 Yahoo! JAPAN Research
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,33 @@ Installation

### Build

#### On Linux

$ unzip NGT-x.x.x.zip
$ cd NGT-x.x.x
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make install
$ ldconfig /usr/local/lib

#### On Mac using homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install cmake
$ brew install gcc
$ ln -s ./gcc-8 /usr/local/bin/gcc
$ ln -s ./g++-8 /usr/local/bin/g++
$ export CXX=g++
$ export CC=gcc
$ unzip NGT-x.x.x.zip
$ cd NGT-x.x.x
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make install
$ ldconfig

#### Shared memory use

Expand All @@ -55,7 +74,7 @@ Supported Programming Languages
License
-------

Copyright (C) 2015-2018 Yahoo Japan Corporation
Copyright (C) 2015-2019 Yahoo Japan Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License. You may obtain a copy of the License at

Expand Down Expand Up @@ -89,5 +108,5 @@ Publications
##### [ANNG](bin/ngt/README.md#anng)
- Iwasaki, M.: Proximity search in metric spaces using approximate k nearest neigh-bor graph (in Japanese). IPSJ Trans. on Database 3(1) (2010) 18-28. ([pdf](https://s.yimg.jp/i/docs/research_lab/articles/miwasaki-ipsj-tod-2010.pdf))

Copyright © 2015-2018 Yahoo Japan Corporation All Rights Reserved.
Copyright © 2015-2019 Yahoo Japan Corporation All Rights Reserved.

1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5.1
2 changes: 1 addition & 1 deletion bin/ngt/ngt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion bin/ngtq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ Specifies the search mode.
- __r__: searches using exact distances after screening by approximate distances. (recommended if you need exact distances)

**-E** *approximate\_expansion*
Specifies the expansion ratio of the number of approximate search results to the number of search results. For example, when the retio is 10 and the number of search results is 20, the number of the approximate search results is set to 200.
Specifies the expansion ratio of the number of approximate search results to the number of search results. For example, when the ratio is 10 and the number of search results is 20, the number of the approximate search results is set to 200.

2 changes: 1 addition & 1 deletion bin/ngtq/ngtq.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2016-2018 Yahoo Japan Corporation
// Copyright (C) 2016-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion bin/search/search.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/ArrayFile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/ArrayFile.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
8 changes: 6 additions & 2 deletions lib/NGT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ if( ${UNIX} )

add_library(ngtstatic STATIC ${NGT_SOURCES})
set_target_properties(ngtstatic PROPERTIES OUTPUT_NAME ngt)
set_target_properties(ngtstatic PROPERTIES COMPILE_FLAGS "-fPIC")
target_link_libraries(ngtstatic)


add_library(ngt SHARED ${NGT_SOURCES})
set_target_properties(ngt PROPERTIES VERSION ${ngt_VERSION})
set_target_properties(ngt PROPERTIES SOVERSION ${ngt_SOVERSION})
add_dependencies(ngt ngtstatic)
target_link_libraries(ngt gomp)
if(${APPLE})
target_link_libraries(ngt gomp)
else(${APPLE})
target_link_libraries(ngt gomp rt)
endif(${APPLE})

install(TARGETS
ngt
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Capi.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Capi.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Clustering.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Command.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Command.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Graph.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Graph.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/GraphReconstructor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/HashBasedBooleanSet.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Index.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
8 changes: 6 additions & 2 deletions lib/NGT/Index.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -288,7 +288,7 @@ namespace NGT {
static void createGraphAndTree(const string &database, NGT::Property &prop) { createGraphAndTree(database, prop, ""); }
static void createGraph(const string &database, NGT::Property &prop, const string &dataFile, size_t dataSize = 0);
template<typename T> size_t insert(vector<T> &object);
static void append(const string &database, const string &dataFile, size_t threadSize, size_t dataSize);
static void append(const string &database, const string &dataFile, size_t threadSize, size_t dataSize);
static void append(const string &database, const float *data, size_t dataSize, size_t threadSize);
static void remove(const string &database, vector<ObjectID> &objects);
static void exportIndex(const string &database, const string &file);
Expand Down Expand Up @@ -1080,6 +1080,10 @@ namespace NGT {

// GraphIndex
virtual void search(NGT::SearchContainer &sc, ObjectDistances &seeds) {
if (sc.size == 0) {
while (!sc.workingResult.empty()) sc.workingResult.pop();
return;
}
if (seeds.size() == 0) {
#if defined(NGT_SHARED_MEMORY_ALLOCATOR) || !defined(NGT_GRAPH_READ_ONLY_GRAPH)
getSeedsFromGraph(repository, seeds);
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/MmapManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/MmapManager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/MmapManagerDefs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/MmapManagerException.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/MmapManagerImpl.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/NGTQ/Command.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2016-2018 Yahoo Japan Corporation
// Copyright (C) 2016-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/NGTQ/Quantizer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2016-2018 Yahoo Japan Corporation
// Copyright (C) 2016-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion lib/NGT/Node.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Yahoo Japan Corporation
// Copyright (C) 2015-2019 Yahoo Japan Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 9929c12

Please sign in to comment.