All Projects → RevolutionAnalytics → foreach

RevolutionAnalytics / foreach

Licence: Apache-2.0 license
R package to provide foreach looping construct

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to foreach

vuo
A realtime visual programming language for interactive media.
Stars: ✭ 103 (+157.5%)
Mutual labels:  parallel-computing
samp-foreach
foreach standalone include (non y_iterate version)
Stars: ✭ 20 (-50%)
Mutual labels:  foreach
learn-gpgpu
Algorithms implemented in CUDA + resources about GPGPU
Stars: ✭ 37 (-7.5%)
Mutual labels:  parallel-computing
QUICK
QUICK: A GPU-enabled ab intio quantum chemistry software package
Stars: ✭ 79 (+97.5%)
Mutual labels:  parallel-computing
ClimateTools.jl
Climate science package for Julia
Stars: ✭ 108 (+170%)
Mutual labels:  parallel-computing
pcluster-manager
Manage AWS ParallelCluster through an easy to use web interface
Stars: ✭ 67 (+67.5%)
Mutual labels:  parallel-computing
pyabc
pyABC: distributed, likelihood-free inference
Stars: ✭ 13 (-67.5%)
Mutual labels:  parallel-computing
Pratchett.js
A JavaScript interpreter for Paws.
Stars: ✭ 31 (-22.5%)
Mutual labels:  parallel-computing
corebench
corebench - run your benchmarks against high performance computing servers with many CPU cores
Stars: ✭ 29 (-27.5%)
Mutual labels:  parallel-computing
gardenia
GARDENIA: Graph Analytics Repository for Designing Efficient Next-generation Accelerators
Stars: ✭ 22 (-45%)
Mutual labels:  parallel-computing
pestpp
tools for scalable and non-intrusive parameter estimation, uncertainty analysis and sensitivity analysis
Stars: ✭ 90 (+125%)
Mutual labels:  parallel-computing
ps pytorch
implement distributed machine learning with Pytorch + OpenMPI
Stars: ✭ 47 (+17.5%)
Mutual labels:  parallel-computing
mango
Parallel Hyperparameter Tuning in Python
Stars: ✭ 241 (+502.5%)
Mutual labels:  parallel-computing
t8code
Parallel algorithms and data structures for tree-based AMR with arbitrary element shapes.
Stars: ✭ 37 (-7.5%)
Mutual labels:  parallel-computing
Lazy
Light-weight header-only library for parallel function calls and continuations in C++ based on Eric Niebler's talk at CppCon 2019.
Stars: ✭ 93 (+132.5%)
Mutual labels:  parallel-computing
job stream
An MPI-based C++ or Python library for easy distributed pipeline processing
Stars: ✭ 32 (-20%)
Mutual labels:  parallel-computing
hpc
Learning and practice of high performance computing (CUDA, Vulkan, OpenCL, OpenMP, TBB, SSE/AVX, NEON, MPI, coroutines, etc. )
Stars: ✭ 39 (-2.5%)
Mutual labels:  parallel-computing
TSP-GA
Traveling Salesman Problem Using Parallel Genetic Algorithms
Stars: ✭ 29 (-27.5%)
Mutual labels:  parallel-computing
PHCpack
The primary source code repository for PHCpack, a software package to solve polynomial systems with homotopy continuation methods.
Stars: ✭ 50 (+25%)
Mutual labels:  parallel-computing
ParallelQSlim
Shape Aware Parallel Mesh Simplification Algorithm
Stars: ✭ 84 (+110%)
Mutual labels:  parallel-computing

foreach

CRAN Downloads R-CMD-check

This package provides support for the foreach looping construct. Foreach is an idiom that allows for iterating over elements in a collection, without the use of an explicit loop counter. The main reason for using this package is that it supports parallel execution, that is, it can execute repeated operations on multiple processors/cores on your computer, or on multiple nodes of a cluster. Many different adapters exist to use foreach with a variety of computational backends, including:

  • doParallel: execute foreach loops on clusters created with base R's parallel package
  • doFuture: using the future framework
  • doRedis: on a Redis database
  • doAzureParallel: on a compute cluster in Azure
  • and more.

Example

A basic for loop in R that fits a set of models:

dat_list <- split(iris, iris$Species)
mod_list <- vector("list", length(dat_list))
for(i in seq_along(dat_list)) {
    mod_list[[i]] <- lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat_list[[i]])
}

The same using foreach:

library(foreach)
mod_list2 <- foreach(dat=dat_list) %do% {
    lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat)
}

The same, but fit in parallel on a background cluster. We change the %do% operator to %dopar% to indicate parallel processing.

library(doParallel)
registerDoParallel(3)
mod_list2 <- foreach(dat=dat_list) %dopar% {
    lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=dat)
}

stopImplicitCluster()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].