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

Check Installation

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

  1. Install XCode Command Line Tools
    • Type the following command in the terminal:
  2. 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.
  3. Install TBB and pkg-config
    • After installing Homebrew, run:
    brew install tbb pkg-config  
  4. 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

sudo yum install tbb-devel  
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.