Parallel computing (original) (raw)
quanteda takes advantage of parallel computing through the TBB (Threading Building Blocks) library to speed up computations. This guide provides step-by-step instructions on how to set up your system for using Quanteda with parallel capabilities on Windows, macOS, and Linux.
For Windows Users
Install RTools
- Download and install RTools from RTools download page.
- During installation, ensure you select the option to add RTools to the system path.
Check Installation
- Open an R session and check that RTools is correctly configured:
For macOS users
Opening the Terminal
To open the terminal on macOS, press Cmd+Space
to open Spotlight, type “Terminal”, and press enter. Alternatively, you can find the Terminal in /Applications/Utilities/
.
Install required tools and libraries
- Install XCode Command Line Tools
- Type the following command in the terminal:
- Install Homebrew
- If Homebrew is not installed, run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Follow the on-screen instructions.
- Install TBB and pkg-config
- After installing Homebrew, run:
brew install tbb pkg-config
- Install gfortran
- Required for compiling Fortran code, install using Homebrew:
For Linux users
Opening the terminal
To open the terminal in Linux, you can usually useCtrl+Alt+T
, or search for “Terminal” in your system’s application launcher.
Install TBB
- For Fedora, CentOS, RHEL:
sudo yum install tbb-devel
- For Debian and Ubuntu:
sudo apt install libtbb-dev
Installing quanteda from CRAN
After setting up the required tools and libraries, installquanteda from CRAN:
Parallelisation functions properly if you receive a message detailing the number of threads used for parallel computing after loadingquanteda.
library(quanteda)
# Package version: 4.0.2
# Unicode version: 15.1
# ICU version: 74.1
# Parallel computing: 20 of 20 threads used.
# See https://quanteda.io for tutorials and examples.