---
title: "Machine/Deep Learning"
author: "Shared Computing Cluster"
date: "July/11/2019"
output: html_document
---
**Software to connect to the remote server:**
* *Windows:* MobaXterm: ( [https://mobaxterm.mobatek.net/](https://mobaxterm.mobatek.net/) )
* *Apple OS X:* Terminal
* *Linux:* Terminal
**Software to enable graphics (X-Forwarding):**
* *Windows:* MobaXterm: ( [https://mobaxterm.mobatek.net/](https://mobaxterm.mobatek.net/) )
* *Apple OS X:* - xQuartz( [https://www.xquartz.org/](https://www.xquartz.org/) )
*Note:* After xQuartz is installed, please logout of your computer and login back again.
**SFTP Clients for File Transfer:**
* *Windows:* MobaXtern, FileZilla
* *Apple OS X:* Cyberduck, Fetch
More Information about ssh and sftp clients for connecting to the SCC can be found on ( [RCS Website](http://www.bu.edu/tech/support/research/system-usage/getting-started/get-started-file-transfer/) )
## Connecting to the SCC
Use `scc1` or `scc2` login node to connect to the *Shared Computing Cluster*:
`ssh username@scc2.bu.edu`
An example for user *ktrn*:
```{bash eval=FALSE}
[local prompt] > ssh ktrn@scc2.bu.edu # Windows
[local prompt] > ssh -Y ktrn@scc2.bu.edu # Mac
[local prompt] > ssh -X ktrn@scc2.bu.edu # Linux
```
Check if graphics works (X-forwarding is enabled):
```{bash eval=FALSE}
[scc2 ~] > xclock &
```
You should see a pop-up window with clock in it:
```{r, out.width="250px", echo=FALSE}
knitr::include_graphics("images/xclock.png")
```
If you do not see clock:
*Windows:* make sure Xserver icon on the op-left side of MobaXterm is green.
*Apple OS X:* make sure you logout of your computer after you installed xQuartz, start xQuartx (you should see xQuartz icon on the bottom of your screen) and that you use `-Y` with your ssh command when you login to the SCC
## File Transfer
There are a number of ways you can transfer files to the SCC from a local computer and back. See directions on our website:
[http://www.bu.edu/tech/support/research/system-usage/getting-started/get-started-file-transfer/](http://www.bu.edu/tech/support/research/system-usage/getting-started/get-started-file-transfer/)
Example of scp command (from a local terminal window). Transfer a file to the home directory on the SCC:
```{bash eval=FALSE}
[local prompt] date > date.txt
[local prompt] scp date.txt username@scc2.bu.edu:.
```
To download a file from a website, use wget command, i.e.:
```{bash eval=FALSE}
[scc2 ~] wget http://rcs.bu.edu/classes/DeepLearning/images/scc.jpg
```
To view the downloaded image:
```{bash eval=FALSE}
[scc2 ~] display scc.jpg
```
```{r, out.width="250px", echo=FALSE}
knitr::include_graphics("images/scc.jpg")
```
## Home Directories
On the SCC, each user has a 10 GB home directory which is backed up nightly and protected by Snapshots. Additional quota is not available for home directories. To check the home directory quota, use the quota -s command:
```{bash eval=FALSE}
[scc2 ~] quota -s
```
```{bash eval=TRUE, echo=FALSE, comment=""}
quota -s ktrn
```
Home directories are private to the user. The permissions are set that only the owner has permissions to view, modify or execute the files in the home directory. Home directories should NOT be used for the production work. Once quota is reached, your jobs will fail and many programs will not run (or even start).
## Project Directories
You can view wich projects you belong to executing command *groups*. You might belong to one or more SCC projects. The first project on your list is your default project.
```{bash eval=FALSE}
[scc2 ~] groups
cs542sp
```
When working on the assignments for this class please use *cs542sp* project.
Each SCC project has its *project space*. Use *pquota* command to see the directories associated with the project and their sizes:
```{bash, comment=""}
pquota cs542sp
```
We will be using *projectnb* partition for the class:
```{bash, comment="", eval=FALSE}
cd /projectnb/cs542sp # change directory to the project directory
ls -l # check the content of the directory
```
Each memomber of cs542 group needs to create his/hew own subdirectory and work inside this directory
```{bash, comment="", eval=FALSE}
mkdir koleinik # create subdirectory koleinik
ls -l # check what folders are there
cd koleinik # change current directory to be the one you just created
pwd # view the current directory path
```
## SCC Text editors
SCC has all standard Linux editors like *emacs*, *vi* (*vim*, *gvim*) and *nano*. There is also a note-pad like editor *gedit*
## Software on the SCC
The module package is available on the Shared Computing Cluster, allowing users to access non-standard tools or alternate versions of standard packages. This is also an alternative way to configure your environment as required by certain packages. You can read more about *module* command usage on our webpage:
[http://www.bu.edu/tech/support/research/software-and-programming/software-and-applications/modules/](http://www.bu.edu/tech/support/research/software-and-programming/software-and-applications/modules/)
To view all available modules:
```{bash eval=FALSE}
module avail
```
To list all available version for a particular package:
```{bash comment="", eval=FALSE}
module avail python3
```
```{bash comment="", eval=FALSE}
module avail anaconda3
```
## Work with Python
To select a particular version of python:
module load python/3.6.2To view which modules are loaded: ```{bash comment="", eval=FALSE} module list ``` To start Jupyter, please close any firefox browser you have opened locally and then type: ```{bash eval=FALSE} jupyter notebook ``` To run Jupyter notebook from you local browser, please see "Running Jupyter Notebook" section at the bottom of this page. SCC has spyder installed as well, but it might be a slow environment to work on the SCC. Another alternative is to write your program in an editor (or simple IDE like geany) and execute your code at the prompt:
# File: hello.py a = 2+3 print("Hello CS542!\n","a=",a)```{bash eval=TRUE} module load python3/3.6.5 python hello.py ```
#!/bin/bash -l #Specify project #$ -P cs542sp #Request appropriate time (default 12 hours; gpu jobs time limit - 2 days (48 hours), cpu jobs - 30 days (720 hours) ) #$ -l h_rt=12:00:00 #Send an email when the job is done or aborted (by default no email is sent) #$ -m e # Give job a name #$ -N hello #$ Join output and error streams into one file #$ -j y #load appropriate envornment module load python3/3.6.5 #execute the program python hello.py
module load python3/3.6.5 module load tensorflow/1.13.1To submit a job that requires a node with a GPU, your submition script might look like:
#!/bin/bash -l #Specify project #$ -P cs542sp #Request appropriate time (default 12 hours; gpu jobs time limit - 2 days (48 hours), cpu jobs - 30 days (720 hours) ) #$ -l h_rt=12:00:00 #Send an email when the job is done or aborted (by default no email is sent) #$ -m e # Give job a name #$ -N hello #$ Join output and error streams into one file #$ -j y #load appropriate envornment module load python3/3.6.5 module load tensorflow/1.13.1 #execute the program python you_code.py
[I 13:10:11.680 NotebookApp] The port 8888 is already in use, trying another port. [I 13:10:11.681 NotebookApp] The port 8889 is already in use, trying another port. [I 13:10:11.681 NotebookApp] The port 8890 is already in use, trying another port. [I 13:10:11.681 NotebookApp] The port 8891 is already in use, trying another port. [I 13:10:11.810 NotebookApp] Serving notebooks from local directory: /project/scv/classes/CS542sp [I 13:10:11.811 NotebookApp] 0 active kernels [I 13:10:11.811 NotebookApp] The Jupyter Notebook is running at: [I 13:10:11.811 NotebookApp] http://[all ip addresses on your system]:8892/ [I 13:10:11.811 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).#### Set up tunneling Open a new local terminal (where you have not logged in to the SCC) and execute ```{bash eval=FALSE} my-PC % ssh koleinik@scc2.bu.edu -L 7777:scc-x06:8892 ```