title: Simple OpenCL example in R with R code?
body: <p>Is it possible to use OpenCL but with R code? I still don't have a good understanding of OpenCL and GPU programming. For example, suppose I have the following R code:</p>
  
  <pre><code>aaa &lt;- function(x) mean(rnorm(1000000))
  
  sapply(1:10, aaa)
  </code></pre>
  
  <p>I like that I can kind of use <code>mclapply</code> as a dropin replacement for <code>lapply</code>. Is there a way to do that for OpenCL? Or to use OpenCL as a backend for <code>mclapply</code>? I'm guessing this is not possible because I have not been able to find an example, so I have two questions:</p>
  
  <ol>
  <li>Is this possible and if so can you give a complete example using my function <code>aaa</code> above?</li>
  <li>If this is not possible, can you please explain why? I do not know much about GPU programming. I view GPU just like CPUs, so why cannot I run R code in parallel?</li>
  </ol>