<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>compute canada on plantarum.ca</title>
    <link>https://plantarum.ca/tags/compute-canada/</link>
    <description>Recent content in compute canada on plantarum.ca</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 21 Sep 2020 00:00:00 +0000</lastBuildDate>
    
        <atom:link href="https://plantarum.ca/tags/compute-canada/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Notes on Compute Canada Accounts</title>
      <link>https://plantarum.ca/2020/09/21/notes-on-compute-canada-accounts/</link>
      <pubDate>Mon, 21 Sep 2020 00:00:00 +0000</pubDate>
      
      <guid>https://plantarum.ca/2020/09/21/notes-on-compute-canada-accounts/</guid>
      <description>&lt;p&gt;I renewed my account with &lt;a href=&#34;https://www.computecanada.ca&#34;&gt;ComputeCanada&lt;/a&gt;, which is available for all Canadian University researchers (professors and adjuncts), and students and postdocs they work with. Here are a few notes that might be handy later.&lt;/p&gt;
&lt;h1 id=&#34;accounts&#34;&gt;Accounts&lt;/h1&gt;
&lt;p&gt;Sign up for an &lt;a href=&#34;https://www.computecanada.ca/research-portal/account-management/apply-for-an-account/&#34;&gt;account&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This will get you access to the &lt;a href=&#34;https://docs.computecanada.ca/wiki/Getting_started#What_resources_are_available.3F&#34;&gt;clusters&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;login&#34;&gt;Login&lt;/h1&gt;
&lt;p&gt;Login with &lt;code&gt;ssh&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;ssh username@beluga.computecanada.ca
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the same password as the one for your Compute Canada account here.&lt;/p&gt;
&lt;p&gt;You can use &lt;a href=&#34;https://docs.computecanada.ca/wiki/Using_SSH_keys_in_Linux&#34;&gt;SSH keys&lt;/a&gt; to login without a password. After you&amp;rsquo;ve followed the instructions at that link, you won&amp;rsquo;t have to use your password anymore.&lt;/p&gt;
&lt;p&gt;For a little extra convenience, especially if you use multiple servers with different keys and usernames, add your details to &lt;code&gt;.ssh/config&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Host beluga
     HostName beluga.computecanada.ca
     User username
     IdentityFile ~/.ssh/my_rsa_key
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will allow me to login to the &lt;code&gt;beluga.computecanada.ca&lt;/code&gt; cluster as user &lt;code&gt;username&lt;/code&gt;, using the private key &lt;code&gt;~/.ssh/my_rsa_key&lt;/code&gt;, with just the following command (and no password):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;ssh beluga
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This also allows me to open files on the cluster directly from my local Emacs instance:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;M-x find-file
/ssh:beluga:~/path/to/file/on/beluga
&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&#34;working-with-r&#34;&gt;Working with R&lt;/h1&gt;
&lt;h2 id=&#34;modules&#34;&gt;Modules&lt;/h2&gt;
&lt;p&gt;After a long day spent diving through dependencies, I found the following
minimal set of modules necessary to install the packages used our GBS
analysis:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;module load nixpkgs/16.09 gcc/7.3.0 gdal/3.0.1 udunits/2.2.26 proj4-fortran/1.0 proj/6.3.0 r/4.0.2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You run this command (on a single line) at the terminal after logging into
the cluster. After you&amp;rsquo;ve loaded the modules, you can save the collection
for future sessions with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;module save r_modules
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On our next, and all subsequent sessions, we can load R into an interactive
session via:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;module restore r_modules
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that you may need to add additional modules to support new packages
you install. Sometimes &lt;code&gt;install.packages&lt;/code&gt; will give you an informative
error message. Sometimes you&amp;rsquo;re not so lucky. Check to see which actual
package causes the error (i.e., the one you&amp;rsquo;re installing, or one of its
dependencies), and check the source repository for the problematic package
for additional clues.&lt;/p&gt;
&lt;h2 id=&#34;shared-r-library&#34;&gt;Shared R library&lt;/h2&gt;
&lt;p&gt;I set up a shared drive for everyone in the lab to use. This will save a
lot of time, as installing packages from source on Linux can take a while.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;mkdir $HOME/projects/def-tsmith/lab
setfacl -d -m g::rwx $HOME/projects/def-tsmith/lab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;def-tsmith&lt;/code&gt; is my group name, if you don&amp;rsquo;t work with me you&amp;rsquo;ll need to use
your supervisor&amp;rsquo;s project name instead.&lt;/p&gt;
&lt;p&gt;To access this library, &lt;strong&gt;after&lt;/strong&gt; you have loaded the &lt;code&gt;R&lt;/code&gt; modules, execute
the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;export R_LIBS=~/projects/def-tsmith/lab/R/x86_64-pc-linux-gnu-library/${EBVERSIONR%.*}/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;EBVERSIONR&lt;/code&gt; is the version of R installed, including the bugfix release
number (e.g., 4.0.2). We only use the major.minor numbers for the library
directories (4.0), so I&amp;rsquo;ve trimmed off the last number via &lt;a href=&#34;https://tldp.org/LDP/abs/html/parameter-substitution.html&#34;&gt;parameter substitution&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After you&amp;rsquo;ve done this, you can start R in an interactive session via &lt;code&gt;R&lt;/code&gt;.
You&amp;rsquo;ll have access to all the packages I&amp;rsquo;ve already installed, and any new
packages will be installed into the same shared library.&lt;/p&gt;
&lt;h2 id=&#34;jobs&#34;&gt;Jobs&lt;/h2&gt;
&lt;p&gt;To load the modules and access the shared library from your scripts, use
the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
##
##SBATCH settings for the job
##...

module restore r_modules
export R_LIBS=~/projects/def-tsmith/lab/R/x86_64-pc-linux-gnu-library/${EBVERSIONR%.*}/

## &#39;computation.R&#39; contains the code you want to run:
Rscript computation.R
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
  </channel>
</rss>
