CS代写 CMPUT 379 Lab Seminars (1)

CMPUT 379 Lab Seminars (1)
1. Welcomeandintroductions
2. CSLinuxlabcomputers
3. Remote access to lab computers

Copyright By PowCoder代写 加微信 powcoder

4. Transferring files to/from lab computers
5. Unix man pages
6. Texteditors
7. Unix𝑚𝑎𝑘𝑒program
CMPUT 379 (E.S. Elmallah)

1. Welcome and Introductions
❑ Welcome to CMPUT 379 series of lab seminars.
Lab sessions are mainly about
o Sharing information on topics relevant to the lab environment and the assignments
o Clarifying assignment issues and helping with problems
❑About the TAs
CMPUT 379 (E.S. Elmallah)

2. CS Linux Lab Computers
❑ Assignments will be graded on lab computers.
o So, make sure your programs compile and run on any
of these machines
❑ Available lab computers in the CSC building: o CSC105: ub01 – ub08 (e.g., ub01.cs.ualberta.ca)
o CSC121: uc01 – uc16
o CSC125: ud00 – ud26
o CSC129: ue00 – ue26 o CSC153: uf00 – uf25 o CSC159: ug00 – ug34 o CSC219: ui00 – ui22
CMPUT 379 (E.S. Elmallah)

❑ Note: it is a good idea not to use “ohaton.cs.ualberta.ca” (a server for all undergraduate courses) for solving your assignments, instead use one of the lab machines.
CMPUT 379 (E.S. Elmallah)

3. Remote Access to Lab Computers
❑SSH is a connectivity tool that allows one to login to a remote server using the secure shell (SSH) protocol.
❑SSH clients are available under different platforms. Examples include:
o Windows: Putty, MobaXterm, X2Go • https://www.putty.org/
• https://mobaxterm.mobatek.net/
o MacOS: the ssh client is installed by default
o Linux: the ssh tool is part of the openSSH package
CMPUT 379 (E.S. Elmallah)

❑The Putty Program
CMPUT 379 (E.S. Elmallah)

❑ MobaXterm Toolbox
o MobaXterm is a commercial product that appears to
offer a free home edition for users.
o Refer to the seller’s web page for built-in features of this toolbox for remote computing.
• https://mobaxterm.mobatek.net/
CMPUT 379 (E.S. Elmallah)

❑ X2Go Client Program
o X2Go is an open source remote desktop tool to mainly access Linux computers. It is essentially a wrapper for X sessions, and is more suited for lower-bandwidth connections.
• https://wiki.x2go.org/doku.php/start
o In Computing Science, it allows you to remotely access the
graphical desktop of a CS Linux machine.
• (For work that can be done completely on the
command line, you do not need X2Go.)
CMPUT 379 (E.S. Elmallah)

CMPUT 379 (E.S. Elmallah)

o Installation: clients are available to connect from Mac OS X, Windows, and Linux.
• Getting X2Go
• Installing X2Go
o Setup: When creating a new session, certain fields in the Session tab are important.
• Session name: enter a descriptive name
• Host: use any of the CS linux lab machines (e.g.,
𝑢𝑖01. 𝑐𝑠. 𝑢𝑎𝑙𝑏𝑒𝑟𝑡𝑎. 𝑐𝑎)
• Login: use your CCID
• Session type: choose XFCE
• You may wish to adjust your display size in the
Input/Output tab
CMPUT 379 (E.S. Elmallah)

o After the session preferences are set up, click the round-rectangular card for the session at the top right, and login as usual.
CMPUT 379 (E.S. Elmallah)

o After the connection, the desktop should appear.
CMPUT 379 (E.S. Elmallah)

o When done, remember to log out. Please avoid leaving sessions hanging.
• The clock button is for terminating a session:
o Note that you are using shared resources. With potentially many users connecting, please be considerate and try not to be wasteful. Focus on what you need the desktop to do.
CMPUT 379 (E.S. Elmallah)

❑The SSH command line o Example Usage:
“% 𝑠𝑠h − 𝑌𝑙 𝑢𝑠𝑒𝑟𝑛𝑎𝑚𝑒 h𝑜𝑠𝑡𝑛𝑎𝑚𝑒 [−𝑝 𝑝𝑜𝑟𝑡𝑛𝑢𝑚𝑏𝑒𝑟]” • 𝑝𝑜𝑟𝑡𝑛𝑢𝑚 defaults to 22
• The command may be used to login to a remote lab machinenamedh𝑜𝑠𝑡𝑛𝑎𝑚𝑒 (e.g.,ub01.cs.ualberta.ca)
o After entering your password, you will interact with the lab machine using your configured shell program (typically, either 𝐶𝑆𝐻 or 𝐵𝐴𝑆𝐻).
o At the end of your SSH session type “% 𝑒𝑥𝑖𝑡“ to exit the shell and close the session.
CMPUT 379 (E.S. Elmallah)

