Skip to main content

Ask for a particular PyTorch build

Description

Call this before anything starts the engine - straight after library(rplatypus) - and before the first call that needs Python.

Usage

platypus_use_torch(build = c("pascal", "default"))

Arguments

build “pascal” for the last PyTorch built against CUDA 12, or NULL for the default.

Details

There is one reason to: a GeForce GTX 10-series card, or anything older. PyTorch 2.8 and later ship CUDA 13 builds, and CUDA 13 dropped the Maxwell, Pascal and Volta generations outright. No driver update brings them back. Without this, such a card is simply not used and everything runs on the processor, perhaps ten times slower, with nothing obviously wrong.

On anything from Turing - the RTX 20-series onwards - the default is correct and this is unnecessary.

Value

The requirement string now in force, invisibly.

Saying it once instead of every session

py_require() is session state, so this does not survive a restart - and forgetting it costs about ten times the training time without costing an error, which is the kind of bill that goes unnoticed. Set it where a session starts instead:

options(rplatypus.torch = "pascal")   # ~/.Rprofile

or PLATYPUS_TORCH=pascal in ~/.Renviron, which also reaches runs that never load an .Rprofile - Rscript, a scheduler, CI. The option wins over the variable, so a session can override what a machine was configured with. “default” asks for the ordinary build, which is how to turn the setting off for one session without editing the file it came from.

Both are read when the package is loaded, which is the last moment anything can change what the environment will be. A value neither of them recognises is reported at load and ignored: a bad line in a startup file should not make the package unloadable.

Why this page shows no output

What this prints is a property of the machine it runs on, so an example output here would describe whichever machine built this page rather than yours. Run it and read your own.

Examples

library("rplatypus")

library(rplatypus)
platypus_use_torch("pascal")   # GTX 10-series and older