Longleaf Setup
UNC’s HPC cluster
Longleaf is UNC’s primary high-performance computing cluster and the recommended environment for all production lab work.
Longleaf is the recommended environment for:
- Running simulations and calibrations
- Reproducible analyses
- Collaborative work (shared file system)
- Long-running jobs
Local machines are fine for writing and editing code, small-scale testing, and manuscript writing.
Request Access
- Go to ITS Research Computing
- Request Longleaf access with PI: Naim Rashid
- Wait for approval email (~1-2 business days)
Connection Options
You have three ways to access Longleaf:
| Method | Best For | Setup Difficulty |
|---|---|---|
| OnDemand (Web) | Beginners, RStudio users | None |
| VS Code Remote | Modern editor experience | Easy |
| SSH | Command-line power users | Easy |
Open OnDemand (Web Interface)
Open OnDemand provides a web-based interface to Longleaf—no software installation required. This is the easiest way to get started.
Access
- Go to ondemand.rc.unc.edu
- Log in with your Onyen and password
- You’ll see the OnDemand dashboard
You must have a Longleaf account before using OnDemand. See Request Access above.
Key Features
| Feature | Description |
|---|---|
| Files | Browse, upload, download, edit files on Longleaf |
| Shell | Terminal access in your browser (no SSH needed) |
| RStudio Server | Full RStudio IDE running on cluster |
| Jupyter | Jupyter notebooks with Python/R kernels |
| Job Composer | Submit and manage Slurm batch jobs |
Launching RStudio Server
This is the recommended way to use RStudio on Longleaf:
- Go to Interactive Apps –> RStudio Server
- Fill in the resource request form:
- Number of hours: Start with 4-8 hours
- Number of cores: 1-4 for interactive work
- Memory (GB): 8-16 GB is usually sufficient
- Partition:
general(orgpuif needed)
- Click Launch
- Wait for job to start (usually 1-5 minutes)
- Click Connect to RStudio Server
# Example resource request for typical development work:
Hours: 8
Cores: 4
Memory: 16 GB
Partition: general
Launching Jupyter Notebooks
For Python work or R via IRkernel:
- Go to Interactive Apps –> Jupyter Notebook
- Fill in resources (similar to RStudio)
- Select Python version or load R kernel
- Click Launch then Connect
Browser-Based Terminal
Access a shell without any local software:
- Go to Clusters –> Longleaf Shell Access
- A terminal opens in your browser
- You’re on a login node—same as SSH
Use cases: Quick file operations, git commands, checking job status, module loading.
File Management
The Files menu provides a web-based file browser:
- Navigate to any directory you have access to
- Upload files via drag-and-drop (useful for small files)
- Download files or entire directories
- Edit text files directly in the browser
- Access lab shared space at
/proj/rashidlab/
Tip: For large files, use scp or rsync instead of the web uploader.
Job Composer for Batch Jobs
For long-running analyses, use Job Composer instead of interactive sessions:
- Go to Jobs –> Job Composer
- Click New Job –> From Template
- Select a template (or create from scratch)
- Edit the job script:
#!/bin/bash
#SBATCH --job-name=my_analysis
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --mem=32G
#SBATCH --output=logs/%j.out
module load r/4.3.0
Rscript scripts/run_analysis.R- Click Submit
- Monitor in Jobs –> Active Jobs
OnDemand Best Practices
- Request appropriate resources - Don’t over-request; it slows queue time
- Save work frequently - Sessions can timeout
- Use
/work/for large temp files - Not/home/(quota limited) - Check job status - Jobs –> Active Jobs shows your running sessions
- Delete completed jobs - Keeps your dashboard clean
Troubleshooting OnDemand
| Issue | Solution |
|---|---|
| Session won’t start | Check if cluster is busy; try smaller resource request |
| RStudio unresponsive | Delete job, relaunch; check memory limits |
| Can’t find files | Verify path; check you’re in correct directory |
| Git authentication fails | Re-enter credentials; check token hasn’t expired |
| Session timeout | Relaunch; consider batch job for long work |
If sessions consistently fail: Go to Jobs –> Active Jobs, delete the problematic job, clear browser cache, and try again. For persistent issues, contact ITS Research Computing.
VS Code Remote SSH
The recommended way to work on Longleaf with a modern editor.
Setup
- Install VS Code
- Install the Remote - SSH extension
- Press
Ctrl+Shift+P–> “Remote-SSH: Connect to Host” - Enter:
your_onyen@longleaf.unc.edu - VS Code opens a remote session on Longleaf
Recommended Extensions (install on remote)
- R Extension for Visual Studio Code
- Quarto
- GitLens
SSH Config (Optional)
Create ~/.ssh/config on your local machine for easier connections:
Host longleaf
HostName longleaf.unc.edu
User your_onyen
ForwardAgent yes
ForwardX11 yes
Then connect with just: ssh longleaf or select “longleaf” in VS Code.
SSH Access
For command-line access to Longleaf.
Connect via SSH
# Basic SSH connection
ssh your_onyen@longleaf.unc.edu
# With X11 forwarding (for plots)
ssh -Y your_onyen@longleaf.unc.eduWindows users: Use MobaXterm or Windows Terminal with OpenSSH.
SSH Key Setup (Passwordless Login)
# On your LOCAL machine, generate key
ssh-keygen -t ed25519 -C "your.email@unc.edu"
# Copy to Longleaf
ssh-copy-id your_onyen@longleaf.unc.edu
# Test (should not ask for password)
ssh your_onyen@longleaf.unc.eduLongleaf Environment
Module System
Longleaf uses modules instead of package managers. Software is pre-installed and loaded on demand.
# See available modules
module avail
# Search for specific software
module avail r
module avail quarto
# Load R (run 'module avail r' to see available versions)
module load r/4.3.0
# Load multiple modules
module load r/4.3.0 gcc/11.2.0 quarto/1.4.550
# See loaded modules
module list
# Unload a module
module unload r
# Unload all
module purgeKey Directories
| Path | Purpose | Quota |
|---|---|---|
/home/your_onyen/ |
Home directory | 50 GB |
/work/users/y/o/your_onyen/ |
Scratch space | 10 TB (not backed up) |
/proj/rashidlab/ |
Lab shared space | 1 TB shared (not backed up) |
/proj/rashidlab/projects/ |
Project data (private) | Within lab 1 TB quota |
/proj/rashidlab/users/ |
Personal work (private) | Within lab 1 TB quota |
/proj/rashidlab/R-packages/ |
Shared R packages | Within lab 1 TB quota |
/proj/rashidlab/ Access Rules
- The top-level
/proj/rashidlab/directory is publicly readable on the cluster — anyone can read files placed directly there. Store private or sensitive data in theprojects/orusers/subdirectories instead. - This space is not backed up. If you have data that can’t be easily reproduced, keep a copy elsewhere.
- Quota: 1 TB soft limit. You can check current usage at service.rc.unc.edu. If the folder exceeds the soft limit, a 7-day grace period starts — after that, no new files can be added until usage drops back below the limit.
- Access: To add or remove cluster access for lab members, email research@unc.edu referencing group
rc_nur2lab_psx. - Compliance: If storing data requiring NIST 800-171 compliance, see Longleaf Compliance.
R Package Installation
# First, set up personal library (one time)
dir.create("~/R/library", recursive = TRUE)
# Add to ~/.Rprofile
cat('.libPaths(c("~/R/library", "/proj/rashidlab/R-packages", .libPaths()))\n',
file = "~/.Rprofile", append = TRUE)
# Restart R, then install packages
install.packages("data.table")Quarto on Longleaf
# Load Quarto module
module load quarto/1.4.550
# Verify
quarto --version
# Render document
quarto render manuscript.qmd --to pdfNote: If Quarto module isn’t available, check module avail quarto or contact ITS Research Computing.
Longleaf Configuration Templates
~/.bashrc on Longleaf:
# Load standard modules on login
module load r/4.3.0
module load gcc/11.2.0
module load git/2.36.0
module load quarto/1.4.550
# R library path
export R_LIBS_USER=~/R/library
# Useful aliases
alias ll='ls -la'
alias squeue-me='squeue -u $USER'Then run: source ~/.bashrc
~/.Rprofile on Longleaf:
# Library paths (personal + shared lab + system)
.libPaths(c(
"~/R/library",
"/proj/rashidlab/R-packages",
.libPaths()
))
# CRAN mirror
options(repos = c(CRAN = "https://cloud.r-project.org"))Verification
After setup, verify everything works:
ssh your_onyen@longleaf.unc.edu
module load r/4.3.0
R --version
Rscript -e "library(data.table); print('OK')"
module load quarto
quarto --version
git --version