[R-sig-Geo] Parallel processing a list of SpatialPoints

David Wang dw2116 at outlook.com
Thu Aug 18 15:58:30 CEST 2016


Hello Roger,


Thanks for pointing to the excellent RANN package. It considerably speeds up the search for nearest neighbors. Now I'm able to reduce the run time by several folds.


D

________________________________
From: Roger Bivand <Roger.Bivand at nhh.no>
Sent: Thursday, August 18, 2016 1:55:18 AM
To: David Wang; Hodgess, Erin; r-sig-geo
Subject: Re: [R-sig-Geo] Parallel processing a list of SpatialPoints


Consider using the RANN package if your points are represented by projected (planar) coordinates.

Hope this helps,

Roger Bivand
Norwegian School of Economics
Bergen, Norway

Fra: David Wang
Sendt: torsdag 18. august, 00.20
Emne: Re: [R-sig-Geo] Parallel processing a list of SpatialPoints
Til: Hodgess, Erin, r-sig-geo

Hi Erin et al., Thanks for the questions. I use Windows 7 on a 8-core PC. I also have access to a Linux cluster. But in most cases, I have found using multiple cores with doParallel and foreach on the PC gives me sufficient speed-up. I'd not bother with mpi in this case either. D ________________________________ From: Hodgess, Erin Sent: Wednesday, August 17, 2016 6:11:31 PM To: David Wang; r-sig-geo Subject: RE: Parallel processing a list of SpatialPoints Do you know Mpi, by any chance, please? What kind of machine/operating system are you using, please? Thanks, Erin Erin M. Hodgess Associate Professor Department of Mathematics and Statistics University of Houston - Downtown mailto: hodgesse at uhd.edu ________________________________________ From: R-sig-Geo [r-sig-geo-bounces at r-project.org] on behalf of David Wang [dw2116 at outlook.com] Sent: Wednesday, August 17, 2016 5:00 PM To: r-sig-geo Subject: [R-sig-Geo] Parallel processing a list of SpatialPoints Hello, I have a list of SpatialPointsDataFrame objects that represent feature centers along the time axis. For example, let's say the list is centers. centers[[1]] are the points at t = 1, centers[[2]] are the points at t = 2, and so on. Now for every point at t, I need to link it to, if any, the nearest point within a search radius at the next time step t + 1. The procedure is applied to all time steps, and the result are tracks that connect selected feature centers in time. I have implemented a solution using igraph package, with every center represented by a vertex and every link by an edge. This way, tracks are simply connected components of the graph. Now because the number of centers and links are quite large, the algorithm takes a while to run. But since finding the nearest neighbors between t and t + 1 and between t + 1 and t + 2 are independent, I think parallel processing should be possible, although I haven't figured out how. Does anyone here happen to have a pointer or ! two? I work on a multicore PC. Here is my code snippet: g 0 & length(V(g)[id == k]) > 0) { v1

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list