<div><span>Share This: </span><a title="Share on Facebook" data-provider="facebook" target="_blank" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F&t=R%20with%20Parallel%20Computing%20from%20User%20Perspectives&%23038;s=100&%23038;p&%23091;url&%23093;=http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F&%23038;p&%23091;images&%23093;&%23091;0&%23093;=http%3A%2F%2Fwww.parallelr.com%2Fwp-content%2Fuploads%2F2016%2F09%2Flogo.jpg&%23038;p&%23091;title&%23093;=R%20with%20Parallel%20Computing%20from%20User%20Perspectives"><img title="Share on Facebook" alt="Facebook" src="https://i1.wp.com/www.parallelr.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/facebook.png?resize=32%2C32" data-recalc-dims="1"></a><a title="Share on Twitter" data-provider="twitter" target="_blank" rel="nofollow" href="http://twitter.com/share?url=http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F&text=Hey%20check%20this%20out"><img title="Share on Twitter" alt="twitter" src="https://i0.wp.com/www.parallelr.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/twitter.png?resize=32%2C32" data-recalc-dims="1"></a><a title="Share on Google+" data-provider="google_plus" target="_blank" rel="nofollow" href="https://plus.google.com/share?url=http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F"><img title="Share on Google+" alt="google_plus" src="https://i1.wp.com/www.parallelr.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/google_plus.png?resize=32%2C32" data-recalc-dims="1"></a><a title="Share on Reddit" data-provider="reddit" target="_blank" rel="nofollow" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F&title=R%20with%20Parallel%20Computing%20from%20User%20Perspectives"><img title="Share on Reddit" alt="reddit" src="https://i1.wp.com/www.parallelr.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/reddit.png?resize=32%2C32" data-recalc-dims="1"></a><a title="Pin it with Pinterest" data-provider="pinterest" target="_blank" rel="nofollow" href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F&media=http%3A%2F%2Fwww.parallelr.com%2Fwp-content%2Fuploads%2F2016%2F09%2Flogo.jpg&%23038;description=R%20with%20Parallel%20Computing%20from%20User%20Perspectives"><img title="Pin it with Pinterest" alt="pinterest" src="https://i2.wp.com/www.parallelr.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/pinterest.png?resize=32%2C32" data-recalc-dims="1"></a><a title="Share on Linkedin" data-provider="linkedin" target="_blank" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F&%23038;title=R%20with%20Parallel%20Computing%20from%20User%20Perspectives"><img title="Share on Linkedin" alt="linkedin" src="https://i0.wp.com/www.parallelr.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/linkedin.png?resize=32%2C32" data-recalc-dims="1"></a><a title="Share by email" data-provider="mail" target="_blank" rel="nofollow" href="mailto:?subject=R%20with%20Parallel%20Computing%20from%20User%20Perspectives&body=Hey%20check%20this%20out:%20http%3A%2F%2Fwww.parallelr.com%2Fr-with-parallel-computing%2F"><img title="Share by email" alt="mail" src="https://i0.wp.com/www.parallelr.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/64x64/mail.png?resize=32%2C32" data-recalc-dims="1"></a></div>
<hr>
<p><em>This article is originally published in <a target="_blank" href="http://cos.name/">Capital of Statistic</a> by Chinese [<a target="_blank" href="http://cos.name/2016/09/r-and-parallel-computing/">link</a>] and I would like to thank <a target="_blank" href="http://www.sfu.ca/~hetongh/">He Tong</a> for lots of great suggestions.</em></p>
<p><em>All code in this post can be found on GitHub [<a target="_blank" href="https://github.com/PatricZhao/ParallelR/tree/master/PP_for_COS">link</a>].</em></p>
<hr>
<p>Data scientists are already very familiar with statistical software like <a target="_blank" href="https://www.r-project.org/">R</a>, <a target="_blank" href="http://www.sas.com/en_hk/home.html">SAS</a>, <a target="_blank" href="http://www.ibm.com/analytics/us/en/technology/spss/">SPSS</a>, <a target="_blank" href="http://www.mathworks.com/products/matlab">MATLAB</a>; however, some of them are relatively inexperienced in parallel computing. So, in this post, I will introduce you some basic concepts on the use of parallel computing in R.</p>
<h1>What is Parallel Computing？</h1>
<p><a target="_blank" href="https://computing.llnl.gov/tutorials/parallel_comp/">Parallel computing</a>, specifically, should include <a target="_blank" href="https://en.wikipedia.org/wiki/Supercomputer">high-performance computers</a> and <a target="_blank" href="http://whatis.techtarget.com/definition/parallel-processing-software">parallel software</a>. The peak performance of high-performance computers increases quickly. In the most recent ranking of the world’s TOP500 supercomputers, Chinese Sunway Taihu Light topped the list with 93 PFLOPS (<a target="_blank" href="https://en.wikipedia.org/wiki/Supercomputer">here</a>). For most individuals, small and medium enterprises, high-performance computers are too expensive. So, the application of high-performance computers is indeed limited, mainly in the field of national defense, military, aerospace and research areas. In recent years, with the rapid developments of multicore CPU, cheap cluster, and various accelerators (<a target="_blank" href="https://en.wikipedia.org/wiki/Nvidia_Tesla">NVIDIA GPU</a>, <a target="_blank" href="http://www.intel.com/content/www/us/en/processors/xeon/xeon-phi-detail.html">Intel Xeon Phi</a>, <a target="_blank" href="http://www.xilinx.com/training/fpga/fpga-field-programmable-gate-array.htm">FPGA</a>), personal computers has been comparable to high-performance computers.</p>
<p><a target="_blank" href="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/sunway-taihulight.jpg"><img sizes="(max-width: 630px) 100vw, 630px" alt="sunway-taihulight" class="wp-image-1171" src="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/sunway-taihulight.jpg?resize=456%2C239" data-recalc-dims="1"></a></p>
<p>On the other hand, the software changes lag a lot. Imagine what software you’re using  supported parallel operations, Chrome, Visual Studio or R?</p>
<p><a target="_blank" href="https://i0.wp.com/www.parallelr.com/wp-content/uploads/2016/09/cs.png"><img sizes="(max-width: 887px) 100vw, 887px" alt="common software" class="wp-image-1125" src="https://i0.wp.com/www.parallelr.com/wp-content/uploads/2016/09/cs.png?resize=456%2C181" data-recalc-dims="1"></a></p>
<p>Software parallelization requires more research and development supports. It is called <a target="_blank" href="https://software.intel.com/en-us/articles/what-is-code-modernization">code modernization</a> for the procedure of changing the serial code to parallel, which sounds a very interesting work. But, in practice, a large number of bug fixes, data structure rewrite, uncertain software behaviors and cross-platform issues greatly increase the software development and maintenance costs.</p>
<h1>Why R Needs Parallel Computing?</h1>
<p>Let’s come back to R. As one of the most popular statistical software, R has a lot of advantages, such as a wealth of statistical models, data processing tools, and powerful visualization capabilities. However, with an increasing amount of data, R’s memory usage and computation mode limit R to scale. From the memory perspective, R uses in-memory calculation mode. All data need to be processed in the main memory (RAM). Obviously, its advantages are high computational efficiency and speed, but the drawback is that the size of the problem can be handled by R is very limited (&lt;RAM ). Secondly, R core is a single-threaded program. Thus, in the modern multi-core processors,  R can not effectively use all the computing cores. If the R went to the Sunway CPU of 260 computing cores, single-threaded R only take 1/260 computing power and waste other computing cores of 259/260.</p>
<h2><span><strong>Solution？Parallel Computing!</strong></span></h2>
<p>Parallel computing technology can solve the problem that single-core and memory capacity can not meet the application needs. Thus, the parallel computing technology will be extremely expansion of the use of R.  From R 2.14 (Feb 2012), ‘<a target="_blank" href="https://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf">parallel</a>‘ package is installed by default. Obviously, R core development team also attached great importance to parallelization.</p>
<p><a target="_blank" href="https://i1.wp.com/www.parallelr.com/wp-content/uploads/2016/09/RPP.png"><img sizes="(max-width: 1326px) 100vw, 1326px" class="wp-image-1162" src="https://i1.wp.com/www.parallelr.com/wp-content/uploads/2016/09/RPP.png?resize=456%2C264" data-recalc-dims="1"></a></p>
<h1>How to Use Parallel Computing?</h1>
<p>From the user’s view, parallel computing in R can be divided into implicit and explicit computing mode.</p>
<h2>Implicit Mode</h2>
<p>Implicit computing hides most of the details for the user. It is not necessary to know how to allocate hardware resources, distribute workloads and gather results. The computations will start automatically based on the current hardware resources. Obviously, this mode is the most favorable. We can achieve higher performance without changing the calculation mode and our codes. <span>Common implicit parallel mode includes:</span></p>
<ul>
<li>Using Parallel Libraries</li>
</ul>
<p>Parallel libraries, such as <a target="_blank" href="http://www.openblas.net/">OpenBLAS</a>，<a target="_blank" href="https://software.intel.com/en-us/intel-mkl">Intel MKL</a>，<a target="_blank" href="https://developer.nvidia.com/cublas">NVIDIA cuBLAS</a>, are usually provided by the hardware manufacturer with in-depth optimizations based on the corresponding hardwares, so its performance is hugely better than R libraries. It is recommended choosing a high-performance R library at compile time or loading by LD_PRELOAD at runtime. The details of compiling and loading BLAS libraries can be found in the appendix of our previous blog (in <a target="_blank" href="http://www.parallelr.com/r-hpac-benchmark-analysis/">here</a>). In the first diagram, the matrix calculation experiments, parallel libraries on 1 or 2 CPUs is a hundred times faster than R original library. On the second, we can see the GPU math library shows remarkable speed for some common analysis algorithms as well (<a target="_blank" href="http://www.parallelr.com/presentation/">details</a>).</p>
<p><a target="_blank" href="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/mm.png"><img sizes="(max-width: 741px) 100vw, 741px" alt="GEMM" class="wp-image-1188" src="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/mm.png?resize=456%2C301" data-recalc-dims="1"></a></p>
<p><a target="_blank" href="https://i1.wp.com/www.parallelr.com/wp-content/uploads/2016/09/ca.png"><img sizes="(max-width: 746px) 100vw, 746px" alt="GPU for R" class="wp-image-1189" src="https://i1.wp.com/www.parallelr.com/wp-content/uploads/2016/09/ca.png?resize=456%2C299" data-recalc-dims="1"></a></p>
<p> </p>
<ul>
<li>Using MultiThreading Functions</li>
</ul>
<p><a target="_blank" href="http://openmp.org/wp/">OpenMP</a> is a multithreading library based on shared memory architecture for application acceleration. The latest R has been opened OpenMP options (-fopenmp) at compile time on Linux, which means that some of the calculations can be run in multithreaded mode. For example , <code>dist</code> is implemented by multithreading with OpenMP. The example code as below (<a target="_blank" href="https://github.com/PatricZhao/ParallelR/blob/master/PP_for_COS/ImplicitParallel_MT.R">ImplicitParallel_MT.R</a>):</p>
<pre>
# comparison of single thread and multiple threads run
for(i in 6:11) {
  ORDER &lt;- 2^i
  m &lt;- matrix(rnorm(ORDER*ORDER),ORDER,ORDER);
  .Internal(setMaxNumMathThreads(1)); .Internal(setNumMathThreads(1)); res &lt;- system.time(d &lt;- dist(m))
  print(res)
  .Internal(setMaxNumMathThreads(20)); .Internal(setNumMathThreads(20)); res &lt;- system.time(d &lt;- dist(m))
  print(res)
}
</pre>
<p><a target="_blank" href="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/dist.png"><img sizes="(max-width: 923px) 100vw, 923px" class="wp-image-1184" src="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/dist.png?resize=456%2C333" data-recalc-dims="1"></a></p>
<ul>
<li>Using Parallel Packages</li>
</ul>
<p>In the list of <a target="_blank" href="https://cran.r-project.org/web/views/HighPerformanceComputing.html">R high-performance computing</a>, there are lots of parallel packages and tools. These parallel packages can be used like any other R packages quickly and conveniently. R users can always focus on the problem itself, without having to think too much about parallelism implementations and performance issues.</p>
<p>Take <a target="_blank" href="http://www.h2o.ai/">H2O.ai</a> for example, it takes Java as the backend to achieve multi-threading and multi-nodes computing. Users only need to load the package, and then initialize H2O with thread number. After that subsequent calculations, such as GBM, GLM, DeepLearning algorithm, will automatically be assigned to multiple threads and multiple CPUs.</p>
<p> </p>
<pre>
library(h2o)
h2o.init(nthreads = 4)
# Connection successful!
# R is connected to the H2O cluster: 
# H2O cluster uptime: 1 hours 53 minutes 
# H2O cluster version: 3.8.3.3 
# H2O cluster name: H2O_started_from_R_patricz_ywj416 
# H2O cluster total nodes: 1 
# H2O cluster total memory: 1.55 GB 
# H2O cluster total cores: 4 
# H2O cluster allowed cores: 4 
# H2O cluster healthy: TRUE 
# H2O Connection ip: localhost 
# H2O Connection port: 54321 
# H2O Connection proxy: NA 
# R Version: R version 3.3.0 (2016-05-03)
</pre>
<p> </p>
<h2>Explicit Mode</h2>
<p>Explicit parallel computing requires the user to be able to deal with more details, including data partitions, task distributions, and final results collections. Users not only need to understand their own algorithms but also need to have a certain understanding of hardware and software stack. Thus, it’s a little difficult for users.</p>
<p>Fortunately, parallel computing framework in R, such as <code>parallel</code>,<code>Rmpi</code> and <code>foreach</code>, provides the simple parallel programming approach by mapping structure. R users only need to transfer the code into the form of <code>*apply</code> or <code>for</code>, and then replace them by parallel APIs such as <code>mc*apply</code> or <code>foreach</code>. For more complex calculation flow, the user can repeat the process of map-and-reduce.</p>
<p><a target="_blank" href="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/mapping-1.png"><img sizes="(max-width: 1357px) 100vw, 1357px" alt="R Parallel Approaches" class="wp-image-1211" src="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/mapping-1.png?resize=456%2C246" data-recalc-dims="1"></a></p>
<p>Now, we show you a parallel example by solving quadratic equation with <code>*apply</code> and <code>for</code> style. The whole code in <a target="_blank" href="https://github.com/PatricZhao/ParallelR/blob/master/PP_for_COS/ExplicitParallel.R">ExplicitParallel.R</a>. First, we present a non- vectorized function for solving the equation, which can handle several special cases, such as second quadratic coefficient is zero, or second and first quadratic term are zero, or the number of the square root is negative.</p>
<pre>
# Not vectorized function
# Quadratic Equation: a*x^2 + b*x + c = 0
solve.quad.eq &lt;- function(a, b, c) 
{
 # Not validate eqution: a and b are almost ZERO
 if(abs(a) &lt; 1e-8 &amp;&amp; abs(b) &lt; 1e-8) return(c(NA, NA) )
 
 # Not quad equation
 if(abs(a) &lt; 1e-8 &amp;&amp; abs(b) > 1e-8) return(c(-c/b, NA))
 
 # No Solution
 if(b*b - 4*a*c &lt; 0) return(c(NA,NA))
 
 # Return solutions
 x.delta &lt;- sqrt(b*b - 4*a*c)
 x1 &lt;- (-b + x.delta)/(2*a)
 x2 &lt;- (-b - x.delta)/(2*a)
 
 return(c(x1, x2))
}
</pre>
<p>And then, we randomly generated three big vectors to storage three coefficients.</p>
<pre>
# Generate data 
len &lt;- 1e8
a &lt;- runif(len, -10, 10)
a[sample(len, 100,replace=TRUE)] &lt;- 0

