Skip to content
Prev 20581 / 29559 Next

loops in rasterEngine

Is it so that system.time in this case can strongly depend on how much data is placed in RAM? In my case, I'm far from being memory limited (RAM = 192 Gb) and most of the time, it's faster to put everything in memory and then process it. The major limiting speed factor here is I/O.

yan

Yan Boulanger, Chercheur scientifique / Research scientist 
Ressources Naturelles Canada, Canadian Forest Service 
Centre de Foresterie des Laurentides 
1055, rue du P.E.P.S.
C.P. 10380, succ. Sainte-Foy
Qu?bec (Qu?bec) Canada
G1V 4C7 
Tel. : +1 418 649-6859 


-----Original Message-----
From: jgrn307 at gmail.com [mailto:jgrn307 at gmail.com] On Behalf Of Jonathan Greenberg
Sent: 13 mars 2014 12:18
To: Alex Zvoleff
Cc: Boulanger, Yan; r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] loops in rasterEngine

Yan:

Looks like you are getting great help with this -- I want to echo Alex's note that rasterEngine is not a catchall -- for REALLY simple processes you'll get better performance using calc() or using LESS workers (which may seem counter intuitive).  I'm submitting a paper this week that showed that a function that just multiplies a raster by
10 ran faster than calc() only when using 4 workers
(sfQuickInit(cpus=4)) (vs. calc's 1), but was slower than calc if you have less or more workers.  As a rule, rasterEngine, at present, is slower than calc when operation in sequential mode.

Now, as an important note, if you grab the latest spatial.tools from r-forge, I have added a feature that will return multiple rasters at once, which seems like what you want to do.  You'll want to return a list-of-arrays (each component will be written to its own raster) and make sure you specify the output filenames (the components will be matched against the output filenames).  This may result in a significant speedup because you are only reading each raster once, and returning all the outputs (vs. the example above reads/writes the rasters for every i).

--j
On Thu, Mar 13, 2014 at 9:06 AM, Alex Zvoleff <azvoleff at conservation.org> wrote:
--
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign
259 Computing Applications Building, MC-150
605 East Springfield Avenue
Champaign, IL  61820-6371
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007