From 98ceef33136b5055a1cf1c9d7d5b2dcae639b066 Mon Sep 17 00:00:00 2001 From: edwardlavender Date: Wed, 31 Jul 2024 10:39:17 +0200 Subject: [PATCH] Add multi-threading guidance for windows to `julia_connect()` (see #11) --- R/julia-connect.R | 3 ++- man/julia_connect.Rd | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/julia-connect.R b/R/julia-connect.R index 755270ee..0c0fa0f2 100644 --- a/R/julia-connect.R +++ b/R/julia-connect.R @@ -14,7 +14,7 @@ #' #' @param .pkg_config (optional) A `character` string of `Julia` code, evaluated by [`julia_code()`], that configures `Julia` prior to dependency management. #' @param .pkg_update A `logical` variable that defines whether or not to update installed `Julia` packages. -#' @param .threads A `character` (`"auto"`) or an `integer` that defines the number of threads used by multi-threaded operations in `Julia`. This can only be set once per `R` session. +#' @param .threads A `character` (`"auto"`) or an `integer` that defines the number of threads used by multi-threaded operations in `Julia`. This can only be set once per `R` session. **It is currently ignored on Windows** (see below). #' @param .verbose User output control (see [`patter-progress`] for supported options). #' #' @details [`patter`] is an `R` front-end for the [`Patter.jl`](https://github.com/edwardlavender/Patter.jl) package. This requires a local installation of `Julia`. This function connects `R` to the local `Julia` installation, sets up [`JuliaCall`], which provides the integration between `R` and `Julia`, and [`Patter.jl`](https://github.com/edwardlavender/Patter.jl). Internally, the steps are as follows: @@ -23,6 +23,7 @@ #' - If `.threads = NULL`, `JULIA_NUM_THREADS` is set to `"auto"` if unset or left unchanged otherwise; #' - Otherwise, `JULIA_NUM_THREADS` is set to `.threads`; #' - The number of threads can only be set once per `R` session; +#' - On Windows, setting `JULIA_NUM_THREADS` as an environment variable in `.Renviron` or using `.threads` does not work. See this [issue](https://github.com/edwardlavender/patter/issues/11) for a workaround. #' * The `Julia` installation is validated. #' * A local `Julia` Project is generated in `JULIA_PROJ` (if specified and required) and activated. We recommend using [`patter`] within an RStudio Project, with a `Julia` directory at the top-level that contains the `Julia` project. #' * If specified, `.pkg_config` is run via [`julia_code()`]. diff --git a/man/julia_connect.Rd b/man/julia_connect.Rd index 61a208e0..0e72ba0f 100644 --- a/man/julia_connect.Rd +++ b/man/julia_connect.Rd @@ -32,7 +32,7 @@ If \code{NULL}, a \code{Julia} Project is not used and the default environment i \item{.pkg_update}{A \code{logical} variable that defines whether or not to update installed \code{Julia} packages.} -\item{.threads}{A \code{character} (\code{"auto"}) or an \code{integer} that defines the number of threads used by multi-threaded operations in \code{Julia}. This can only be set once per \code{R} session.} +\item{.threads}{A \code{character} (\code{"auto"}) or an \code{integer} that defines the number of threads used by multi-threaded operations in \code{Julia}. This can only be set once per \code{R} session. \strong{It is currently ignored on Windows} (see below).} \item{.verbose}{User output control (see \code{\link{patter-progress}} for supported options).} } @@ -51,6 +51,7 @@ This function connects \code{R} to \code{Julia}. \item If \code{.threads = NULL}, \code{JULIA_NUM_THREADS} is set to \code{"auto"} if unset or left unchanged otherwise; \item Otherwise, \code{JULIA_NUM_THREADS} is set to \code{.threads}; \item The number of threads can only be set once per \code{R} session; +\item On Windows, setting \code{JULIA_NUM_THREADS} as an environment variable in \code{.Renviron} or using \code{.threads} does not work. See this \href{https://github.com/edwardlavender/patter/issues/11}{issue} for a workaround. } \item The \code{Julia} installation is validated. \item A local \code{Julia} Project is generated in \code{JULIA_PROJ} (if specified and required) and activated. We recommend using \code{\link{patter}} within an RStudio Project, with a \code{Julia} directory at the top-level that contains the \code{Julia} project.