The Research Computing User's Guide

September 23, 2022

Jason W. Bacon

Senior Systems Programmer, Instructor
University of Wisconsin -- Milwaukee
Research Computing Support

Table of Contents

I. Research Computing
1. Computational Science
2. Where do I get the Software?
3. Using Unix
4. Unix Shell Scripting
5. Data Management
II. Parallel Computing
6. Parallel Computing Overview
7. Job Scheduling
8. Job Scheduling with SLURM
9. Job Scheduling with HTCondor
10. Job Scheduling with PBS (TORQUE)
11. Job Scheduling with LSF
III. High Performance Programming
12. Software Development
13. Data Representation
14. Computer Hardware
15. Introduction to Programming
16. Data Types
17. Basic Terminal Input/Output (I/O)
18. Conditional Execution
19. Loops (Iterative Execution)
20. Subprograms
21. Memory Addresses and Pointers
22. Arrays
23. Strings
24. File I/O
25. Matrices
26. Software Performance
27. Structures
28. The Preprocessor
29. Software Project Management
IV. Parallel Programming
30. Parallel Programming
31. Programming for HTC
32. Programming for HPC
V. Systems Management
33. Systems Management
34. Platform Selection
35. System Security
36. Software Management
37. Running Multiple Operating Systems

List of Figures

2.1. FreeBSD Ports Build Options
2.2. Visualizing Gene Neighborhoods with Matplotlib
3.1. Hot Keys
3.2. Sample of a Unix File system
13.1. Monte Carlo Dart Board
37.1. Windows as a Guest under VirtualBox on a Mac Host
37.2. CentOS 7 with Gnome Desktop as a Guest under VirtualBox
37.3. FreeBSD with Lumina Dekstop as a Guest under VirtualBox

List of Tables

1.1. Computation Time Line
3.1. Partial List of Unix Operating Systems
3.2. Pkgsrc Build Times
3.3. Default Key Bindings in some Shells
3.4. Globbing Symbols
3.5. Special Directory Symbols
3.6. Common hot keys in more
3.7. Unix Commands
3.8. Common Extensions
3.9. Reserved Environment Variables
3.10. Standard Streams
3.11. Redirection Operators
3.12. Pipe Operators
3.13. Run times of pipes with cat
4.1. Conventional script file name extensions
4.2. Shell Start Up Scripts
4.3. Printf Format Specifiers
4.4. Special Character Sequences
4.5. Test Command Relational Operators
4.6. Test command file operations
4.7. C Shell Relational Operators
4.8. Shell Conditional Operators
4.9. Common Regular Expression Symbols
12.1. Example MIPS Instruction
12.2. Selection Sort of 200,000 Integers
13.1. Basic Binary Units
13.2. Prefixes for larger quantities
13.4. Highest power of each base <= 439
13.5. Binary/Octal Conversion
13.6. Binary/Hex Conversion
13.7. Unsigned Binary Integer Ranges
13.8. Powers of 2
13.9. Powers of 2
13.10. 8-bit sign-magnitude format
13.11. Two's Complement Integer Ranges
13.12. IEEE 32-bit Format
13.13. IEEE 64-bit Format
14.1. Example Memory Map
16.1. C Data Types
16.2. Fortran 90 Data Types
16.3. Memory Map
16.4. C Constants and Types
16.5. C Escape Sequences
16.6. Fortran 90 Constants and Types
16.7. C Operators
16.8. Fortran Operators
16.9. Explicit Conversion Functions
17.1. Standard Stream Names
17.2. Placeholders for printf
17.3. Placeholders for printf
17.4. Standard Stream Names
17.5. Common Format Descriptors
18.1. Relational Expressions
18.2. Fortran Relational Operators
18.3. Boolean Operators
20.1. Program Sizes
20.2. Pass by Value
20.3. Pass by Reference
22.1. Memory Map of an Array
22.2. Memory Map of list and i
25.1. Time Table
25.2. Temperature
25.3. Generic 2D Matrix
26.1. Common Orders of Operation
36.1. Computation Time Line
36.2. Package Manager Comparison

List of Examples

2.1. A Typical Caveman Install
3.1. White space in an Argument
3.2. Pushing data with rsync
3.3. Pulling data with rsync
3.4. Simple Pipe
3.5. Filters
4.1. A Simple Bash Script
4.2. A Simple T-shell Script
4.3. Multiple File Downloads
11.1. Simple LSF Batch Script
11.2. Batch Interactive Script
11.3. Batch Parallel Script
11.4. LSF and OpenMPI
13.1. A fixed-point system
13.2. A modulo-100 System
13.3. Conversion from Decimal
13.4. 3710 to binary
13.5. 13510 to octal
13.6. 13510 to hex
13.7. A 4-bit unsigned binary number system
13.8. Improving Speed with Integers
15.1. A Simple C Program
15.2. A Simple Fortran Program
16.1. Precedence and Order of Evaluation
19.1. Do-while Loop
19.2. A More Flexible Sine Printer
19.3. Predicting Loop Output
19.4. Unstructured Loop
19.5. Infinite Loop
20.1. Ordering Pizza
20.2. Sorting
20.3. Sample C Code Passing by Value
25.1. Comparison of Row-major and Col-major Access
26.1. Selection Sort
26.2. Binary Search

1. Policies, Practices and Expectations

1.1. Taking Notes in Class

Everyone should take pencil and paper notes during lectures rather than rely on online materials. Write more detail about the topics you don't already know about. For things you do know, jot down the topic so you know that it was covered, but don't write down details. This way your notes will serve as a checklist to prepare for quizzes and exams. Review these notes first to ensure there are no major gaps in your knowledge. If you run short on time, you'll still be reasonably well prepared. Then review other materials to improve your knowledge further.

The act of writing or explaining something has a powerful effect on memory and understanding. Writing something once does as much for your memory and understanding as reading it ten times. Don't sit back and be passive about your education. That strategy will backfire. You'll learn much more with less effort by taking action.

1.2. Run the Whole Race

Make sure you get off to a good start so the rest of the semester won't be a struggle to catch up.

If you do have a good start, don't fall victim to the common tendency to think you can coast for a while. Some topics will be harder for you than the ones you just aced. What's hard varies from student to student, so pay no attention to what others are saying about it.

In any case, don't stress about your past or future performance. Just be thorough about studying every topic throughout the semester, regardless of how you've done on previous topics. If you just do that, you'll do well overall.

1.3. About Quality

Everybody wants a quality product, but what's the real motivation for creating them? Why should we write fast, reliable programs? Why design fast, reliable hardware? So the boss will give us a raise? Probably not. Most bosses wouldn't recognize quality work if it licked their face. So we'll be admired by our peers? No, doesn't really work. Most of them will just be jealous.

Think about how often you've wasted time waiting for something that seems inexplicably slow, or worse, breaks down so you have to start over. As a result, you missed happy hour, you kid's soccer game, or something else you were really looking forward to. Low quality products cause massive amounts of wasted time and aggravation. The best reason to do quality work is to help everybody (including yourself) get their work done quickly, so we can spend more time at the beach. Quality work makes everybody's lives better. This is how you will have a positive impact and garner real appreciation as an engineer.

So how to we get there? Some would say "take pride in your work". But this often backfires, because it depends on what makes an engineer proud proud. Many engineers are proud of how clever they are. While a normal person would say "If it ain't broke, don't fix it.", many engineers say "If it ain't broke, it doesn't have enough features yet.". A clever engineer makes things needlessly complicated to prove that they're more clever than you are. A wise engineer makes things as simple as possible so they will be reliable, inexpensive, and easy to use. Remember this simple equation:

cleverness * wisdom = constant

Also remember to KISS (Keep It Simple, Stupid). If you do, you'll be a top-notch engineer.

1.4. Homework, quiz, and exam format

Most questions are short answer or diagram format rather than true/false or multiple choice. The act of explaining a concept goes a long way toward helping you remember and understand it, so writing out the answer in your own words is a far better learning experience than picking the answer out of a list.

In fact, you can help yourself understand the material better by explaining it to your mom, your cat, or anyone else with the patience to listen to nerdy ramblings about computer science. Best not to try this on your girlfriend/boyfriend if you want to keep them around.

Also, the real world is not multiple choice. Good luck finding a job where your boss solves all the problems and presents you with the solution alongside several incorrect ones. The real world is open book, but it also has time limits, so you do not want to rely on references entirely. You need some knowledge internalized in order to be productive. The goal here is to practice for that scenario.

1.5. Extra Credit Sweepstakes

To encourage students to read all materials with a critical eye, the first student to correctly identify each factual error in these lecture notes will receive 2 extra credit points toward their final grade. The first to report a minor typographic error will receive 1 point. Errors must be reported to the instructor via email to receive extra credit. Individual students are limited to a maximum of 15 points per semester.