# Parallel (MPI) point locator

**URL:** https://discourse.vtk.org/t/parallel-mpi-point-locator/9545
**Category:** Support
**Created:** [October 7, 2022, 3:02pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545 "2022-10-07T15:02:48Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![a-jp1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a-jp1/32/1710_2.png) [@a-jp1](https://discourse.vtk.org/u/a-jp1)
#### Post date: [October 7, 2022, 3:02pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/1 "2022-10-07T15:02:48Z")

</div>

Hi, I’ve made a lot of use of the vtk point locators before, I have a use case that requires me to build and perform nearest neighbour searches of point trees, distributed over MPI. Is that possible in VTK?

Thanks,

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [October 8, 2022, 12:06pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/2 "2022-10-08T12:06:33Z")

</div>

Hello,

I do multithreaded spatial queries with Boost’s `boost::geometry::index::rtree<>` class without any issues. Why don’t you simply try it with VTK and see what happens? A query is supposed to be a read-only (`const`) operation. Unless VTK does some state keeping during a query, there is no reason for it to not work in parallel. Of course, you must populate the index in a single thread to be safe.

If you like, I can post some code snippets showing how to setup and query a spatial index with Boost.

regards,

Paulo

---

<div class="post-metadata">

### Author: ![a-jp1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a-jp1/32/1710_2.png) [@a-jp1](https://discourse.vtk.org/u/a-jp1)
#### Post date: [October 10, 2022, 7:04am UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/3 "2022-10-10T07:04:16Z")

</div>

Thanks for your comments. I was specifically asking whether there was an MPI based point locator within VTK?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [October 10, 2022, 9:09pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/4 "2022-10-10T21:09:41Z")

</div>

Please, take a look at this: [CMake error trying to build VTK 9.2.0.rc1 with MPI](https://discourse.vtk.org/t/cmake-error-trying-to-build-vtk-9-2-0-rc1-with-mpi/8805)

To have MPI support in VTK you need to compile it with the proper configuration in CMake.

---

<div class="post-metadata">

### Author: ![a-jp1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a-jp1/32/1710_2.png) [@a-jp1](https://discourse.vtk.org/u/a-jp1)
#### Post date: [November 10, 2022, 8:38pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/5 "2022-11-10T20:38:38Z")

</div>

Just to follow up. Could any of the vtk or paraview devs confirm whether there is an MPI aware point locator in either vtk or paraview? If not is this something that is planned or under active development? Are there any work arounds with other filters that would provide this capability?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [November 10, 2022, 9:15pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/6 "2022-11-10T21:15:15Z")

</div>

I am not aware of any point locators that explicitly use MPI.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [November 10, 2022, 9:15pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/7 "2022-11-10T21:15:57Z")

</div>

Note, however, that you could use a locator on each rank and do the final reduction yourself with MPI calls.

---

<div class="post-metadata">

### Author: ![a-jp1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a-jp1/32/1710_2.png) [@a-jp1](https://discourse.vtk.org/u/a-jp1)
#### Post date: [November 10, 2022, 9:25pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/8 "2022-11-10T21:25:40Z")

</div>

Ok thank you. Do you know whether paraview does something like that? I’m looking for a worked example to learn from.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [November 10, 2022, 9:48pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/9 "2022-11-10T21:48:50Z")

</div>

`vtkPProbeFilter` does something similar. It interpolates data at specified points in parallel.

---

<div class="post-metadata">

### Author: ![a-jp1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a-jp1/32/1710_2.png) [@a-jp1](https://discourse.vtk.org/u/a-jp1)
#### Post date: [November 10, 2022, 9:52pm UTC](https://discourse.vtk.org/t/parallel-mpi-point-locator/9545/10 "2022-11-10T21:52:59Z")

</div>

Ok I’ll take a look thanks
