{"id":20064237,"url":"https://github.com/rocker-org/r-parallel","last_synced_at":"2025-05-05T18:30:27.370Z","repository":{"id":85476041,"uuid":"137146565","full_name":"rocker-org/r-parallel","owner":"rocker-org","description":"A Docker container with base R + several parallel/asynchronous packages","archived":false,"fork":false,"pushed_at":"2021-10-19T06:42:59.000Z","size":11,"stargazers_count":17,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T02:12:29.627Z","etag":null,"topics":["docker","linux-containers","parallel","r"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/rocker/r-parallel","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rocker-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-13T01:29:51.000Z","updated_at":"2025-03-24T19:38:23.000Z","dependencies_parsed_at":"2023-07-22T23:48:10.897Z","dependency_job_id":null,"html_url":"https://github.com/rocker-org/r-parallel","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocker-org%2Fr-parallel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocker-org%2Fr-parallel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocker-org%2Fr-parallel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocker-org%2Fr-parallel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rocker-org","download_url":"https://codeload.github.com/rocker-org/r-parallel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252552878,"owners_count":21766788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","linux-containers","parallel","r"],"created_at":"2024-11-13T13:45:23.259Z","updated_at":"2025-05-05T18:30:27.087Z","avatar_url":"https://github.com/rocker-org.png","language":"Shell","readme":"# r-parallel\n\nThis is a Docker-based Linux container that consists of the base [R] installation, by extending the [rocker/r-base] container, together with several system libraries and R packages useful for parallel/asynchronous processing.\n\n\n## Build\n\nTo build the container locally, do:\n\n```sh\n$ docker build . --tag rocker/r-parallel\nSending build context to Docker daemon  56.32kB\nStep 1/17 : FROM rocker/r-base\nlatest: Pulling from rocker/r-base\n28507814f909: Pull complete \n8205b68cfb04: Pull complete \nbbf1b2b5c36c: Pull complete \n6fc27852fced: Pull complete \n8cdff7e970c4: Pull complete \ne81d795a3e2b: Downloading ...\n[...]\n\n$ \n```\n\nTo pull it down from [Docker Hub](https://hub.docker.com/r/rocker/r-parallel/), do:\n\n```sh\n$ docker pull rocker/r-parallel\nUsing default tag: latest\nlatest: Pulling from rocker/r-parallel\n[...]\n\n$ \n```\n\n\n## Usage\n\n### Standalone\n\nTo launch R by itself, do:\n\n```sh\n$ docker run -ti rocker/r-parallel\n\nR version 3.6.1 (2019-07-05) -- \"Action of the Toes\"\nCopyright (C) 2019 The R Foundation for Statistical Computing\nPlatform: x86_64-pc-linux-gnu (64-bit)\n\nR is free software and comes with ABSOLUTELY NO WARRANTY.\nYou are welcome to redistribute it under certain conditions.\nType 'license()' or 'licence()' for distribution details.\n\n  Natural language support but running in an English locale\n\nR is a collaborative project with many contributors.\nType 'contributors()' for more information and\n'citation()' on how to cite R or R packages in publications.\n\nType 'demo()' for some demos, 'help()' for on-line help, or\n'help.start()' for an HTML browser interface to help.\nType 'q()' to quit R.\n\n\u003e y \u003c- sapply(1:3, FUN = function(x) sqrt(x))\n\u003e y\n[1] 1.000000 1.414214 1.732051\n\n\u003e library(parallel)\n\u003e y \u003c- mclapply(1:3, FUN = function(x) sqrt(x))\n\u003e y \u003c- Reduce(c, y)\n\u003e y\n[1] 1.000000 1.414214 1.732051\n\n\u003e cl \u003c- makeCluster(future::availableCores())\n\u003e y \u003c- parSapply(cl, X = 1:3, FUN = function(x) sqrt(x))\n\u003e y\n[1] 1.000000 1.414214 1.732051\n\u003e stopCluster(cl)\n\n\u003e library(future.apply)\n\u003e plan(multiprocess)\n\u003e y \u003c- future_sapply(1:3, FUN = function(x) sqrt(x))\n\u003e y\n[1] 1.000000 1.414214 1.732051\n\n\u003e library(foreach)\n\u003e doFuture::registerDoFuture()\n\u003e plan(multiprocess)\n\u003e y \u003c- foreach(x = 1:3, .combine = c) %dopar% sqrt(x)\n\u003e y\n[1] 1.000000 1.414214 1.732051\n\n\u003e quit(\"no\")\n\n$ \n```\n\n\n### As R Background Workers\n\nTo launch a parallel cluster consisting of two R workers that are running in their own [Docker] container, _from the R installation installed on the host system_, do:\n\n```r\n$ R --quiet\n\n\u003e library(parallel)\n\u003e cl \u003c- future::makeClusterPSOCK(rep(\"localhost\", times = 2L), rscript = c(\n    \"docker\", \"run\", \"--net=host\", \"rocker/r-parallel\", \"Rscript\"\n  ))\n\u003e print(cl)\nsocket cluster with 2 nodes on host ‘localhost’\n\n\u003e y \u003c- parSapply(cl, 1:3, function(x) sqrt(x))\n\u003e y\n[1] 1.000000 1.414214 1.732051\n\n\u003e stopCluster(cl)\n```\n\nTo do the same using [Singularity], do:\n\n```r\n\u003e library(parallel)\n\u003e cl \u003c- future::makeClusterPSOCK(rep(\"localhost\", times = 2L), rscript = c(\n    \"singularity\", \"exec\", \"docker://rocker/r-parallel\", \"Rscript\"\n  ))\n\u003e print(cl)\nsocket cluster with 2 nodes on host ‘localhost’\n\n\u003e y \u003c- parSapply(cl, 1:3, function(x) sqrt(x))\n\u003e y\n[1] 1.000000 1.414214 1.732051\n\n\u003e stopCluster(cl)\n```\n\n[R]: https://www.r-project.org/\n[Docker]: https://www.docker.com/\n[Singularity]: https://www.sylabs.io/singularity/\n[rocker/r-base]: https://hub.docker.com/r/rocker/r-base/\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocker-org%2Fr-parallel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocker-org%2Fr-parallel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocker-org%2Fr-parallel/lists"}