4. Transferring files to/from lab machines
❑scp (secure copy) allows you copy files across a network.
❑ scp clients are available under different platforms. Examples include:
o Windows: WinSCP
• https://winscp.net
o MacOS: scp tool is part of the default installation
o Linux: scp is part of the openSSH package, nautilus
❑Other file transfer programs: File MPUT 379 (E.S. Elmallah)

❑Example usage (uploading a file):
o “% scp localfile
• Upload 𝑙𝑜𝑐𝑎𝑙𝑓𝑖𝑙𝑒 to your CSID account on remote machine 𝑢𝑐01. 𝑐𝑠. 𝑢𝑎𝑙𝑏𝑒𝑟𝑡𝑎. 𝑐𝑎 at the location determined by 𝑝𝑎𝑡h
• Use “% scp –r …” to recursively transfer a directory (or multiple files).
❑Example usage (downloading a file):
o “% scp localfile”
• Download a remote file from you CSID account to your desktop/laptop
• Use “% scp –r …” to recursively transfer a directory (or multiple files).
CMPUT 379 (E.S. Elmallah)

5. Unix Manual Pages
❑A typical UNIX environment provides on-line documentation to dozens of different system commands and system calls through the “man” command.
o The man command itself formats the specified manual documents and displays them.
CMPUT 379 (E.S. Elmallah)

❑ On lab machines, manual pages are divided among the sections shown below
o Use “% man man” to get more information about the man program
CMPUT 379 (E.S. Elmallah)

❑ So, e.g.,
o “% man 1 write” gives information about the Linux
write command, and
o “% man 2 write” gives information about the write system call.
❑ “% man –k
o Searches the short description field of all manual pages for a match with (as a regular expression). Print out all matches
❑Suggested activity:
o What do you get by running “% man –k printf”?
CMPUT 379 (E.S. Elmallah)

6. Text Editors
❑ In a workflow where you remotely login to a lab machine and edit your program files and makefiles on the remote host, using a text based editor is a great convenience.
❑On lab machines the following text based editors are available:
o emacs-type editors: 𝑒𝑚𝑎𝑐𝑠 (run with “% emacs -nw”), and 𝑛𝑎𝑛𝑜
o vi-type editors: 𝑣𝑖 and 𝑣𝑖𝑚
❑ Text editors with GUIs are also available (e.g., 𝑔𝑒𝑑𝑖𝑡 and 𝑛𝑒𝑑𝑖𝑡), but their response time over an internet connection is expected to be slow.
CMPUT 379 (E.S. Elmallah)

7. Unix Make Program
❑ In The UNIX System book (by S.R. Bourne), the 𝑚𝑎𝑘𝑒 program is introduced as follows:
“When developing a multi-file program with more than one source or header file, keeping track of which files need to be recompiled following modifications can be error prone and tedious. The 𝑚𝑎𝑘𝑒 command is designed to relieve the user of this book-keeping activity and served to document the relationships between files.
𝑚𝑎𝑘𝑒 enables dependency information between files to be specified. When invoked, 𝑚𝑎𝑘𝑒 updates a 𝑡𝑟𝑎𝑔𝑒𝑡𝑓𝑖𝑙𝑒 if it depends on files that have been modified since the target was last modified, or if the
target does not exist.”
CMPUT 379 (E.S. Elmallah)

❑So, crafting a 𝑚𝑎𝑘𝑒𝑓𝑖𝑙𝑒 to compile a project or build a library requires a good understanding of the dependencies among source files.
❑Wikipedia has a page on the different rewrites of the make program and the new features and short cuts added to the system over many years.
❑Nowadays, some of the newer build automation tools generate 𝑚𝑎𝑘𝑒𝑓𝑖𝑙𝑒𝑠 to build targets in a project.
❑In the course, each assignment asks you to submit a 𝑚𝑎𝑘𝑒𝑓𝑖𝑙𝑒 for building your solution program (and perhaps other targets).
❑Note that understanding file and library dependencies required to write a correct 𝑚𝑎𝑘𝑒𝑓𝑖𝑙𝑒 is part of the learning process in the course.
CMPUT 379 (E.S. Elmallah)

❑Suggested activity:
o Examine the 𝑠𝑡𝑎𝑟𝑡𝑒𝑟. 𝑐 and 𝑠𝑡𝑎𝑟𝑡𝑒𝑟. 𝑐𝑐 files on the
course web page and the associated 𝑚𝑎𝑘𝑒𝑓𝑖𝑙𝑒𝑠.
CMPUT 379 (E.S. Elmallah)

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com