Making C++ Pi approximation running in Paralell on GPU Nvidia 970M CUDA's : <p>I got this code from The Chudnovsky formula for Pi approximation and I want to do it faster and faster. But I have no experience or idea of how to deal with GPU's. How to make this code runs on GPU Nvidea 970M? It's on C++. There's some easy lib to make it? With my processor it's running about 3~4s... </p>

<pre><code>#include &lt;iostream&gt;
#include &lt;windows&gt;
#include &lt;iomanip&gt;
#include &lt;cmath&gt;

double fac(double num) {
    double result = 1.0;
    for (double i=2.0; i&lt;num; i++)
       result *= i;
    return result;
}

int main() {
    using namespace std;
    double pi=0.0;
    for (double k = 0.0; k &lt; 10.0; k++) {
        pi += (pow(-1.0,k) * fac(6.0 * k) * (13591409.0 + (545140134.0 * k)))
            / (fac(3.0 * k) * pow(fac(k), 3.0) * pow(640320.0, 3.0 * k + 3.0/2.0));
    }
    pi *= 12.0;
    cout &lt;&lt; setprecision(100000000) &lt;&lt; 1.0 / pi &lt;&lt; endl;
system("Pause");    
return 0;
}
</code></pre>
