primetang / pyflann

python bindings for FLANN - Fast Library for Approximate Nearest Neighbors.
Other
122 stars 55 forks source link

Does pyflann support multithreads? #9

Open mathmax12 opened 6 years ago

mathmax12 commented 6 years ago

Does pyflann support multithreads? If yes how?

Thanks.

tim-hilt commented 3 years ago

I installed it and ran the following:

from pyflann import *
import numpy as np

dataset = np.random.rand(100000, 128)  # Changed to 1million elements
testset = np.random.rand(1000, 128)

flann = FLANN()
result, dists = flann.nn(
    dataset, testset, 5, algorithm="kmeans", branching=32, iterations=7, checks=16)
print result
print dists

I only saw a single active thread when running the query.

FLANN is capable of multithreading as per the user manual.

Is there some way i can get multithreading to run from within python?

abst0603 commented 2 years ago

According to documentation of flann, you sould set "cores" variable in "searchparams" to run it on multiple cores. "searchparams" is not accepted in any python function as an input. Thus I suppose that python does not support multiprocessing.