You can work on the GHC cluster machines or on your own computer. Some labs require you to measure and write a written report on your code's parallel performance, so for those labs you need a computer with a reasonable number of cores. Ideally eight or more. Of course, you can still test on a machine with fewer, but don't run performance code.
The GHC cluster machines have eight cores and 16GB of RAM, so they are a good choice. If your own computer has eight or more cores and you are comfortable setting up and installing the needed software, feel free to use it instead.
The cluster machines that we use are ghc35 through ghc42, with 8 cores
each:
ssh yourandrewid@ghcXX.ghc.andrew.cmu.edu # Replace XX with a number between 35 and 42
Everything the labs need is installed there so you do not need to follow any of the installation
instructions below. If a cluster machine is offline, try another one. They are sometimes taken down
for maintenance or rebooted. They are shared, so you should see if anyone else is already running their
code by running htop first. If so, try another machine.
MPL is provided on the cluster machines for you, and will be automatically found by our Makefiles. Python3 and matplotlib are already installed on the cluster machines for you.
Some of the cluster machines automatically place you in a Python virtual environment for machine
learning classes upon login (you can tell if your shell starts with (pytorch)).
You should leave this virtual environment by writing:
deactivate
Everything below is for setting up your own machine. If you are working on the cluster you need none of it: the software is already installed there.
If you use Windows we strongly recommend using WSL with the current Ubuntu image. WSL lets you run Linux inside Windows using a lightweight virtual machine with a real Linux kernel. Once you install it, just follow the Linux instructions inside it. We do not support MSVC or tools like Cygwin and MSYS2.
The C++ labs are built with -std=c++23 and need GCC 15 or
newer. Other compilers may not work. Our Makefiles look for
GCC 15 automatically, but you can override it if necessary (e.g., if you install GCC
somewhere that isn't on the shell's PATH):
make CXX=/opt/gcc-15/bin/g++
We recommend Ubuntu 22.04 or newer (the cluster machines are currently Ubuntu 24.04). If you use a different distribution, you will need to research how to install GCC 15 yourself and we do not guarantee it will work. Ubuntu 26.04 ships GCC 15:
sudo apt install g++ build-essential
On older Ubuntus, 22.04 and 24.04, the packaged GCC is too old, so you must add the toolchain PPA. These are officially managed packages by Canonical, so you are not adding/installing any sketchy third-party software, don't worry:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-15 build-essential
This leaves your default g++ alone; the handout finds g++-15
by name. Ubuntu 20.04 and older are unsupported.
MacOS ships with AppleClang, not GCC, so you need to install it. Before installing GCC, make sure you have the latest Apple Command Line Tools for Xcode. GCC may not work without it. You can install them with:
xcode-select --install
If macOS reports that the Command Line Tools are already installed, check System Settings → General → Software Update and install any available macOS or developer tools updates. Updating macOS and Xcode may also be necessary to get the latest SDK. Apple also provides the Command Line Tools and Xcode directly from its developer downloads.
Once you have the latest Command Line Tools, install GCC 15 via Homebrew:
brew install gcc@15
g++ to AppleClang, so
you may think you have GCC installed when you do not! So, confirm you have the real thing with g++-15 --version.
The SML labs are built with MaPLe (MPL), a parallel dialect of Standard ML. Unlike SML/NJ, MPL has no REPL.
We recommend using the cluster machines for MaPLe, but you are welcome to try it locally by following
the instructions here.
After you install it, you will need to add the directory containing the mpl binary to your
shell PATH, e.g., ~/.mpl/bin/ if you used the mpl-switch installation
method (recommended), or the directory that you built into if you manually built MaPLe from source.
Alternatively, if you do not want to edit your PATH, you can just tell make
where you put mpl each time you run it by setting MPL as a make command-line
variable pointing at the mpl binary (not just its directory):
make MPL=~/.mpl/bin/mpl
Some labs ask you to produce benchmark plots for your code's performance from a supplied Python script. You will need Python3 and the Matplotlib library.
Ubuntu. Use the package, because
pip refuses to touch the system Python:
sudo apt install python3 python3-matplotlib
macOS. Use a virtual environment:
python3 -m venv ~/venv-210
source ~/venv-210/bin/activate
pip install matplotlib
No specific editor or IDE is required; the labs build with make from a terminal.
Use whatever you are comfortable with. If you prefer using an IDE, CLion
is good for C++, and has free licences for students.
VS Code works, but you will need
to ensure that the settings are correctly set to C++23, or it will report syntax errors that
are not there.
For SML in VS Code, install Millet, a language server that gives you highlighting and type information; Tyler's local VS Code setup for SML shows a configuration for it. For emacs and vim, 15-150's tools page covers the setup.
Remote editing.
You do not have to work in a terminal editor. Both workflows your prerequisites teach work
here: the SFTP sync from 15-122's
VSCode
guide, which edits locally and syncs to the machine you compile on, and VS Code's
Remote-SSH,
which opens a window directly onto a cluster machine. If you reuse your 15-122
configuration, point it at a ghc cluster machine rather than the four-core
linux.andrew.cmu.edu in their example.