b &lt;- runif(len, -10, 10)
c &lt;- runif(len, -10, 10)
</pre>
<h3><span><strong>*apply IMPLEMENTATION: </strong></span></h3>
<p>First, we look at the serial code. The data is mapped into solver function,<code>solve.quad.eq </code>by <code>lapply</code>, and the results are saved into list finally.</p>
<pre>
# serial code
system.time(
res1.s &lt;- lapply(1:len, FUN = function(x) { solve.quad.eq(a[x], b[x], c[x])})
)
</pre>
<p>Next, we use the function of <code>mcLapply</code> (multicores) in <code>parallel</code> package to parallelize calculations in <code>lapply</code>. From the API interface, the usage of <code>mcLapply</code> is really similar with <code>lapply</code> in addition to specifying the core numbers. <code>mcLapply</code> creates multiple copies of the current R session based on Linux fork mechanism, and evenly assign compute tasks into multiple processes regarding with input index. Finally, the master R session will collect the results from all worker sessions. If we specify two worker processes, one process calculated <code>1:(len/2)</code> while another computing <code>(len/2+1):len</code>, and finally two parts of results will be merged into <code>res1.p</code>. However, due to the use of Linux mechanisms, this version can’t be executed on non-Linux platforms.</p>
<pre>
# parallel, only Linux platform
library(parallel)
# multicores on Linux
system.time(
  res1.p &lt;- mclapply(1:len, 
                     FUN = function(x) { solve.quad.eq(a[x], b[x], c[x]) }, 
                     mc.cores = 4)
)
</pre>
<p>For non-Linux users, we can use <code>parLapply</code> function in <code>parallel</code> package to achieve parallelism. <code>parLapply</code> function supports different platforms including Windows, Linux and Mac with better portability, but its usage is a little complicated than <code>mclapply</code>. Before using <code>parLapply</code> function, we need to create a computing group (cluster) first. Computing group is a software-level concept, which means how many R worker processes we need to create (Note: <code>par*apply</code> package will create several new R processes rather than copies of R master process from <code>mc*apply</code>). Theoretically, the size of the computing group is not affected by the hardware configuration.For example, we can create a group with 1000 R worker processes on any machine. In practice, we usually use the same size of computing group with hardware resources (such as physical cores) so that each worker process of R can be mapped to a physical core.<br>
In the following example, we start with <code>detectCores</code> function to determine the number of computing cores in the machine.It is noteworthy that <code>detectCores()</code> returns the number of <a target="_blank" href="https://en.wikipedia.org/wiki/Hyper-threading">Hyper-Threading</a> rather than real physical cores.For example, there are two physical cores on my laptop, and each core can simulate two hyperthreading , so <code>detectCores()</code> return value is 4. However, for many compute-intensive tasks, the Hyper-Threading is not much helpful for improving performance, so we use the parameter of <code>logical=FALSE</code> to get the actual number of physical cores and then create the same number group.Since the worker processes in the group is new R sessions, the data and functions of the parent process is not visible. Therefore, we have to broadcast the data and functions to all worker processes by <code>clusterExport</code> function. Finally <code>parLapply</code> will distribute the tasks to all R worker processes evenly, and then gather results back.</p>
<pre>
# cluster on Windows
cores &lt;- detectCores(logical = FALSE)
cl &lt;- makeCluster(cores)
clusterExport(cl, c('solve.quad.eq', 'a', 'b', 'c'))
system.time(
   res1.p &lt;- parLapply(cl, 1:len, function(x) { solve.quad.eq(a[x], b[x], c[x]) })
)
stopCluster(cl)
</pre>
<h3><span><strong>for IMPLEMENTATION: </strong></span></h3>
<p>The computation approach of <code>for</code> is very similar with <code>*apply</code>. In the following serial implementation, we created a matrix for storage results and update the results one by one in the inner loop.</p>
<pre>
# for style: serial code
res2.s &lt;- matrix(0, nrow=len, ncol = 2)
system.time(
    for(i in 1:len) {
        res2.s[i,] &lt;- solve.quad.eq(a[i], b[i], c[i])
    }
)
</pre>
<p>For the for loop parallelization, we can use <code>%dopar%</code> in <code>foreach</code> package to distribute the computations to multiple R workers. <code>foreach</code> package provides a method of data mapping, but does not include the establishment of computing group.Therefore, we need to create a computing group by <code>doParallel</code> or <code>doMC</code> package. Creating computing group is as same as before, except setting backend of computations by <code>registerDoParallel</code>.</p>
<p>Now we consider the data decomposition. Actually, we want each R worker process to deal with continuous computing tasks. Suppose we have two R worker processes, the process 1 computes from <code>1:len/2</code>, another process for <code>(len/2+1):len</code>. Therefore, in the following example code, we evenly distribute the vectors to computing group and each process calculates the size of <code>chunk.size</code>. Another important skill is using local matrix to save partial results in each process. Last, combine local results together by <code>.combine='rbind'</code> parameter.</p>
<pre>
# foreach, work on Linux/Windows/Mac
library(foreach)
library(doParallel)

