Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kdtree
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cython-plus
kdtree
Commits
fefabcc0
Commit
fefabcc0
authored
Nov 22, 2021
by
Julien Jerphanion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEBUG] Compilation error on the actor
parent
10021b00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
21 deletions
+33
-21
kdtree.pyx
kdtree.pyx
+33
-21
No files found.
kdtree.pyx
View file @
fefabcc0
...
...
@@ -6,7 +6,7 @@ import numpy as np
np
.
import_array
()
from
runtime.runtime
cimport
BatchMailBox
,
NullResult
,
Scheduler
,
WaitResult
from
libc.math
cimport
log2
,
fmax
,
fmin
,
fabs
from
libc.math
cimport
log2
,
fmax
,
fmin
,
fabs
,
ceil
from
libc.stdio
cimport
printf
from
libc.stdlib
cimport
malloc
,
free
from
openmp
cimport
omp_get_max_threads
...
...
@@ -515,23 +515,19 @@ cdef cypclass Node activable:
counter
=
counter
,
)
# TODO (jjerphan): integrate this where needed once the
# compilation problem with Cython has been resolved
cdef
void
prange_workaround
(
KDTree
tree
,
NeighborsHeaps
heaps
,
I_t
n_query
,
I_t
num_threads
,
I_t
n_features
,
D_t
*
_query_points_ptr
,
)
nogil
:
cdef
:
D_t
rdist_lower_bound
=
0
I_t
i
for
i
in
prange
(
n_query
,
schedule
=
'static'
,
num_threads
=
num_threads
):
rdist_lower_bound
=
tree
.
min_rdist
(
0
,
_query_points_ptr
+
i
*
n_features
)
tree
.
_query_single_depthfirst
(
0
,
_query_points_ptr
,
i
,
heaps
,
rdist_lower_bound
)
cdef
cypclass
QueryActor
:
__init__
(
self
,
D_t
*
query_points_ptr
,
KDTree
tree
,
NeighborsHeaps
heaps
,
I_t
idx_worker
,
I_t
idx_start
,
I_t
idx_end
,
):
printf
(
"QueryActor: (%d, %d, %d)
\
n
"
,
idx_worker
,
idx_start
,
idx_end
)
cdef
cypclass
KDTree
:
...
...
@@ -708,16 +704,32 @@ cdef cypclass KDTree:
I_t
n_neighbors
=
knn_indices
.
shape
[
1
]
D_t
*
_query_points_ptr
=
<
D_t
*>
query_points
.
data
D_t
rdist_lower_bound
I_t
num_threads
=
omp_get_max_threads
()
I_t
n_workers
=
omp_get_max_threads
()
I_t
n_points_worker
=
<
I_t
>
ceil
(
n_query
/
n_workers
)
I_t
idx_start
,
idx_end
,
idx_worker
NeighborsHeaps
heaps
=
NeighborsHeaps
(
<
I_t
*>
knn_indices
.
data
,
<
D_t
*>
knn_distances
.
data
,
n_query
,
n_neighbors
)
prange_workaround
(
self
,
heaps
,
n_query
,
num_threads
,
n_features
,
_query_points_ptr
)
# This Counter is used as a way to implement a barrier for
# the asynchronous construction of the tree.
active
Counter
counter
=
consume
Counter
()
idx_worker
=
0
idx_start
=
n_points_worker
*
idx_worker
idx_end
=
min
(
n_points_worker
*
(
idx_worker
+
1
),
n_query
)
cdef
QueryActor
query_actor
=
QueryActor
(
query_points
=
_query_points_ptr
,
tree
=
tree
,
heaps
=
heaps
,
idx_worker
=
idx_worker
,
idx_start
=
n_points_worker
*
idx_worker
,
idx_end
=
min
(
n_points_worker
*
(
idx_worker
+
1
),
n_query
),
)
heaps
.
sort
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment