R: Difference between revisions

Jump to navigation Jump to search
98 bytes added ,  5 years ago
Marked this version for translation
No edit summary
(Marked this version for translation)
Line 55: Line 55:
}}
}}


<!--T:66-->
To execute an R script non-interactively, use <code>Rscript</code> with the file containing the R commands as an argument:
To execute an R script non-interactively, use <code>Rscript</code> with the file containing the R commands as an argument:


Line 63: Line 64:
<code>Rscript</code> will automatically pass scripting-appropriate options <tt>--slave</tt> and <tt>--no-restore</tt> to the R interpreter. These also imply the <tt>--no-save</tt> option, preventing the creation of useless workspace files on exit.  
<code>Rscript</code> will automatically pass scripting-appropriate options <tt>--slave</tt> and <tt>--no-restore</tt> to the R interpreter. These also imply the <tt>--no-save</tt> option, preventing the creation of useless workspace files on exit.  


<!--T:67-->
Note that '''any calculations lasting more than two or three minutes should not be run on the login node'''.
Note that '''any calculations lasting more than two or three minutes should not be run on the login node'''.
They should be run via the job scheduler.  See [[Running jobs]] for more information.
They should be run via the job scheduler.  See [[Running jobs]] for more information.


== Installing R packages ==  
== Installing R packages == <!--T:68-->


=== install.packages() ===
=== install.packages() === <!--T:69-->


<!--T:18-->
<!--T:18-->
Line 91: Line 93:
Some packages require defining the environment variable <tt>TMPDIR</tt> before installing.
Some packages require defining the environment variable <tt>TMPDIR</tt> before installing.


=== Dependencies ===<!--T:5-->
=== Dependencies === <!--T:5-->
Some packages depend on external libraries which are already installed on our clusters. If the library you need is listed at [[Available software]], then load the appropriate [[Utiliser des modules/en|module]] before installing the package that requires it.
Some packages depend on external libraries which are already installed on our clusters. If the library you need is listed at [[Available software]], then load the appropriate [[Utiliser des modules/en|module]] before installing the package that requires it.


<!--T:70-->
For example, the package <code>rgdal</code> requires a library called <code>gdal</code>. Running <code>module spider gdal/2.2.1</code> shows that it requires <code>nixpkgs</code> and <code>gcc</code> modules.  If you took the advice above to load <code>gcc</code> then both these should already be loaded. Verify this by running
For example, the package <code>rgdal</code> requires a library called <code>gdal</code>. Running <code>module spider gdal/2.2.1</code> shows that it requires <code>nixpkgs</code> and <code>gcc</code> modules.  If you took the advice above to load <code>gcc</code> then both these should already be loaded. Verify this by running


Line 104: Line 107:
If any package fails to install, be sure to read the error message carefully as it might give you details concerning additional modules you need to load.  See [[Utiliser des modules/en|Using modules]] for more on the <code>module</code> family of commands.
If any package fails to install, be sure to read the error message carefully as it might give you details concerning additional modules you need to load.  See [[Utiliser des modules/en|Using modules]] for more on the <code>module</code> family of commands.


=== Downloaded packages ===<!--T:22-->
=== Downloaded packages === <!--T:22-->
To install a package that you downloaded (i.e. not using <code>install.packages()</code>), you can install it as follow. Assuming the package is named <tt>archive_package.tgz</tt>, run the following command in a shell:
To install a package that you downloaded (i.e. not using <code>install.packages()</code>), you can install it as follow. Assuming the package is named <tt>archive_package.tgz</tt>, run the following command in a shell:
{{Command
{{Command
Line 112: Line 115:
==Exploiting Parallelism in R== <!--T:46-->
==Exploiting Parallelism in R== <!--T:46-->


<!--T:71-->
The processors on Compute Canada clusters are quite ordinary.  
The processors on Compute Canada clusters are quite ordinary.  
What makes these supercomputers ''super'' is that you have access to thousands of CPU cores with a high-performance network.
What makes these supercomputers ''super'' is that you have access to thousands of CPU cores with a high-performance network.
In order to take advantage of this hardware you must run code "in parallel".
In order to take advantage of this hardware you must run code "in parallel".


<!--T:72-->
The [https://cran.r-project.org/web/views/HighPerformanceComputing.html CRAN Task View on High-Performance and Parallel Computing with R]
The [https://cran.r-project.org/web/views/HighPerformanceComputing.html CRAN Task View on High-Performance and Parallel Computing with R]
describes a bewildering collection of inter-related R packages for parallel computing.  
describes a bewildering collection of inter-related R packages for parallel computing.  
Line 121: Line 126:
are supported on Compute Canada clusters.
are supported on Compute Canada clusters.


<!--T:73-->
'''A note on terminology:''' In much Compute Canada documentation the term 'node' refers  
'''A note on terminology:''' In much Compute Canada documentation the term 'node' refers  
to an individual machine, also called a 'host', and a collection of such nodes makes up a 'cluster'.   
to an individual machine, also called a 'host', and a collection of such nodes makes up a 'cluster'.   
Bureaucrats, cc_docs_admin, cc_staff
2,879

edits

Navigation menu