[R-sig-eco] Making a series of similar, but modified .r files for simulation experiment - suggested method(s)?

Lars Westerberg lawes at ifm.liu.se
Tue Aug 24 11:51:20 CEST 2010


Laura,
Since you are submitting to a Linux cluster you probably use the SGE 
queuing system. If so, there is a trick you can use if submitting 
several tasks in one job (i.e. array job, see info on flag "-t": qsub 
... -t 1-20:1). A colleague of mine have written a rudimentary how-to 
for our project group: http://tinyurl.com/35u2fxf

In the shell script that you submit to the cluster, you can use 
$SGE_TASK_ID as argument when calling your main R-function. This 
parameter will be one of values that is defined by the "-t"-flag. You 
can use the task-id directly to modify your for-loop, or you use it to 
specify a row in a look-up table holding the values you are after.

HTH
/Lars

Laura S wrote:
> Dear all:
> 
> Any suggestions are much appreciated. I am looking for a way to make a
> series of similar, but slightly modified, .r files.
> 
> My issue is automating making 320 .r files that change the for(i in 1:x) in
> my base .r file (as well as other elements, e.g., the load(...),
> setwd(...)). For smaller jobs running on a single computer with batch files,
> I have been manually changing the for(i in 1:x) line, etc..
> 
> Why does this matter to me? I am planning on running a simulation experiment
> on a linux cluster as a serial job. Although not elegant, it has been
> suggested I make 320 .r files so qsub runs one .r file and then selects
> other jobs. Thus, the manual route I am currently using would take a very
> long time (given multiple runs of 320 .r files, given experimental
> replication).
> 
> Thank you,
> Laura
> 


More information about the R-sig-ecology mailing list