Skip to content

Commit

Permalink
add python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blaise-muhirwa committed Nov 21, 2023
1 parent 15a20c8 commit f9aebaf
Show file tree
Hide file tree
Showing 10 changed files with 410 additions and 664 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ build
flatnav_python/flatnav.egg-info/
flatnav_python/poetry.lock
flatnav_python/dist
flatnav_python/__pycache__


# other files
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ set(HEADERS
${PROJECT_SOURCE_DIR}/flatnav/distances/inner_products_from_hnswlib.h
${PROJECT_SOURCE_DIR}/flatnav/distances/SquaredL2Distance.h
${PROJECT_SOURCE_DIR}/flatnav/distances/SquaredL2DistanceSpecializations.h
${PROJECT_SOURCE_DIR}/flatnav/distances/SQDistance.h
${PROJECT_SOURCE_DIR}/flatnav/util/ExplicitSet.h
${PROJECT_SOURCE_DIR}/flatnav/util/GorderPriorityQueue.h
${PROJECT_SOURCE_DIR}/flatnav/util/reordering.h
Expand All @@ -238,7 +237,7 @@ set_target_properties(FLAT_NAV_LIB PROPERTIES LINKER_LANGUAGE CXX)

if(BUILD_EXAMPLES)
message(STATUS "Building examples for Flatnav")
foreach(CONSTRUCT_EXEC construct_npy query query_npy cereal_tests)
foreach(CONSTRUCT_EXEC construct_npy query_npy cereal_tests)
add_executable(${CONSTRUCT_EXEC}
${PROJECT_SOURCE_DIR}/tools/${CONSTRUCT_EXEC}.cpp ${HEADERS})
add_dependencies(${CONSTRUCT_EXEC} FLAT_NAV_LIB)
Expand Down
20 changes: 10 additions & 10 deletions bin/run_anns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ if [ -f mnist_784.index ]; then
rm mnist_784.index
fi

if [ -f sift_128.index ]; then
rm sift_128.index
fi
# if [ -f sift_128.index ]; then
# rm sift_128.index
# fi

if [ -f glove_25.index ]; then
rm glove_25.index
fi
# if [ -f glove_25.index ]; then
# rm glove_25.index
# fi

# if [ -f gist_960.index ]; then
# rm gist_960.index
Expand All @@ -22,10 +22,10 @@ fi
# fi

# Build the index for MNIST
# build/construct_npy 1 0 data/mnist-784-euclidean/mnist-784-euclidean.train.npy 16 128 mnist_784.index
build/construct_npy 0 0 data/mnist-784-euclidean/mnist-784-euclidean.train.npy 16 128 mnist_784.index

# # Query MNIST
# build/query_npy 0 mnist_784.index data/mnist-784-euclidean/mnist-784-euclidean.test.npy data/mnist-784-euclidean/mnist-784-euclidean.gtruth.npy 256 100 0 1
build/query_npy 0 mnist_784.index data/mnist-784-euclidean/mnist-784-euclidean.test.npy data/mnist-784-euclidean/mnist-784-euclidean.gtruth.npy 256 100 0 0

# # Query MNIST with reordering
# build/query_npy 0 mnist_784.index data/mnist/mnist-784-euclidean.test.npy data/mnist/mnist-784-euclidean.gtruth.npy 256,512 100 1
Expand All @@ -37,10 +37,10 @@ fi
# build/query_npy 0 sift_128.index data/sift/sift-128-euclidean.test.npy data/sift/sift-128-euclidean.gtruth.npy 256,512 100 0

# Build the index for GloVe
build/construct_npy 1 1 data/glove/glove-25-angular.train.npy 16 128 glove_25.index
# build/construct_npy 1 1 data/glove/glove-25-angular.train.npy 16 128 glove_25.index

# Query GloVe without reordering
build/query_npy 1 glove_25.index data/glove/glove-25-angular.test.npy data/glove/glove-25-angular.gtruth.npy 128,256 100 0 1
# build/query_npy 1 glove_25.index data/glove/glove-25-angular.test.npy data/glove/glove-25-angular.gtruth.npy 128,256 100 0 1

# # Query GloVe with reordering
# build/query_npy 1 glove_25.index data/glove/glove-25-angular.test.npy data/glove/glove-25-angular.gtruth.npy 256,512 100 1
Expand Down
251 changes: 0 additions & 251 deletions flatnav_python/bindings.cpp

This file was deleted.

3 changes: 3 additions & 0 deletions flatnav_python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ setuptools = "68.2.2"
black = "^23.11.0"
pytest = "^7.4.3"
numpy = "^1.26.2"
h5py = "^3.10.0"
requests = "^2.31.0"



[build-system]
Expand Down
Loading

0 comments on commit f9aebaf

Please sign in to comment.