R

From FarmShare

(Difference between revisions)
Jump to: navigation, search
(New page: Here's an example R file that generates a large array, fills it with some random numbers, then sleeps for 5mins. This happens to use up almost exactly 8GB of RAM. <pre> $ cat 8GB.R x <-...)
Line 67: Line 67:
>  
>  
</pre>
</pre>
 +
 +
Those errors about tty and job control have something to do with shell startup and terminal settings, and are normal.
 +
 +
==Links==
 +
Some other departments have some other more detailed examples:
 +
*http://wiki.genomics.upenn.edu/index.php/HPC:ExamplesR
 +
*http://me.eng.uab.edu/wiki/index.php?title=R-userinfo
 +
*https://www.stanford.edu/dept/statistics/cgi-bin/projects/stat-sysadminwiki/index.php/R_Jobs

Revision as of 20:49, 27 October 2011

Here's an example R file that generates a large array, fills it with some random numbers, then sleeps for 5mins. This happens to use up almost exactly 8GB of RAM.

$ cat 8GB.R 
x <- array(1:1073741824, dim=c(1024,1024,1024)) 
x <- gaussian()
Sys.sleep(300)

Here's an example SGE submit script that runs that R file.


$ cat r_test.script
#!/bin/bash

# use the current directory
#$ -cwd
# mail this address
#$ -M chekh@stanford.edu
# send mail on begin, end, suspend
#$ -m bes

R --vanilla --no-save < 8GB.R 

You can submit it with just

 qsub r_test.script

Here are the output files that I get, one from stderr, one from stdout

$ cat r_test.script.e497 
tset: standard error: Function not implemented

Undefined tty
stdin: is not a tty

$ cat r_test.script.o497 
Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.

R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> x <- array(1:1073741824, dim=c(1024,1024,1024)) 
> x <- gaussian()
> Sys.sleep(300)
> 

Those errors about tty and job control have something to do with shell startup and terminal settings, and are normal.

Links

Some other departments have some other more detailed examples:

Personal tools
Toolbox
LANGUAGES