First, if on Windows, make sure the system is updated (any version of an updated Windows 10 would work). You can choose either to stick with powershell
or install WSL, then follow either of the two:
-
Run Powershell in
Run as Administrator
mode. Follow instructions for Windows. -
Get Ubuntu on with WSL and open an Ubuntu terminal. Follow instructions for Linux / Mac OS after that. Always start with your
$HOME
directory bycd ~
.
Through out the instruction we use Cedar cluster on ComputeCanada. You can also try other clusters by yourself, see List of Clusters. Note: Access to Niagara is not allowed automatically, and you can opt-in.
-
While not strictly needed, an environment variable for your username will help significantly.
Linux / Mac OS
If your login is
YOURUSERNAME
then runexport CCUSER=YOURUSERNAME
Additionally, add it to your
.bashrc
,vim .bashrc
Then add
export CCUSER=YOURUSERNAME
at the bottomIn Vim, you go
<ESC> i
to enter insert mode, make your changes, and then<ESC> :wq!
to save and exit (:w
means to save,:q
means to exit, you can also type:help
for more details).Windows Powershell
If your login is
YOURUSERNAME
then run[Environment]::SetEnvironmentVariable("CCUSER", "YOURUSERNAME", "Machine")
to add an global, persistent environment variable. You can also manually add this environment variable through Control Panel.
-
You can login to ComputeCanada using your username and password.
Linux / Mac OS
ssh $CCUSER@cedar.computecanada.ca
Windows Powershell
ssh $env:CCUSER@cedar.computecanada.ca
The first time you login to the cluster, it will add a fingerprint to your local machine. Type
yes
when you encounter that question. -
To close the connection, type
exit
and enter, then close the terminal.
To make your life easier in logging into the cluster and transferring files from and to the cluster, we create a configuration file and generate ssh
keys for that.
-
Open your terminal (
powershell
if on Windows), typessh-keygen
and run. Accept the default location if asked. The default location is~/.ssh/id_rsa.pub
(Windows users: you cancd ~
inpowershell
as well. The directory~
is equivalent toC:\Users\YOURUSERNAME
. You can use either/
or\
in navigating to directories). Do not replace the file by typingn
and enter ifid_rsa
already exists on your local machine and a question pop up when runningssh-keygen
. -
Then attach the key to Compute Canada servers. Note: Compute Canada provides a new feature starting from June 2021 to upload public ssh key for all the clusters, see here. Visit here and copy-paste your public ssh key from
cat ~/.ssh/id_rsa.pub
-
Set up a
config
file to simplifyssh
andscp
processes- Open a text editor and enter the following (with your own ComputeCanada username replaced)
Host cedar User YOURUSERNAME Hostname cedar.computecanada.ca IdentityFile ~/.ssh/id_rsa
- Save the file to
~/.ssh/config
. - After that you only need to
ssh cedar
andscp cedar
when logging on or copy files from the cluster
-
Log on to the cluster with
ssh cedar
and make sure to stay in your home~
directory by typingcd ~
-
To fully automate an (opinionated) setup, type
git clone https://github.com/ubcecon/cluster_tools.git
This setup will install the environment you need for Jupyter Notebooks in Julia.
- Then run the built in setup script (warning: this will replace your
.bashrc
and delete.julia
and a few others)
bash ~/cluster_tools/bin/setup_cluster.sh
- This should take 5'ish minutes for the full setup. After it is done, type
exit
to close the cluster, reshell in, and you should be good to go.
Note: If the cluster_tools
are modified and you want to redo the setup, simply execute:
cd cluster_tools
git pull
cd ..
bash ~/cluster_tools/bin/setup_cluster.sh