Commit fefabcc0 authored by Julien Jerphanion's avatar Julien Jerphanion

[DEBUG] Compilation error on the actor

parent 10021b00
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment