糖心vlog视频

Data @ Reed

Zebra: GPU for Powerful Computing

Zebra is Data@Reed's remote research computer to help you with projects that outgrow a laptop. It's equipped with two NVIDIA GeForce RTX 3090 GPUs each with 24 GB of memory, so it can handle larger or more resource intensive projects. You can connect to it remotely via the Reed network or with our VPN. 

It's good for things like training machine learning models, running large simulations, or processing images at scale. If your thesis or research project is stalling on slow runtimes or memory limits, Zebra might be the answer.

Request Access

To access Zebra, you will need an account. To get one, email data@reed.edu with the subject "Reed Zebra account request". Let us know what the project is, what type of scripts or software you'll be running, and an estimate of your resource needs. Memory and space are initially limited but can be bumped higher if needed.

Logging In

This will walk you through logging into the server and transferring a script so you can run it remotely. Then you use the same method to transfer the output back. 

If you have any questions, email data@reed.edu.

One-Time Setup

Install a VPN client for off campus use

You need to be on the Reed network or connected to Reed's VPN to reach the server. If you need to install the VPN, follow Reed's VPN setup guide. If you’re off campus, make sure you can connect to the VPN before continuing.

Install an SSH and SFTP client for Windows (if needed)

Windows 10 and 11 include SSH, but we recommend installing Git for Windows, which gives you Git Bash, a terminal where all the commands below work exactly as written. 

  1. Go to https://gitforwindows.org and click Download.
  2. Run the installer. The default options are fine — just click Next through everything.
  3. Once installed, search for "Git Bash" in your Start menu and open it. This is the terminal you'll use for all the commands below.

Note: Git Bash does not include rsync, which is described as an alternative in Part 3. Windows users should use SFTP unless they have WSL (Windows Subsystem for Linux) set up. Mac and Linux users can use either.

Logging In

Connect to the Reed Network or VPN

Before anything else, connect to the Reed network or VPN. You won't be able to reach the server without it.

SSH into the server

Open a terminal (or open Git Bash on Windows) and type the following command, replacing yourusername with the username you were given:

ssh yourusername@zebra.reed.edu

Press Enter. You'll be asked for a password, use the one included in your account email. Type that and press Enter (you won't see any characters appear as you type; that's normal).

Note: The first time you log in you'll be asked to change your password. Follow the prompts to set a new one.

When you see a new line with something like yourusername@zebra:~$, you're now good to go.

Transferring Files

To run your script on the server, you first need to copy it there. There are two ways to do this: SFTP, which opens an interactive session for moving files back and forth, and rsync, which copies files with a single command. Both need to be run from a terminal on your own computer, not the server. 

Important: SFTP and rsync must be run from your own computer, not from inside the server. So first, disconnect from the server by typing:

exit

You'll be back on your own machine. You can reconnect to the server again after transferring your file.

Alternate: You can also do this without exiting by opening another terminal window on your computer.

Navigate to where your script is on your computer

In Git Bash, use the cd command to go to the folder containing your file. For example, if your script is on your Desktop:

cd ~/Desktop

Note: Unlike the usual C:\Users\YourName\ that is used in Windows, you’ll be writing in Linux/Unix style, which is /c/Users/YourName/.

Copy your script to the server

You have two options on Mac or Linux: sftp or rsync. Default to sftp, but if you are copying large files or folders rsync is a better choice. 

On Windows you must use sftp. 

SFTP transfer: 

Start an SFTP (SSH file transfer protocol) session by typing:

sftp yourusername@zebra.reed.edu

Enter your password when prompted. Your prompt will change to sftp>, which means you're connected to the server but can still reach files on your own computer. 

Let’s say you’re trying to copy over myscript.R. You’ll run this command, but replace myscript.R and yourusername with your actual values:

put myscript.R

That will upload single files; to upload an entire folder you add a flag to the command: 

put -r myfolder

This copies the file into your home directory on the server. When you're done, type exit to leave SFTP. Once the transfer is done, SSH back into the server the same way you did in Step 4:

ssh yourusername@zebra.reed.edu

Alternate rsync: 

To copy myscript.R, run:

rsync -avP myscript.R yourusername@zebra.reed.edu:~/

The :~/ at the end means "copy it to your home directory on the server." The -avP flag keeps file details intact, lists what's being copied, and shows a progress bar. Enter your password when prompted.

To copy a whole folder, use the same command with the folder name:

rsync -avP myfolder yourusername@zebra.reed.edu:~/

Run your script 

Note: For anything that takes more than a few minutes, see Running a Session below so your script keeps running if you disconnect. 

Once your script is on the server, you can run it from the command line. If your script uses any input files, those also need to be on the server. A few packages are pre-installed, but you will likely need to install many of the packages your script requires.

Your output will print directly to the terminal and won’t immediately be visible the way things are in the graphical interface. If your script saves files (plots, CSVs, etc.), they'll be saved in your home directory on the server.If your script is an R script, you’ll use the Rscript command to run it as an R file. When you type Rscript myscript.R, it's the equivalent of opening RStudio and clicking Run, just without the graphical interface. Run your script with:

Rscript myscript.R

An equivalent for a Python script would be 

python myscript.py or python3 myscript.py

Transferring output back to your computer 

To copy a file from the server back to your computer, first exit the server again, then use the transfer method in reverse:

With SFTP:

sftp yourusername@zebra.reed.edu

Then, at the sftp> prompt:

get output.csv

This saves the file to whichever folder you were in on your computer when you started SFTP.

With rsync:

rsync -avP yourusername@zebra.reed.edu:~/output.csv ~/Desktop

Change ~/Desktop to wherever you'd like it to be on your local machine.

Running Your Script

Zebra is a shared resource, so please:

  • Email data@reed.edu if you need more than the default 32 cores or 64 GB of memory. Tell us what you're running and roughly how long it will take.
  • Run nvidia-smi before starting a GPU job to make sure no one else is using the GPU, and let us know before starting any GPU job you expect to run for more than a day.
  • Let us know if any job will run for more than a couple of days, so we know it's intentional.
  • Test on a small piece of your data before launching a full run.
  • Close tmux sessions you're no longer using, and delete files you no longer need.

If you have any questions, email data@reed.edu.


Run scripts inside a session

To keep things running if you disconnect from Zebra (by closing your laptop, losing Wi-Fi, or dropping off the VPN), you should run things inside a tmux session. 

After logging into Zebra, start a session and give the session a name that is informative to you (here, myjob):

tmux new -s myjob

Your terminal will clear and a green bar will appear at the bottom. You're now inside the session.

Run your script and save its output to a log file

Run your script as usual, but send its printed output to a log file so you can check on it later:

Rscript myscript.R > myscript.log 2>&1

For Python, add -u so output is written to the log right away instead of in delayed chunks:

python -u myscript.py > myscript.log 2>&1

The > myscript.log 2>&1 part sends both regular output and error messages to myscript.log in your current folder.

Exit the session & reconnect later

Each tmux session is self-contained, like a separate terminal window that stays open on Zebra even after you log out. (You can have several running at once, which is useful for running different scripts side by side.) You can exit the session without stopping the process from running. 

Press Ctrl+b, let go, then press d.

You'll be back at your normal prompt, and your script keeps running in the background. To log out of Zebra completely, type:

exit 

To reconnect, log back into Zebra, then list your sessions:

tmux ls

To reconnect to a specific session type:

tmux attach -t myjob

When your script is finished and you no longer need the session, type exit while inside it to close it.

Check on your job

Open the system monitor:

htop

Press u and select your username to show only your processes. The CPU% and MEM% columns show how much your job is using. Press q to quit. (Leaving htop does not affect your job.)

If your job uses the GPU, check it with:

nvidia-smi

See your script's progress

To see the latest output in your log file as it's written:

tail -f myscript.log

Press Ctrl+c to stop watching. This only stops the display, not your script.

Estimate how long your job will take

Zebra can't tell you how long a script will take, but you can build progress messages into your code. In R, add a line inside your loop such as message("Finished ", i, " of ", n); in Python, print(f"Finished {i} of {n}") or the tqdm package works well. These messages will appear in your log file.

Before running your full analysis, try it on a small piece of your data first. This will give you an indication of how long it will take, and if there are errors in your code, you'll know sooner than if you ran everything. 

Stop a job

If you're connected to the session, press Ctrl+c to stop the script, then close the session by typing:

exit 

To end a session without reconnecting to it, use:

tmux kill-session -t myjob

If a process won't stop, kill it

Open htop, find your process, and note the number in the PID column. Then quit htop and run, replacing 12345 with that number:

kill 12345

If it's still running after a minute, use kill -9 12345 to force it to stop. 

Running things in parallel

Each user can use up to 32 processor cores and 64 GB of memory by default. You can split your work across several of them (parallel computing) to make your code run much faster.

Set the number of cores

Set the number of cores explicitly. In R, for example:

parallel::mclapply(my_list, my_function, mc.cores = 8)

or, with the {future} package:

future::plan(future::multisession, workers = 8)

In Python:

multiprocessing.Pool(processes=8)

or, with joblib or scikit-learn, set n_jobs=8.

Start with around 8 cores and see how things go; more cores isn't always faster. Also, running things in parallel is only possible for things that actually can be run independently. So it works great for vectorized data, but any loops that rely on the previous iteration (i + 1) won't work in parallel. 

Keep an eye on memory

Each parallel worker usually gets its own copy of your data, so memory use multiplies. If you have 8 cores and each needs 8 GB to run you're already at your limit and the job will stop. You can check htop after starting a parallel job to see memory usage.

Some packages (for example, ones that do heavy matrix math) use multiple cores on their own. If htop shows your job using many more cores than you wanted, set things manually with this before starting your script:

export OMP_NUM_THREADS=1

Default Usage Settings

Zebra is a shared resource, so please:

  • Email data@reed.edu if you need more than the default 32 cores or 64 GB of memory. Tell us what you're running and roughly how long it will take.
  • Run nvidia-smi before starting a GPU job to make sure no one else is using the GPU, and let us know before starting any GPU job you expect to run for more than a day.
  • Let us know if any job will run for more than a couple of days, so we know it's intentional.
  • Test on a small piece of your data before launching a full run.
  • Close tmux sessions you're no longer using, and delete files you no longer need.
Resource Students & others Faculty
Memory 64 GB 128 GB
CPU 32 cores 64 cores
/data disk 100 GB 200 GB
Home disk* 20 GB 40 GB
GPU etiquette (nvidia-smi) etiquette (nvidia-smi)

*Home disk limits are small; big files belong on /data. Download caches and new conda environments are automatically routed there.