<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://info.stat.cmu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ebensen</id>
	<title>Stat DS Computing Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://info.stat.cmu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ebensen"/>
	<link rel="alternate" type="text/html" href="https://info.stat.cmu.edu/index.php?title=Special:Contributions/Ebensen"/>
	<updated>2026-11-05T15:33:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://info.stat.cmu.edu/index.php?title=Linux_and_department_servers&amp;diff=197</id>
		<title>Linux and department servers</title>
		<link rel="alternate" type="text/html" href="https://info.stat.cmu.edu/index.php?title=Linux_and_department_servers&amp;diff=197"/>
		<updated>2025-03-24T13:27:39Z</updated>

		<summary type="html">&lt;p&gt;Ebensen: /* What resources exist */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The department has a set of servers, the hydras, that can help you run large analyses and gain a better understanding of common command line structure for more high scale computing. One can also view the department servers a bit more as a “sandbox” or “playground” as there are very few constraints and it’s okay to not run as polished code as you might on the [[PSC]] or Azure.&lt;br /&gt;
&lt;br /&gt;
[&#039;&#039;&#039;Request:&#039;&#039;&#039; Windows users (and all users) - if you see comments that are outdated / less helpful than expected please contribute.]&lt;br /&gt;
&lt;br /&gt;
== What resources exist ==&lt;br /&gt;
&lt;br /&gt;
# The department provides 13 servers (named {&amp;lt;code&amp;gt;hydra1&amp;lt;/code&amp;gt;, ... , &amp;lt;code&amp;gt;hydra13&amp;lt;/code&amp;gt;}&amp;lt;code&amp;gt;.stat.cmu.edu&amp;lt;/code&amp;gt;. &lt;br /&gt;
# Each hydra has 12 CPU cores, and 64 GB of RAM (per core).&lt;br /&gt;
## The exceptions are hydra7 and hydra8, which have 128 GB of RAM. Use these if you have particularly large jobs that need lots of memory.&lt;br /&gt;
# The hydras all share the same data file system. This allows you to upload a file to any of the hydras and then have it on all of them.&lt;br /&gt;
# [[OpenMPI]] is installed&lt;br /&gt;
#* This allows MPI based parallelization to be used&lt;br /&gt;
#* Note that the hydras ARE NOT network connected, so MPI can only be used within a single hydra. It cannot communicate across multiple hydras.&lt;br /&gt;
#* If you need to run something in parallel across multiple nodes, you should use [[PSC]] instead.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;See [[what_resources_when| What resources when]] for guides to help decide which resource you should be using.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Using the servers respectfully ==&lt;br /&gt;
Because the servers are a shared department resource it is important to use them respectfully. There are many servers and multiple cores (CPUs) per server. To be respectful of other users:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Check the current usage&#039;&#039;&#039; of the server you&#039;re on before using it.&lt;br /&gt;
# Do not use &#039;&#039;&#039;all&#039;&#039;&#039; the cores on a server, and do not use &#039;&#039;&#039;all&#039;&#039;&#039; the servers at the same time, so others can get work done.&lt;br /&gt;
# If you have a long-running job, &#039;&#039;&#039;deprioritize it&#039;&#039;&#039; so others can run too.&lt;br /&gt;
&lt;br /&gt;
Each of these is easy to check.&lt;br /&gt;
&lt;br /&gt;
=== Checking current usage ===&lt;br /&gt;
To check which servers are currently being used and which are open, see the [https://info.stat.cmu.edu/grafana/d/fdkb6l4klj400d/hydra-cluster?orgId=1 Grafana dashboard for the hydras]. It lists them all and their current usage.&lt;br /&gt;
&lt;br /&gt;
When you&#039;re logged in to one node, you can use the &amp;lt;code&amp;gt;top&amp;lt;/code&amp;gt; command. &amp;lt;code&amp;gt;top&amp;lt;/code&amp;gt; displays the current usage of the server’s resources with a list of jobs run. It also tells you the percentage of the cores that are being used and the amount of RAM (memory) that is available. See [https://www.howtogeek.com/668986/how-to-use-the-linux-top-command-and-understand-its-output/ howtogeek] resources on how to interpret it all (the documentation is very clean, so we encourage you to read up ther&lt;br /&gt;
&lt;br /&gt;
=== Limiting the cores you use ===&lt;br /&gt;
We recommend that when using parallel processing, use fewer than the total number of cores on the server. Most parallel processing packages let you choose the number of cores to use; the hydras have 12, so pick something smaller.&lt;br /&gt;
&lt;br /&gt;
=== Deprioritize when possible ===&lt;br /&gt;
&amp;lt;code&amp;gt;nice/renice&amp;lt;/code&amp;gt; allows you to lower the priority of your jobs, so the operating system lets other processes run first. See [https://www.howtogeek.com/411979/how-to-set-process-priorities-with-the-nice-and-renice-commands-in-linux/ howtogeek] resources on the basics. &amp;lt;code&amp;gt;nice&amp;lt;/code&amp;gt; sets the priority, and &amp;lt;code&amp;gt;renice&amp;lt;/code&amp;gt; updates your priority. On the department servers, everyone starts at the same priority, and you can only &#039;&#039;&#039;deprioritize&#039;&#039;&#039; your jobs -- you can&#039;t make them higher priority than everyone else.&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;nice -20 Rscript some-big-script.R&lt;br /&gt;
renice -n 20 processid # get the process ID from top&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Introduction to connecting to the server and useful Linux commands ==&lt;br /&gt;
&lt;br /&gt;
The department servers all run Linux, and require you to use a command line to interact with it (as compared to Rstudio and other GUIs).&lt;br /&gt;
=== Getting Access: (&amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
To get onto the server and type code you’ll need to access it through &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For Macs (and Linux), open up a &amp;lt;code&amp;gt;terminal&amp;lt;/code&amp;gt; and type &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ssh andrew_id@hydra1.stat.cmu.edu&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you will then have to type in your password (if you don’t know it or don’t know it or have never accessed the server before - email [mailto:remarks@stat.cmu.edu remarks@stat.cmu.edu]).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
For Windows, there&#039;s a few options (with different pros and cons). [https://www.makeuseof.com/tag/4-easy-ways-to-use-ssh-in-windows/ Makeuseof] provides an overview and introduction to how to get started on a few approaches, including PuTTY and Windows PowerShell. &lt;br /&gt;
&lt;br /&gt;
Again, make sure to email [mailto:remarks@stat.cmu.edu remarks@stat.cmu.edu] to check that you have an account / or what your password is if you forgot.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
If you’re accessing the servers a lot, you might also look into aliases and password storing for the &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; commands. - Mac/Linux: [https://scotch.io/tutorials/how-to-create-an-ssh-shortcut scotch.io] - Windows: Powershell: [https://docs.microsoft.com/en-us/windows/terminal/tutorials/ssh microsoft], PuTTY: [https://www.makeuseof.com/tag/4-easy-ways-to-use-ssh-in-windows/ makeuseof]&lt;br /&gt;
&lt;br /&gt;
=== File sharing (&amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; +) ===&lt;br /&gt;
&lt;br /&gt;
There is also command line code to copy files from your personal computer to the server. This is done with a SCP (secure copy) tool. There are also GUIs (graphical user interfaces) that allow you to “drag and drop” files from your computer to the server (and visa-versa). Currently, a lot of students use GUIs to deal with file sharing.&lt;br /&gt;
&lt;br /&gt;
==== Command line &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
You can file share either by using &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt;, for example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt; Mac/Linux: This command is very similar to &amp;lt;code&amp;gt;cp&amp;lt;/code&amp;gt; (the file copier). &lt;br /&gt;
  &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Copy from server&lt;br /&gt;
    &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp username@from_host:path/to/file.txt /local/directory/ &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;scp -r username@from_host:path/to/folder/ local/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Copy to server&lt;br /&gt;
    &amp;amp;nbsp;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp local/file.txt username@to_host:/remote/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp -r local/directory/ username@to_host:/remote/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; references: [https://haydenjames.io/linux-securely-copy-files-using-scp/ haydenjames.io]&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Windows: Again, this process is a bit more complicated. &lt;br /&gt;
  &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;A PuTTY + Command Prompt provides a version that is very similar to Mac/Linux &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; (reference: [https://success.tanaza.com/s/article/How-to-use-SCP-command-on-Windows tanaza]), and requires minor changes in the call&amp;amp;nbsp;&amp;amp;nbsp;(&amp;lt;code&amp;gt;pscp -scp&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;scp)&amp;lt;/code&amp;gt;. &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;A Powershell specific command is a bit more complicated / not similar to Mac/Linux &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; (reference: [https://www.nsoftware.com/kb/articles/psserver-scp.rst nsoftware]) &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp;nbsp;GUI “drag-and-drop” file sharing ===&lt;br /&gt;
A &#039;&#039;&#039;lot&#039;&#039;&#039; of students use &#039;&#039;&#039;GUI&#039;&#039;&#039; interfaces to transfer files instead of &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; command line. These tools allow you to “drag and drop” files from one location to another after the connection is set up.&lt;br /&gt;
&lt;br /&gt;
Some examples include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Mac:&lt;br /&gt;
  &amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; &lt;br /&gt;
  [https://cyberduck.io/ Cyberduck] &lt;br /&gt;
  &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Linux: &lt;br /&gt;
  &amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; &lt;br /&gt;
  [https://www.openssh.com/ OpenSSH] &lt;br /&gt;
  &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Windows: lots of options - [https://www.thegeekstuff.com/2011/06/windows-sftp-scp-clients/ thegeekstuff] &lt;br /&gt;
  &amp;lt;ol&amp;gt; &lt;br /&gt;
    &amp;lt;li&amp;gt;[https://www.putty.org/ PuTTY] &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[https://winscp.net/eng/download.php WinSCP] &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
=== Basic CLI (Linux command line): &amp;lt;code&amp;gt;bash&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Understanding the basic Linux command line is important to be able to navigate when you are actually on the server. Below are some based commands to move around the file system, manipulate files, and view storage structure.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! command&lt;br /&gt;
! translation&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;&lt;br /&gt;
| print the current working directory&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cd _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| change directory&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;rm _file_&amp;lt;/code&amp;gt;&lt;br /&gt;
| remove / delete file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mv _file_ _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| move file (can change name)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cp _file_ _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| copy file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ls _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| list files in directory&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
use &amp;lt;code&amp;gt;man _command_&amp;lt;/code&amp;gt; to get a listing / manual of the command.&lt;br /&gt;
&lt;br /&gt;
Additional resources that capture more information on the command line and are still geared to statistical computing can be found here: [http://www.jarrodmillman.com/rcsds/standard/bash.html UCB 2015 reproducible DS lecture notes].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TODO: add information about &amp;lt;code&amp;gt;sed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;, and a link to bash files.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Text editors ==&lt;br /&gt;
&lt;br /&gt;
There are multiple options to view code on the server side. They include:&lt;br /&gt;
&lt;br /&gt;
*vim &lt;br /&gt;
*… [to be added later] &lt;br /&gt;
&lt;br /&gt;
== Running jobs ==&lt;br /&gt;
&lt;br /&gt;
We have included thoughts about running jobs in two places.&lt;br /&gt;
&lt;br /&gt;
#The first looks at tools that allow you to keep running jobs on the server when you close the connection to the server (turn off your laptop, etc.). These tools are call [[Terminal_multiplexers|terminal multiplexers]].&amp;amp;nbsp; &lt;br /&gt;
#The second set of tools focus on how to run your [[R_on_the_server|R analysis]] or [[Python_on_the_server|Python analysis]] code on the server.&lt;br /&gt;
&lt;br /&gt;
== Server specs ==&lt;br /&gt;
&lt;br /&gt;
Generally speaking, our servers have multiple CPU cores, but no GPU cores. For deep learning tasks that need GPUs, consider using the [[GPU Cluster|GPU cluster]].&lt;br /&gt;
&lt;br /&gt;
To examine the specs yourself, use&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cat /proc/meminfo&lt;br /&gt;
cat /proc/cpuinfo&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to see some information.&lt;/div&gt;</summary>
		<author><name>Ebensen</name></author>
	</entry>
	<entry>
		<id>https://info.stat.cmu.edu/index.php?title=Linux_and_department_servers&amp;diff=196</id>
		<title>Linux and department servers</title>
		<link rel="alternate" type="text/html" href="https://info.stat.cmu.edu/index.php?title=Linux_and_department_servers&amp;diff=196"/>
		<updated>2025-03-23T21:17:00Z</updated>

		<summary type="html">&lt;p&gt;Ebensen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The department has a set of servers, the hydras, that can help you run large analyses and gain a better understanding of common command line structure for more high scale computing. One can also view the department servers a bit more as a “sandbox” or “playground” as there are very few constraints and it’s okay to not run as polished code as you might on the [[PSC]] or Azure.&lt;br /&gt;
&lt;br /&gt;
[&#039;&#039;&#039;Request:&#039;&#039;&#039; Windows users (and all users) - if you see comments that are outdated / less helpful than expected please contribute.]&lt;br /&gt;
&lt;br /&gt;
== What resources exist ==&lt;br /&gt;
&lt;br /&gt;
# The department provides 13 servers (named {&amp;lt;code&amp;gt;hydra1&amp;lt;/code&amp;gt;, ... , &amp;lt;code&amp;gt;hydra13&amp;lt;/code&amp;gt;}&amp;lt;code&amp;gt;.stat.cmu.edu&amp;lt;/code&amp;gt;. &lt;br /&gt;
# Each hydra has 12 CPU cores, and 64 GB of RAM (per core).&lt;br /&gt;
## The exceptions are hydra7 and hydra8, which have 128 GB of RAM. Use these if you have particularly large jobs that need lots of memory.&lt;br /&gt;
# The hydras all share the same data file system. This allows you to upload a file to any of the hydras and then have it on all of them.&lt;br /&gt;
# [[OpenMPI]] is installed&lt;br /&gt;
#* This allows MPI based parallelization to be used&lt;br /&gt;
#* Note that the hydras ARE NOT network connected, so MPI can only be used within a single hydra. It cannot communicate across multiple hydras.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;See [[what_resources_when| What resources when]] for guides to help decide which resource you should be using.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Using the servers respectfully ==&lt;br /&gt;
Because the servers are a shared department resource it is important to use them respectfully. There are many servers and multiple cores (CPUs) per server. To be respectful of other users:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Check the current usage&#039;&#039;&#039; of the server you&#039;re on before using it.&lt;br /&gt;
# Do not use &#039;&#039;&#039;all&#039;&#039;&#039; the cores on a server, and do not use &#039;&#039;&#039;all&#039;&#039;&#039; the servers at the same time, so others can get work done.&lt;br /&gt;
# If you have a long-running job, &#039;&#039;&#039;deprioritize it&#039;&#039;&#039; so others can run too.&lt;br /&gt;
&lt;br /&gt;
Each of these is easy to check.&lt;br /&gt;
&lt;br /&gt;
=== Checking current usage ===&lt;br /&gt;
To check which servers are currently being used and which are open, see the [https://info.stat.cmu.edu/grafana/d/fdkb6l4klj400d/hydra-cluster?orgId=1 Grafana dashboard for the hydras]. It lists them all and their current usage.&lt;br /&gt;
&lt;br /&gt;
When you&#039;re logged in to one node, you can use the &amp;lt;code&amp;gt;top&amp;lt;/code&amp;gt; command. &amp;lt;code&amp;gt;top&amp;lt;/code&amp;gt; displays the current usage of the server’s resources with a list of jobs run. It also tells you the percentage of the cores that are being used and the amount of RAM (memory) that is available. See [https://www.howtogeek.com/668986/how-to-use-the-linux-top-command-and-understand-its-output/ howtogeek] resources on how to interpret it all (the documentation is very clean, so we encourage you to read up ther&lt;br /&gt;
&lt;br /&gt;
=== Limiting the cores you use ===&lt;br /&gt;
We recommend that when using parallel processing, use fewer than the total number of cores on the server. Most parallel processing packages let you choose the number of cores to use; the hydras have 12, so pick something smaller.&lt;br /&gt;
&lt;br /&gt;
=== Deprioritize when possible ===&lt;br /&gt;
&amp;lt;code&amp;gt;nice/renice&amp;lt;/code&amp;gt; allows you to lower the priority of your jobs, so the operating system lets other processes run first. See [https://www.howtogeek.com/411979/how-to-set-process-priorities-with-the-nice-and-renice-commands-in-linux/ howtogeek] resources on the basics. &amp;lt;code&amp;gt;nice&amp;lt;/code&amp;gt; sets the priority, and &amp;lt;code&amp;gt;renice&amp;lt;/code&amp;gt; updates your priority. On the department servers, everyone starts at the same priority, and you can only &#039;&#039;&#039;deprioritize&#039;&#039;&#039; your jobs -- you can&#039;t make them higher priority than everyone else.&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;nice -20 Rscript some-big-script.R&lt;br /&gt;
renice -n 20 processid # get the process ID from top&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Introduction to connecting to the server and useful Linux commands ==&lt;br /&gt;
&lt;br /&gt;
The department servers all run Linux, and require you to use a command line to interact with it (as compared to Rstudio and other GUIs).&lt;br /&gt;
=== Getting Access: (&amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
To get onto the server and type code you’ll need to access it through &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For Macs (and Linux), open up a &amp;lt;code&amp;gt;terminal&amp;lt;/code&amp;gt; and type &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ssh andrew_id@hydra1.stat.cmu.edu&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you will then have to type in your password (if you don’t know it or don’t know it or have never accessed the server before - email [mailto:remarks@stat.cmu.edu remarks@stat.cmu.edu]).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
For Windows, there&#039;s a few options (with different pros and cons). [https://www.makeuseof.com/tag/4-easy-ways-to-use-ssh-in-windows/ Makeuseof] provides an overview and introduction to how to get started on a few approaches, including PuTTY and Windows PowerShell. &lt;br /&gt;
&lt;br /&gt;
Again, make sure to email [mailto:remarks@stat.cmu.edu remarks@stat.cmu.edu] to check that you have an account / or what your password is if you forgot.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
If you’re accessing the servers a lot, you might also look into aliases and password storing for the &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; commands. - Mac/Linux: [https://scotch.io/tutorials/how-to-create-an-ssh-shortcut scotch.io] - Windows: Powershell: [https://docs.microsoft.com/en-us/windows/terminal/tutorials/ssh microsoft], PuTTY: [https://www.makeuseof.com/tag/4-easy-ways-to-use-ssh-in-windows/ makeuseof]&lt;br /&gt;
&lt;br /&gt;
=== File sharing (&amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; +) ===&lt;br /&gt;
&lt;br /&gt;
There is also command line code to copy files from your personal computer to the server. This is done with a SCP (secure copy) tool. There are also GUIs (graphical user interfaces) that allow you to “drag and drop” files from your computer to the server (and visa-versa). Currently, a lot of students use GUIs to deal with file sharing.&lt;br /&gt;
&lt;br /&gt;
==== Command line &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
You can file share either by using &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt;, for example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt; Mac/Linux: This command is very similar to &amp;lt;code&amp;gt;cp&amp;lt;/code&amp;gt; (the file copier). &lt;br /&gt;
  &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Copy from server&lt;br /&gt;
    &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp username@from_host:path/to/file.txt /local/directory/ &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;scp -r username@from_host:path/to/folder/ local/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Copy to server&lt;br /&gt;
    &amp;amp;nbsp;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp local/file.txt username@to_host:/remote/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp -r local/directory/ username@to_host:/remote/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; references: [https://haydenjames.io/linux-securely-copy-files-using-scp/ haydenjames.io]&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Windows: Again, this process is a bit more complicated. &lt;br /&gt;
  &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;A PuTTY + Command Prompt provides a version that is very similar to Mac/Linux &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; (reference: [https://success.tanaza.com/s/article/How-to-use-SCP-command-on-Windows tanaza]), and requires minor changes in the call&amp;amp;nbsp;&amp;amp;nbsp;(&amp;lt;code&amp;gt;pscp -scp&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;scp)&amp;lt;/code&amp;gt;. &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;A Powershell specific command is a bit more complicated / not similar to Mac/Linux &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; (reference: [https://www.nsoftware.com/kb/articles/psserver-scp.rst nsoftware]) &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp;nbsp;GUI “drag-and-drop” file sharing ===&lt;br /&gt;
A &#039;&#039;&#039;lot&#039;&#039;&#039; of students use &#039;&#039;&#039;GUI&#039;&#039;&#039; interfaces to transfer files instead of &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; command line. These tools allow you to “drag and drop” files from one location to another after the connection is set up.&lt;br /&gt;
&lt;br /&gt;
Some examples include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Mac:&lt;br /&gt;
  &amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; &lt;br /&gt;
  [https://cyberduck.io/ Cyberduck] &lt;br /&gt;
  &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Linux: &lt;br /&gt;
  &amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; &lt;br /&gt;
  [https://www.openssh.com/ OpenSSH] &lt;br /&gt;
  &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Windows: lots of options - [https://www.thegeekstuff.com/2011/06/windows-sftp-scp-clients/ thegeekstuff] &lt;br /&gt;
  &amp;lt;ol&amp;gt; &lt;br /&gt;
    &amp;lt;li&amp;gt;[https://www.putty.org/ PuTTY] &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[https://winscp.net/eng/download.php WinSCP] &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
=== Basic CLI (Linux command line): &amp;lt;code&amp;gt;bash&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Understanding the basic Linux command line is important to be able to navigate when you are actually on the server. Below are some based commands to move around the file system, manipulate files, and view storage structure.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! command&lt;br /&gt;
! translation&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;&lt;br /&gt;
| print the current working directory&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cd _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| change directory&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;rm _file_&amp;lt;/code&amp;gt;&lt;br /&gt;
| remove / delete file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mv _file_ _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| move file (can change name)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cp _file_ _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| copy file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ls _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| list files in directory&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
use &amp;lt;code&amp;gt;man _command_&amp;lt;/code&amp;gt; to get a listing / manual of the command.&lt;br /&gt;
&lt;br /&gt;
Additional resources that capture more information on the command line and are still geared to statistical computing can be found here: [http://www.jarrodmillman.com/rcsds/standard/bash.html UCB 2015 reproducible DS lecture notes].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TODO: add information about &amp;lt;code&amp;gt;sed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;, and a link to bash files.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Text editors ==&lt;br /&gt;
&lt;br /&gt;
There are multiple options to view code on the server side. They include:&lt;br /&gt;
&lt;br /&gt;
*vim &lt;br /&gt;
*… [to be added later] &lt;br /&gt;
&lt;br /&gt;
== Running jobs ==&lt;br /&gt;
&lt;br /&gt;
We have included thoughts about running jobs in two places.&lt;br /&gt;
&lt;br /&gt;
#The first looks at tools that allow you to keep running jobs on the server when you close the connection to the server (turn off your laptop, etc.). These tools are call [[Terminal_multiplexers|terminal multiplexers]].&amp;amp;nbsp; &lt;br /&gt;
#The second set of tools focus on how to run your [[R_on_the_server|R analysis]] or [[Python_on_the_server|Python analysis]] code on the server.&lt;br /&gt;
&lt;br /&gt;
== Server specs ==&lt;br /&gt;
&lt;br /&gt;
Generally speaking, our servers have multiple CPU cores, but no GPU cores. For deep learning tasks that need GPUs, consider using the [[GPU Cluster|GPU cluster]].&lt;br /&gt;
&lt;br /&gt;
To examine the specs yourself, use&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cat /proc/meminfo&lt;br /&gt;
cat /proc/cpuinfo&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to see some information.&lt;/div&gt;</summary>
		<author><name>Ebensen</name></author>
	</entry>
	<entry>
		<id>https://info.stat.cmu.edu/index.php?title=Linux_and_department_servers&amp;diff=195</id>
		<title>Linux and department servers</title>
		<link rel="alternate" type="text/html" href="https://info.stat.cmu.edu/index.php?title=Linux_and_department_servers&amp;diff=195"/>
		<updated>2025-03-23T21:15:20Z</updated>

		<summary type="html">&lt;p&gt;Ebensen: Edited OpenMPI comment on the hydra page to reflect the fact that the hydras are not network connected.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The department has a set of servers, the hydras, that can help you run large analyses and gain a better understanding of common command line structure for more high scale computing. One can also view the department servers a bit more as a “sandbox” or “playground” as there are very few constraints and it’s okay to not run as polished code as you might on the [[PSC]] or Azure.&lt;br /&gt;
&lt;br /&gt;
[&#039;&#039;&#039;Request:&#039;&#039;&#039; Windows users (and all users) - if you see comments that are outdated / less helpful than expected please contribute.]&lt;br /&gt;
&lt;br /&gt;
== What resources exist ==&lt;br /&gt;
&lt;br /&gt;
# The department provides 13 servers (named {&amp;lt;code&amp;gt;hydra1&amp;lt;/code&amp;gt;, ... , &amp;lt;code&amp;gt;hydra13&amp;lt;/code&amp;gt;}&amp;lt;code&amp;gt;.stat.cmu.edu&amp;lt;/code&amp;gt;. &lt;br /&gt;
# Each hydra has 12 CPU cores, and 64 GB of RAM (per core).&lt;br /&gt;
## The exceptions are hydra7 and hydra8, which have 128 GB of RAM. Use these if you have particularly large jobs that need lots of memory.&lt;br /&gt;
# The hydras all share the same data file system. This allows you to upload a file to any of the hydras and then have it on all of them.&lt;br /&gt;
# [[OpenMPI]] is installed&lt;br /&gt;
#* This allows MPI based parallelization to be used&lt;br /&gt;
#* Note that the hydras ARE NOT network connected, so MPI can only be used within a single hydra. It cannot communicate across hydras.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;See [[what_resources_when| What resources when]] for guides to help decide which resource you should be using.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Using the servers respectfully ==&lt;br /&gt;
Because the servers are a shared department resource it is important to use them respectfully. There are many servers and multiple cores (CPUs) per server. To be respectful of other users:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Check the current usage&#039;&#039;&#039; of the server you&#039;re on before using it.&lt;br /&gt;
# Do not use &#039;&#039;&#039;all&#039;&#039;&#039; the cores on a server, and do not use &#039;&#039;&#039;all&#039;&#039;&#039; the servers at the same time, so others can get work done.&lt;br /&gt;
# If you have a long-running job, &#039;&#039;&#039;deprioritize it&#039;&#039;&#039; so others can run too.&lt;br /&gt;
&lt;br /&gt;
Each of these is easy to check.&lt;br /&gt;
&lt;br /&gt;
=== Checking current usage ===&lt;br /&gt;
To check which servers are currently being used and which are open, see the [https://info.stat.cmu.edu/grafana/d/fdkb6l4klj400d/hydra-cluster?orgId=1 Grafana dashboard for the hydras]. It lists them all and their current usage.&lt;br /&gt;
&lt;br /&gt;
When you&#039;re logged in to one node, you can use the &amp;lt;code&amp;gt;top&amp;lt;/code&amp;gt; command. &amp;lt;code&amp;gt;top&amp;lt;/code&amp;gt; displays the current usage of the server’s resources with a list of jobs run. It also tells you the percentage of the cores that are being used and the amount of RAM (memory) that is available. See [https://www.howtogeek.com/668986/how-to-use-the-linux-top-command-and-understand-its-output/ howtogeek] resources on how to interpret it all (the documentation is very clean, so we encourage you to read up ther&lt;br /&gt;
&lt;br /&gt;
=== Limiting the cores you use ===&lt;br /&gt;
We recommend that when using parallel processing, use fewer than the total number of cores on the server. Most parallel processing packages let you choose the number of cores to use; the hydras have 12, so pick something smaller.&lt;br /&gt;
&lt;br /&gt;
=== Deprioritize when possible ===&lt;br /&gt;
&amp;lt;code&amp;gt;nice/renice&amp;lt;/code&amp;gt; allows you to lower the priority of your jobs, so the operating system lets other processes run first. See [https://www.howtogeek.com/411979/how-to-set-process-priorities-with-the-nice-and-renice-commands-in-linux/ howtogeek] resources on the basics. &amp;lt;code&amp;gt;nice&amp;lt;/code&amp;gt; sets the priority, and &amp;lt;code&amp;gt;renice&amp;lt;/code&amp;gt; updates your priority. On the department servers, everyone starts at the same priority, and you can only &#039;&#039;&#039;deprioritize&#039;&#039;&#039; your jobs -- you can&#039;t make them higher priority than everyone else.&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;nice -20 Rscript some-big-script.R&lt;br /&gt;
renice -n 20 processid # get the process ID from top&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Introduction to connecting to the server and useful Linux commands ==&lt;br /&gt;
&lt;br /&gt;
The department servers all run Linux, and require you to use a command line to interact with it (as compared to Rstudio and other GUIs).&lt;br /&gt;
=== Getting Access: (&amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
To get onto the server and type code you’ll need to access it through &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For Macs (and Linux), open up a &amp;lt;code&amp;gt;terminal&amp;lt;/code&amp;gt; and type &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ssh andrew_id@hydra1.stat.cmu.edu&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you will then have to type in your password (if you don’t know it or don’t know it or have never accessed the server before - email [mailto:remarks@stat.cmu.edu remarks@stat.cmu.edu]).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
For Windows, there&#039;s a few options (with different pros and cons). [https://www.makeuseof.com/tag/4-easy-ways-to-use-ssh-in-windows/ Makeuseof] provides an overview and introduction to how to get started on a few approaches, including PuTTY and Windows PowerShell. &lt;br /&gt;
&lt;br /&gt;
Again, make sure to email [mailto:remarks@stat.cmu.edu remarks@stat.cmu.edu] to check that you have an account / or what your password is if you forgot.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
If you’re accessing the servers a lot, you might also look into aliases and password storing for the &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; commands. - Mac/Linux: [https://scotch.io/tutorials/how-to-create-an-ssh-shortcut scotch.io] - Windows: Powershell: [https://docs.microsoft.com/en-us/windows/terminal/tutorials/ssh microsoft], PuTTY: [https://www.makeuseof.com/tag/4-easy-ways-to-use-ssh-in-windows/ makeuseof]&lt;br /&gt;
&lt;br /&gt;
=== File sharing (&amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; +) ===&lt;br /&gt;
&lt;br /&gt;
There is also command line code to copy files from your personal computer to the server. This is done with a SCP (secure copy) tool. There are also GUIs (graphical user interfaces) that allow you to “drag and drop” files from your computer to the server (and visa-versa). Currently, a lot of students use GUIs to deal with file sharing.&lt;br /&gt;
&lt;br /&gt;
==== Command line &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
You can file share either by using &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt;, for example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt; Mac/Linux: This command is very similar to &amp;lt;code&amp;gt;cp&amp;lt;/code&amp;gt; (the file copier). &lt;br /&gt;
  &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Copy from server&lt;br /&gt;
    &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp username@from_host:path/to/file.txt /local/directory/ &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;scp -r username@from_host:path/to/folder/ local/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Copy to server&lt;br /&gt;
    &amp;amp;nbsp;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp local/file.txt username@to_host:/remote/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; scp -r local/directory/ username@to_host:/remote/directory/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; references: [https://haydenjames.io/linux-securely-copy-files-using-scp/ haydenjames.io]&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Windows: Again, this process is a bit more complicated. &lt;br /&gt;
  &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;A PuTTY + Command Prompt provides a version that is very similar to Mac/Linux &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; (reference: [https://success.tanaza.com/s/article/How-to-use-SCP-command-on-Windows tanaza]), and requires minor changes in the call&amp;amp;nbsp;&amp;amp;nbsp;(&amp;lt;code&amp;gt;pscp -scp&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;scp)&amp;lt;/code&amp;gt;. &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;A Powershell specific command is a bit more complicated / not similar to Mac/Linux &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; (reference: [https://www.nsoftware.com/kb/articles/psserver-scp.rst nsoftware]) &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp;nbsp;GUI “drag-and-drop” file sharing ===&lt;br /&gt;
A &#039;&#039;&#039;lot&#039;&#039;&#039; of students use &#039;&#039;&#039;GUI&#039;&#039;&#039; interfaces to transfer files instead of &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt; command line. These tools allow you to “drag and drop” files from one location to another after the connection is set up.&lt;br /&gt;
&lt;br /&gt;
Some examples include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Mac:&lt;br /&gt;
  &amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; &lt;br /&gt;
  [https://cyberduck.io/ Cyberduck] &lt;br /&gt;
  &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Linux: &lt;br /&gt;
  &amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; &lt;br /&gt;
  [https://www.openssh.com/ OpenSSH] &lt;br /&gt;
  &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Windows: lots of options - [https://www.thegeekstuff.com/2011/06/windows-sftp-scp-clients/ thegeekstuff] &lt;br /&gt;
  &amp;lt;ol&amp;gt; &lt;br /&gt;
    &amp;lt;li&amp;gt;[https://www.putty.org/ PuTTY] &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[https://winscp.net/eng/download.php WinSCP] &amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
=== Basic CLI (Linux command line): &amp;lt;code&amp;gt;bash&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Understanding the basic Linux command line is important to be able to navigate when you are actually on the server. Below are some based commands to move around the file system, manipulate files, and view storage structure.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! command&lt;br /&gt;
! translation&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;&lt;br /&gt;
| print the current working directory&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cd _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| change directory&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;rm _file_&amp;lt;/code&amp;gt;&lt;br /&gt;
| remove / delete file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mv _file_ _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| move file (can change name)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cp _file_ _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| copy file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ls _dir_&amp;lt;/code&amp;gt;&lt;br /&gt;
| list files in directory&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
use &amp;lt;code&amp;gt;man _command_&amp;lt;/code&amp;gt; to get a listing / manual of the command.&lt;br /&gt;
&lt;br /&gt;
Additional resources that capture more information on the command line and are still geared to statistical computing can be found here: [http://www.jarrodmillman.com/rcsds/standard/bash.html UCB 2015 reproducible DS lecture notes].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TODO: add information about &amp;lt;code&amp;gt;sed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;, and a link to bash files.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Text editors ==&lt;br /&gt;
&lt;br /&gt;
There are multiple options to view code on the server side. They include:&lt;br /&gt;
&lt;br /&gt;
*vim &lt;br /&gt;
*… [to be added later] &lt;br /&gt;
&lt;br /&gt;
== Running jobs ==&lt;br /&gt;
&lt;br /&gt;
We have included thoughts about running jobs in two places.&lt;br /&gt;
&lt;br /&gt;
#The first looks at tools that allow you to keep running jobs on the server when you close the connection to the server (turn off your laptop, etc.). These tools are call [[Terminal_multiplexers|terminal multiplexers]].&amp;amp;nbsp; &lt;br /&gt;
#The second set of tools focus on how to run your [[R_on_the_server|R analysis]] or [[Python_on_the_server|Python analysis]] code on the server.&lt;br /&gt;
&lt;br /&gt;
== Server specs ==&lt;br /&gt;
&lt;br /&gt;
Generally speaking, our servers have multiple CPU cores, but no GPU cores. For deep learning tasks that need GPUs, consider using the [[GPU Cluster|GPU cluster]].&lt;br /&gt;
&lt;br /&gt;
To examine the specs yourself, use&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;cat /proc/meminfo&lt;br /&gt;
cat /proc/cpuinfo&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to see some information.&lt;/div&gt;</summary>
		<author><name>Ebensen</name></author>
	</entry>
	<entry>
		<id>https://info.stat.cmu.edu/index.php?title=VSCode&amp;diff=145</id>
		<title>VSCode</title>
		<link rel="alternate" type="text/html" href="https://info.stat.cmu.edu/index.php?title=VSCode&amp;diff=145"/>
		<updated>2024-09-13T19:47:44Z</updated>

		<summary type="html">&lt;p&gt;Ebensen: /* Tunnelling */ edited export path instructions to be generic instead of using a path specific to PSC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
VSCode is an open-source IDE maintained by Microsoft, and it is considered a “lightweight” code editor. In comparison with full integrated development environment (IDE) editors which occupy gigabytes of disk space, VS Code uses less than 200MB when installed. Despite the “lightweight” term, Visual Studio Code offers a massive number of features (via so-called “extensions”) which keep increasing and improving with every new update.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Resources:&lt;br /&gt;
&lt;br /&gt;
#[https://code.visualstudio.com/docs Official documentation] &lt;br /&gt;
#[https://code.visualstudio.com/download Download] &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Basic Usage ==&lt;br /&gt;
&lt;br /&gt;
Some good extensions:&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
#Python (and Pylance) &lt;br /&gt;
#Jupyter &lt;br /&gt;
#R &lt;br /&gt;
#LaTeX Workshop &lt;br /&gt;
#Remote - SSH &lt;br /&gt;
#autoDocstring &lt;br /&gt;
&lt;br /&gt;
== Remote Development and Prototyping via SSH ==&lt;br /&gt;
&lt;br /&gt;
In this section we will learn how to use VSCode to manage, develop, and test code that we have stored on a remote server (like [https://www.stat.cmu.edu/computewiki/index.php/Linux_and_department_servers Hydras], [https://www.stat.cmu.edu/computewiki/index.php/Azure_getting_started Azure], etc...).&lt;br /&gt;
&lt;br /&gt;
This is particularly useful to &amp;lt;u&amp;gt;avoid&amp;lt;/u&amp;gt; painful workflows that see us doing the following:&lt;br /&gt;
&lt;br /&gt;
#develop locally on our laptop &lt;br /&gt;
#&amp;lt;font face=&amp;quot;monospace&amp;quot;&amp;gt;scp&amp;lt;/font&amp;gt; some scripts to the remote server and run them (assuming we have consistent environments) &lt;br /&gt;
#&amp;lt;font face=&amp;quot;monospace&amp;quot;&amp;gt;scp&amp;amp;nbsp;&amp;lt;/font&amp;gt;the results to the local laptop &lt;br /&gt;
#repeat from 1 &lt;br /&gt;
&lt;br /&gt;
Ideally, we want to be able to use the remote server only as the computational workhorse, while leveraging the GUI of our local operative system. Doing this in VSCode is extremely simple:&lt;br /&gt;
&lt;br /&gt;
#In the left toolbar, click on the “Extensions” button and search for SSH. The correct one is hte one developed by Microsoft (blue icon). Click on the install button.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssh.png|1000x1000px|RTENOTITLE]] &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once the extension is installed, click on the small green button at the very bottom-left of the window (the one with a symbol similar to &amp;gt;&amp;lt;). A pop-up window at the top will open: click on “Connect to Host”&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;At this point, we have two alternatives: &lt;br /&gt;
#&amp;amp;nbsp;add a new SSH host manually, which will prompt another small window where to enter the connection details (similar to what one does from the terminal) &lt;br /&gt;
#or&amp;amp;nbsp;&#039;&#039;&#039;&amp;lt;u&amp;gt;better&amp;lt;/u&amp;gt;&#039;&#039;&#039;, if we have a SSH&amp;amp;nbsp;&amp;lt;code&amp;gt;config&amp;amp;nbsp;&amp;lt;/code&amp;gt;file in the &amp;lt;code&amp;gt;.ssh&amp;amp;nbsp;&amp;lt;/code&amp;gt;directory, VSCode will automatically list the possible remote servers that are specified in this file. If we specified a path to a key, then VSCode will connect automatically. If instead the remote server requires a password (as it is the case for Hydras), then we will be prompted with another window to enter it. As an example:&lt;br /&gt;
[[File:Hosts.png|RTENOTITLE]]&lt;br /&gt;
&amp;amp;nbsp;[[File:Ssh config.png|RTENOTITLE]] &lt;br /&gt;
&amp;lt;ol start=&amp;quot;4&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Congratulations! You are now connected to a remote server through VSCode. By clicking on the “Explorer”&amp;amp;nbsp;button at the top in the left-side toolbar, you can navigate the file system of the server, develop and run code, etc. Everything you do and see is actually being hosted, run, and saved remotely.&amp;amp;nbsp;&lt;br /&gt;
[[File:Remote file.png|1000x1000px|RTENOTITLE]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Managing environments within VSCode ==&lt;br /&gt;
&lt;br /&gt;
Since each project might (and should) have its own development environment that you setup, with dependencies and packages that make it unique for the tasks of this project, VSCode allows to easily choose which interpreter&amp;amp;nbsp;to use.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
We simply have to click at the bottom right&amp;amp;nbsp;of the window, on the button that shows the current Python (or other language) version that we are using. This will open a prompt to choose the environment among those present on the&amp;amp;nbsp;machine we are developing on:&lt;br /&gt;
&lt;br /&gt;
[[File:Env.png|1000x1000px|Env.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Support for Jupyter Notebooks (even remote!) within VSCode ==&lt;br /&gt;
&lt;br /&gt;
In one of the previous section we learned how to setup VSCode for remote development. A great feature of the workflow that we have just enabled is that we can run Jupyter Notebooks (and produce plots, tables, etc...) that are hosted remotely while seeing the output on our local laptop within VSCode (this works also if we are running things locally). Doing so is very easy:&lt;br /&gt;
&lt;br /&gt;
#Click on the “Extensions” button on the left toolbar and download the Jupyter&amp;amp;nbsp;extension &lt;br /&gt;
&lt;br /&gt;
[[File:Jupyter.png|1000x1000px|Jupyter.png]]&lt;br /&gt;
&amp;lt;ol start=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a .ipynb file and choose the kernel (interpreter for the correct project environment) from the button that appears at the top right of the opened notebook&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Choose kernel.png|1000x1000px|Choose kernel.png]]&lt;br /&gt;
&amp;lt;ol start=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Happy coding!&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Support for RStudio (even remote!) within VSCode ==&lt;br /&gt;
&lt;br /&gt;
Install the R extension, which provides support for the&amp;amp;nbsp;[https://www.r-project.org/ R programming language], including features such as extended syntax highlighting, R language service based on code analysis, interacting with R terminals, viewing data, plots, workspace variables, help pages, managing packages, and working with&amp;amp;nbsp;[https://rmarkdown.rstudio.com/ R Markdown]&amp;amp;nbsp;documents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Miscellanea ==&lt;br /&gt;
&lt;br /&gt;
=== Amphetamine ===&lt;br /&gt;
&lt;br /&gt;
If you need your laptop to stay awake while there&#039;s a process running --- you are running some cell in a notebook via remote SSH --- check out this [[Amphetamine|article in the wiki]].&lt;br /&gt;
&lt;br /&gt;
=== Tunnelling ===&lt;br /&gt;
&lt;br /&gt;
Disclaimer: this is particularly useful for PSC (Pittsburgh Supercomuting Center) users, as it allows to connect directly to a compute node on PSC and have things like Jupyter Notebooks run via VSCode without problems. This solution bypasses a problem incurred when connecting via SSH from VSCode, which caused to land on the login nodes. These have very little memory and basically do not support any computation.&lt;br /&gt;
&lt;br /&gt;
Instructions for creating a VS code tunnel to PSC:&lt;br /&gt;
&lt;br /&gt;
*First set up code CLI on PSC: [https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg&amp;amp;nbsp;] &lt;br /&gt;
*Then run the following: &lt;br /&gt;
&amp;lt;pre&amp;gt;    curl -Lk &#039;https://code.visualstudio.com/sha/download?build=stable&amp;amp;os=cli-alpine-x64&#039; --output vscode_cli.tar.gz&lt;br /&gt;
    tar -xf vscode_cli.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;This will create a &amp;quot;code&amp;quot; executable file which we need to add to the path. Open &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt;&amp;amp;nbsp;(or &amp;lt;code&amp;gt;.zshrc&amp;amp;nbsp;&amp;lt;/code&amp;gt;if you have a recent Mac) and edit the line that exports the path to be&amp;amp;nbsp;your current directory. If need be, you can get the path to your current directory using the command  &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;export PATH=&amp;quot;&amp;lt;current directory&amp;gt;:$PATH&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Restart the shell and check that &amp;quot;which code&amp;quot; finds the installation. &lt;br /&gt;
*Next, install the remote tunnels and remote ssh extensions on VS code. &lt;br /&gt;
**These are found in the extensions menu &lt;br /&gt;
**After installation there should be a blue &amp;quot;open remote window&amp;quot; (&amp;gt;&amp;lt; symbol) in the bottom left of the VS code window. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Next, we set up the tunnel: [https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg&amp;amp;nbsp;] &lt;br /&gt;
**Start interactive job &lt;br /&gt;
**Run &amp;lt;code&amp;gt;code tunnel&amp;lt;/code&amp;gt;&amp;amp;nbsp;and follow the instructions. I recommend logging in via GitHub the first time and occasionally you will be asked to name the machine. By default it will name it based off of the node you are currently interacting with; however, the tunnel will connect to any node at PSC via the same setup so I recommend you name it something generic related to PSC. You will eventually see a message like “Open this link in your browser https://vscode.dev/tunnel/&amp;lt;machine name&amp;gt;” &lt;br /&gt;
**On VS Code on your local machine, click the blue &amp;quot;open remote window&amp;quot; (&amp;gt;&amp;lt; symbol) in the bottom left and select Connect to Tunnel. &lt;br /&gt;
**Select GitHub and then the machine that matches &amp;lt;machine name&amp;gt; in the link shown on the remote location. This should reload your VS code window to be running on the remote server, but if you started an interactive job it is running on a compute node. &lt;br /&gt;
**To stop the connection, run &amp;quot;ctrl + c&amp;quot; &lt;br /&gt;
**If you need to deregister the tunnel run &amp;quot;code tunnel unregister&amp;quot; however, this should be unnecessary &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For any future connection you run this same set of steps, as&amp;amp;nbsp;I haven&#039;t found a way to avoid re logging in via github every time.&lt;/div&gt;</summary>
		<author><name>Ebensen</name></author>
	</entry>
	<entry>
		<id>https://info.stat.cmu.edu/index.php?title=VSCode&amp;diff=144</id>
		<title>VSCode</title>
		<link rel="alternate" type="text/html" href="https://info.stat.cmu.edu/index.php?title=VSCode&amp;diff=144"/>
		<updated>2024-09-11T19:23:41Z</updated>

		<summary type="html">&lt;p&gt;Ebensen: Changed the tunnelling path description to mention it is only for Bridges 2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
VSCode is an open-source IDE maintained by Microsoft, and it is considered a “lightweight” code editor. In comparison with full integrated development environment (IDE) editors which occupy gigabytes of disk space, VS Code uses less than 200MB when installed. Despite the “lightweight” term, Visual Studio Code offers a massive number of features (via so-called “extensions”) which keep increasing and improving with every new update.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Resources:&lt;br /&gt;
&lt;br /&gt;
#[https://code.visualstudio.com/docs Official documentation] &lt;br /&gt;
#[https://code.visualstudio.com/download Download] &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Basic Usage ==&lt;br /&gt;
&lt;br /&gt;
Some good extensions:&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
#Python (and Pylance) &lt;br /&gt;
#Jupyter &lt;br /&gt;
#R &lt;br /&gt;
#LaTeX Workshop &lt;br /&gt;
#Remote - SSH &lt;br /&gt;
#autoDocstring &lt;br /&gt;
&lt;br /&gt;
== Remote Development and Prototyping via SSH ==&lt;br /&gt;
&lt;br /&gt;
In this section we will learn how to use VSCode to manage, develop, and test code that we have stored on a remote server (like [https://www.stat.cmu.edu/computewiki/index.php/Linux_and_department_servers Hydras], [https://www.stat.cmu.edu/computewiki/index.php/Azure_getting_started Azure], etc...).&lt;br /&gt;
&lt;br /&gt;
This is particularly useful to &amp;lt;u&amp;gt;avoid&amp;lt;/u&amp;gt; painful workflows that see us doing the following:&lt;br /&gt;
&lt;br /&gt;
#develop locally on our laptop &lt;br /&gt;
#&amp;lt;font face=&amp;quot;monospace&amp;quot;&amp;gt;scp&amp;lt;/font&amp;gt; some scripts to the remote server and run them (assuming we have consistent environments) &lt;br /&gt;
#&amp;lt;font face=&amp;quot;monospace&amp;quot;&amp;gt;scp&amp;amp;nbsp;&amp;lt;/font&amp;gt;the results to the local laptop &lt;br /&gt;
#repeat from 1 &lt;br /&gt;
&lt;br /&gt;
Ideally, we want to be able to use the remote server only as the computational workhorse, while leveraging the GUI of our local operative system. Doing this in VSCode is extremely simple:&lt;br /&gt;
&lt;br /&gt;
#In the left toolbar, click on the “Extensions” button and search for SSH. The correct one is hte one developed by Microsoft (blue icon). Click on the install button.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssh.png|1000x1000px|RTENOTITLE]] &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once the extension is installed, click on the small green button at the very bottom-left of the window (the one with a symbol similar to &amp;gt;&amp;lt;). A pop-up window at the top will open: click on “Connect to Host”&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;At this point, we have two alternatives: &lt;br /&gt;
#&amp;amp;nbsp;add a new SSH host manually, which will prompt another small window where to enter the connection details (similar to what one does from the terminal) &lt;br /&gt;
#or&amp;amp;nbsp;&#039;&#039;&#039;&amp;lt;u&amp;gt;better&amp;lt;/u&amp;gt;&#039;&#039;&#039;, if we have a SSH&amp;amp;nbsp;&amp;lt;code&amp;gt;config&amp;amp;nbsp;&amp;lt;/code&amp;gt;file in the &amp;lt;code&amp;gt;.ssh&amp;amp;nbsp;&amp;lt;/code&amp;gt;directory, VSCode will automatically list the possible remote servers that are specified in this file. If we specified a path to a key, then VSCode will connect automatically. If instead the remote server requires a password (as it is the case for Hydras), then we will be prompted with another window to enter it. As an example:&lt;br /&gt;
[[File:Hosts.png|RTENOTITLE]]&lt;br /&gt;
&amp;amp;nbsp;[[File:Ssh config.png|RTENOTITLE]] &lt;br /&gt;
&amp;lt;ol start=&amp;quot;4&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Congratulations! You are now connected to a remote server through VSCode. By clicking on the “Explorer”&amp;amp;nbsp;button at the top in the left-side toolbar, you can navigate the file system of the server, develop and run code, etc. Everything you do and see is actually being hosted, run, and saved remotely.&amp;amp;nbsp;&lt;br /&gt;
[[File:Remote file.png|1000x1000px|RTENOTITLE]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Managing environments within VSCode ==&lt;br /&gt;
&lt;br /&gt;
Since each project might (and should) have its own development environment that you setup, with dependencies and packages that make it unique for the tasks of this project, VSCode allows to easily choose which interpreter&amp;amp;nbsp;to use.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
We simply have to click at the bottom right&amp;amp;nbsp;of the window, on the button that shows the current Python (or other language) version that we are using. This will open a prompt to choose the environment among those present on the&amp;amp;nbsp;machine we are developing on:&lt;br /&gt;
&lt;br /&gt;
[[File:Env.png|1000x1000px|Env.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Support for Jupyter Notebooks (even remote!) within VSCode ==&lt;br /&gt;
&lt;br /&gt;
In one of the previous section we learned how to setup VSCode for remote development. A great feature of the workflow that we have just enabled is that we can run Jupyter Notebooks (and produce plots, tables, etc...) that are hosted remotely while seeing the output on our local laptop within VSCode (this works also if we are running things locally). Doing so is very easy:&lt;br /&gt;
&lt;br /&gt;
#Click on the “Extensions” button on the left toolbar and download the Jupyter&amp;amp;nbsp;extension &lt;br /&gt;
&lt;br /&gt;
[[File:Jupyter.png|1000x1000px|Jupyter.png]]&lt;br /&gt;
&amp;lt;ol start=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open a .ipynb file and choose the kernel (interpreter for the correct project environment) from the button that appears at the top right of the opened notebook&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Choose kernel.png|1000x1000px|Choose kernel.png]]&lt;br /&gt;
&amp;lt;ol start=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Happy coding!&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Support for RStudio (even remote!) within VSCode ==&lt;br /&gt;
&lt;br /&gt;
Install the R extension, which provides support for the&amp;amp;nbsp;[https://www.r-project.org/ R programming language], including features such as extended syntax highlighting, R language service based on code analysis, interacting with R terminals, viewing data, plots, workspace variables, help pages, managing packages, and working with&amp;amp;nbsp;[https://rmarkdown.rstudio.com/ R Markdown]&amp;amp;nbsp;documents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Miscellanea ==&lt;br /&gt;
&lt;br /&gt;
=== Amphetamine ===&lt;br /&gt;
&lt;br /&gt;
If you need your laptop to stay awake while there&#039;s a process running --- you are running some cell in a notebook via remote SSH --- check out this [[Amphetamine|article in the wiki]].&lt;br /&gt;
&lt;br /&gt;
=== Tunnelling ===&lt;br /&gt;
&lt;br /&gt;
Disclaimer: this is particularly useful for PSC (Pittsburgh Supercomuting Center) users, as it allows to connect directly to a compute node on PSC and have things like Jupyter Notebooks run via VSCode without problems. This solution bypasses a problem incurred when connecting via SSH from VSCode, which caused to land on the login nodes. These have very little memory and basically do not support any computation.&lt;br /&gt;
&lt;br /&gt;
Instructions for creating a VS code tunnel to PSC:&lt;br /&gt;
&lt;br /&gt;
*First set up code CLI on PSC: [https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg&amp;amp;nbsp;] &lt;br /&gt;
*Then run the following: &lt;br /&gt;
&amp;lt;pre&amp;gt;    curl -Lk &#039;https://code.visualstudio.com/sha/download?build=stable&amp;amp;os=cli-alpine-x64&#039; --output vscode_cli.tar.gz&lt;br /&gt;
    tar -xf vscode_cli.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;This will create a &amp;quot;code&amp;quot; executable file which we need to add to the path. Open &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt;&amp;amp;nbsp;(or &amp;lt;code&amp;gt;.zshrc&amp;amp;nbsp;&amp;lt;/code&amp;gt;if you have a recent Mac) and edit the line that exports the path to be&amp;amp;nbsp;your current directory. For example on the Bridges 2 supercomputer.&lt;br /&gt;
&amp;lt;pre&amp;gt;export PATH=&amp;quot;/jet/home/&amp;lt;username&amp;gt;:$PATH&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Restart the shell and check that &amp;quot;which code&amp;quot; finds the installation. &lt;br /&gt;
*Next, install the remote tunnels and remote ssh extensions on VS code. &lt;br /&gt;
**These are found in the extensions menu &lt;br /&gt;
**After installation there should be a blue &amp;quot;open remote window&amp;quot; (&amp;gt;&amp;lt; symbol) in the bottom left of the VS code window. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Next, we set up the tunnel: [https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg https://dev.to/burkeholland/introducing-vs-code-remote-tunnels-connect-to-remote-machines-with-ease-3nlg&amp;amp;nbsp;] &lt;br /&gt;
**Start interactive job &lt;br /&gt;
**Run &amp;lt;code&amp;gt;code tunnel&amp;lt;/code&amp;gt;&amp;amp;nbsp;and follow the instructions. I recommend logging in via GitHub the first time and occasionally you will be asked to name the machine. By default it will name it based off of the node you are currently interacting with; however, the tunnel will connect to any node at PSC via the same setup so I recommend you name it something generic related to PSC. You will eventually see a message like “Open this link in your browser https://vscode.dev/tunnel/&amp;lt;machine name&amp;gt;” &lt;br /&gt;
**On VS Code on your local machine, click the blue &amp;quot;open remote window&amp;quot; (&amp;gt;&amp;lt; symbol) in the bottom left and select Connect to Tunnel. &lt;br /&gt;
**Select GitHub and then the machine that matches &amp;lt;machine name&amp;gt; in the link shown on the remote location. This should reload your VS code window to be running on the remote server, but if you started an interactive job it is running on a compute node. &lt;br /&gt;
**To stop the connection, run &amp;quot;ctrl + c&amp;quot; &lt;br /&gt;
**If you need to deregister the tunnel run &amp;quot;code tunnel unregister&amp;quot; however, this should be unnecessary &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For any future connection you run this same set of steps, as&amp;amp;nbsp;I haven&#039;t found a way to avoid re logging in via github every time.&lt;/div&gt;</summary>
		<author><name>Ebensen</name></author>
	</entry>
</feed>