Computer Systems Organization
All labs' git classroom invitation links can be found on Campuswire
Collaboration and Integrity Policy
Please read this carefully. We will run plagiarism detection software on all submitted code.
Acknowledgements:
Lab 5 and 6 are due to Berkeley's CS61c.
Lab Setup Instructions
You will be doing labs on the Courant's compute servers
You should have received an email from CIMS Systems Support w.r.t. your account.
You may visit this link to view the status of your account and to rest your password if needed.
Set up Git repository
FAQs on gits
Log into CIMS servers from your laptop
Windows laptop:
You should use the Chrome secure shell extension to log into Courant servers.
Make sure you have Google Chrome browser installed.
Download and install Chrome secure shell extension
Launch Chrome, then open the extension by clicking the extension icon, followed by clicking "Connection Dialog".
You should do the labs on Courant's Compute Server called snappy1.cims.nyu.edu. To log in snappy1, you must go through a gateway host called access.cims.nyu.edu first by filling in the following information after opening the secure shell extension. Note: Substitute your-cims-username with your Courant computer account username.
After you have logged into access.cims.nyu.edu. Type in the following command to log into snappy1.cims.nyu.edu
access$ ssh snappy1
Mac Laptop:
You can use the native Mac terminal to log into Courant servers.
Launch a Mac terminal
Log into the Courant gateway host by typing the command $ ssh access.cims.nyu.edu
Continue on logging into snappy1 by typing
access$ ssh snappy1
Using commandline
Once you've logged into snappy1, you'll need to use UNIX commands to navigate the file systems, launch programs, editors and so forth. Getting familiar with the UNIX commandline is an indispencible skill for any CS student. You can learn more about command line here. You may also find this one-page cheatcheet handy.
Setting up Git Repository
For each student in the class, we have created for him/her a corresponding private lab repository on Github.com. You will submit labs by pushing to your private repo on github.com (as many times as you want) and then submitting them via Gradescope.
Below are the steps for setting up your the lab environment on snappy1. If you are not familiar with the git version control system, follow the resources here to get started.
Preparation: set up ssh-based logins to github. This is needed as github no longer accepts password-based commandlines.
- On snappy1, generate a pair of ssh keys by typing:
snappy1$ ssh-keygen
Hit [Enter] a couple of times until you see that the keys have been saved in the files, like the example below
- Display the contents of the public key portion of the key pair by typing the following. You'll need to copy-n-paste this content to github website
snappy1$ cat ~/.ssh/id_rsa.pub
- Enter public key information in github. To do so, use the browser on your laptop to log into github website. Click the icon on the top right corner to pull down a menu, then click "Settings". On the settings page, click "SSH and GPG keys" on the left-side menu, then click the green button named "New SSH key". Type snappy1 in the textbox named "Title". Copy-n-paste the content of your previously generated public key to the textbox named "Key". Then, click "Add SSH key".
Cloning your lab repo on snappy1
snappy1$ mkdir cso-labs
snappy1$ cd cso-labs snappy1$ git clone git@github.com:nyu-cso-fa22/clab-part1-<YourGithubUsername>.git clab-part1
You will see that a directory named lab1 has been created under the cso-labs directory. This is the git repo for your lab assignment 1. Other labs can be created similarly by cloning respective repositories.
Using a command line editor to modify files for your lab assignments.
We recommend using nano. For example, if you want to change file array.c, type the following:
snappy1$ cd cso-labs/clab-part1 snappy1$ nano array.c
Saving changes to Github while you are working on Labs
As you modify the skeleton files to complete the labs, you should frequently save your work to protect against laptop failures and other unforeseen troubles. You save the changes by first "committing" them to your local lab repo and then "pushing" those changes to the repo stored on github.com
$ git commit -am "saving my changes" $ git push origin masterNote that whenever you add a new file, you need to manually tell git to ``track it''. Otherwise, the file will not be committed by git commit. Make git track a new file by typing:
$ git add <my-new-file>
After you've pushed your changes by typing git push origin master, they are safely stored on github.com. Even if your laptop catches on fire in the future, those pushed changes can still be retrieved. However, you must remember that doing git commit by itself does not save your changes on github.com (it only saves your changes locally). So, don't forget to type git push origin master.
To see if your local repo is up-to-date with your origin repo on github.com and vice versa, type git status
FAQs on Git repository
- What message should I fill in for git commit -am "message"
The "message" can be any string. But we ask you to leave something descriptive as message. In the future, when you check your git logs, this message helps you recall what you did for this commit. We (CSO staff) will never read your commit message. It's not going to affect grading.
- How can I change a message if it's already pushed to GitHub?
You don't need to change a message. There are ways to change messages but for CSO you never need them. Don't do it. It's going to cause conflict. Super dangerous.
- I got an error message Fatal: Not a git repository (or any of the parent directories).
This means you are typing git commands outside the directory containing your git repository. You need to type cd recitations-XXX, where XXX is your GitHub username. Remember to always type most git commands inside git repository. Commands like git clone, git config --global can be issued anywhere.
- Can I edit files through GitHub.com?
No. You should never do that. That's very likely to cause conflicts. Super dangerous. Please only use GitHub.com for read-only access, i.e. checking if all your changes have been pushed to your remote repository.
- When I do git pull, I got an error Repository not found. Check the repository address, there should be no quotes (") or angle brackets (< >). The lab instructions use quotes or angle brackets to mark a placeholder for your GitHub username. If git pull upstream master fails, then check upstream address by typing git remote -v To edit your upstream address, remove it first by typing git remote remove upstream, and then add it back with git remote add
Handin Procedure
You must do both of the following steps:-
First, commit and push all your code changes to github.com by doing:
$ git commit -am "finish lab" $ git push origin master
-
Next, submit your lab via Gradescope. Log into Gradescope using your NYU email (the email containing your NYU id, or find Gradescope via Brightspace). Follow the instructions to submit your lab. You can either submit via github (by linking your github account with gradescope). Alternatively, you can explicitly submit the lab files as a zip file. You can make the zip file for submission as follows:
$ make submitfiles
And upload the file submitfiles.zip to Gradescope assignment's submission page. The above command produces submitfiles.zip which you can upload for Gradescope assignment submission.