CU Denver Computer Science: How to Access to CSEGRID on Linux and manage, run, and compile files
As a new computer science graduate student with a non-computer science background, I find myself having to play catch-up with simple odds and ends here at CU Denver. One of these odds, is utilizing the CSEGRID, which is the linux server-based cluster here at the CU Denver main campus.
Having graded coding assignments before, I have to say this is smart on the part of the graders - there is no arguing whether or not a program will execute if everyone is expected to compile and run on the same system. That being said, as a "newbie" coming in, I have had to play a bit of catch-up here - which is the purpose of this post - to give myself, and maybe even others, a quick-start guide for getting up and running with CSEGRID and linux. Though the process is well-documented for Windows, MacOS, and even iOS and Android, the documentation for linux is lacking, which is surprising considering the server itself is linux based, but I digress. Let's get started.
This step assumes you are on the 'CU Denver' wifi (not guest). If you are not, skip down to the end to add the VPN you'll need.
Before you can go ahead and really do much of anything, you're going to need to install PuTTY which allows you to SSH (secure socket shell) so that you can remotely access the server through the terminal. Open the terminal (handy shortcut is Ctrl + Alt + T) and type:
sudo apt install putty
Follow the prompts to install.
Running PuTTY is pretty simple, just type the following command into the terminal:
and the PuTTY console will launch. Enter the following Host Name into the appropriate field and click the 'Open' button.
This will launch a new terminal window. You many be prompted to accept a certificate and then to sign in. You'll sign in using your CU Denver username and password. Two things about your password - remember it is case sensitive, and even though you're typing the terminal won't display your password for security reasons, so just type it in and hit 'Enter'.
Now you're signed in, let's briefly discuss where your files are stored, and how to copy files from your local machine to the server using the terminal.
MANAGING FILES ON THE CSEGRID AND COPYING FROM LOCAL MACHINE
Now we need to understand where our files can be kept, and how to move them around and generally manage them so we don't end up with a disorganized mess. Almost all your programming-based classes will ask you to use CSEGRID and so it's easier to start out with an organization scheme than to clean up your mess later.
Your working directory is under:
To change your current directory to your working directory, type:
and you will see that your path on the left side of the terminal changes. This is the directory that you, and only you (and admin) have access to. I'm not going to go into detail here about how to use command line in Linux, but here are some commands you should become familiar with:
ls - list of items/files/folders in this current directory
cd - change directory
rm - remove file (use -r flag for removing a folder and its contents)
mv - move file (use -r flag for moving a folder and its contents)
cp - copy a file (use -r flag for copying a folder and its contents)
pwd - print working directory, where you are in file system currently
One command that isn't very common, but very helpful in this instance, is the secure copy command, that takes the following syntax on your LOCAL TERMINAL:
scp /path/to/local/file username@system:/path/to/remotedestination
scp username@system:/path/to/remotedestination /path/to/local/file
This can be used to copy a file from your local machine in your local terminal (not the SSH one) to your server folder. If you want to perform these commands from your remote terminal, simply switch the destinations around, recalling that your username@system will also change.
When done in your local terminal, your username@system will NOT be whatever you see showing up in your remote terminal on the left side, it will instead be:
Now that you know how to put your files on to the CSEGRID, let's briefly review the commands for compiling and running.
RUN AND COMPILING C++ CODE USING G++ ON THE CSEGRID
Once you have navigated to your working directory, you can compile your file in one of two ways. G++ is the compiler that is already installed on CSEGRID.
If you have a makefile for your C++ files and they are all in the same directory together, you can use:
If you don't have a makefile you can type:
g++ -std=c++11 filename.cpp -o targetName
Then, regardless of which way you compiled it, you can run your program with:
CISCO ANYCONNECT VPN
If you aren't on campus or aren't on the 'CU Denver' wifi, you're going to need to add the CU Denver VPN in order to connect. This step is rather simple, and once you get it set up, it's as simple as toggling it on/off. First we will install a couple libraries, then the Cisco-compatible OpenConnect VPN
client that CU Denver recommends. Open the terminal and type the following:
sudo apt-get install lib32z1 lib32ncurses5
sudo apt-get install openconnect
Once successfully installed, navigate to your system settings GUI for Ubuntu and search 'VPN', then click the 'Network' settings in the search result. Open the settings for the new OpenConnect VPN you've created, and add a name of your choice - I chose 'CUDenver'. In the Gateway text input, enter:
Save your settings and exit the setup window. Turn your VPN on, you will be prompted to accept a certificate and sign in using your CU Denver username and password. Give it a few moments and you should be connected!