# Real physical cores in my computer
cores &lt;- detectCores(logical = FALSE)
cl &lt;- makeCluster(cores)
registerDoParallel(cl, cores=cores)

# clusterSplit are very convience to split data but it takes lots of extra memory
# chunks &lt;- clusterSplit(cl, 1:len)

# split data by ourselves
chunk.size &lt;- len/cores

system.time(
 res2.p &lt;- foreach(i=1:cores, .combine='rbind') %dopar%
 { 
    # local data for results
    res &lt;- matrix(0, nrow=chunk.size, ncol=2)
    for(x in ((i-1)*chunk.size+1):(i*chunk.size)) {
        res[x - (i-1)*chunk.size,] &lt;- solve.quad.eq(a[x], b[x], c[x])
    }
    # return local results
    res
 }
)

stopImplicitCluster()
stopCluster(cl)
</pre>
<p>Finally, we tested the code on Linux platform with 4 threads and can gain more than <strong><span>3X speedup</span> </strong> for every parallel implementation!</p>
<p><a target="_blank" href="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/EP.png"><img sizes="(max-width: 923px) 100vw, 923px" alt="R explicit parallel mode" class="wp-image-1176" src="https://i2.wp.com/www.parallelr.com/wp-content/uploads/2016/09/EP.png?resize=456%2C352" data-recalc-dims="1"></a></p>
<h1>Challenges and Prospects</h1>
<p><span><strong>Challenges</strong> </span>:In practice, the problem needed to be resolved by parallel computing is not such simple as our examples. To parallelize R and its eco-system are still very difficult because,</p>
<ul>
<li>R is a decentralized and non-commercial software</li>
</ul>
<p>R is not developed by a compact organization or company while most of R’s packages are contributed by users. It means that it is difficult to adjust and unify software architecture and design with the same philosophy. On the other hand, commercial software, such as Matlab, with unified development, maintenance, and management, can be relatively easier to restructure and reconstruct. Therefore, after several times update, the parallelism of commercial software will be much higher.</p>
<ul>
<li>The infrastructure design of R is still single-threaded</li>
</ul>
<p>R was originally designed for single-threaded so that many of the underlying data structures and functions are not thread-safe. Therefore, lots of codes need to be rewritten or adjust for high-level parallel algorithms. But it likely will destroy the original design patterns.</p>
<ul>
<li>The packages are highly dependent</li>
</ul>
<p>Assume that we use package B in R, and B depends on some functions of package A. If package B is improved by multithreading first; after that package A is also enhanced by parallelization. So, it is likely to appear hybrid parallel when we use package B. It may lead lots of strange errors (BUGs) and performance decrease if there is no comprehensive design and testing during developments.</p>
<p><strong><span>Prospects</span>:</strong> How will the future of parallelism in R ?</p>
<ul>
<li>High-performance components from commercial and research organizations</li>
</ul>
<p>Essentially, software developments are inseparable from the human and financial investments. The packages, such as <a target="_blank" href="http://www.h2o.ai/">H2O</a>, <a target="_blank" href="https://github.com/dmlc/mxnet">MXNet</a>, <a target="_blank" href="https://software.intel.com/en-us/blogs/daal">Intel DAAL</a>, improve the performance significantly from parallelism with long-term supports.</p>
<ul>
<li>Cloud Platform</li>
</ul>
<p>With the rise of cloud computing ,Data Analyst as a Services (DAAS) and Machine Learning as a Service (MLAS) are more and more popular.The major cloud providers optimize their tools, including R, from hardware deployments, database, high-level algorithms and explore much more parallelism in application level. For example, Microsoft recently launched a series supports for R in their cloud (<a target="_blank" href="http://www.zdnet.com/article/microsofts-r-strategy/">here</a>).</p>
<p>Therefore, parallel in R will be more transparent. The user does the same things in R, but the real computing will be distributed to the cloud.</p>
<p> </p>
<hr>
<p> </p>
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/dSiBdqoFZfg">