1
I have the following method that calculates the value of PI in a serial way:
public static double CalculoPISerie()
{
double integral = 0;
double h = 1.0 / NUMERO;
for (int i = 0; i <= NUMERO; i++)
{
if (i == 0 || i == NUMERO)
integral += (4.0 / (1.0 + Math.Pow(i * h, 2)));
else
integral += (2 * ((4.0 / (1.0 + Math.Pow(i * h, 2)))));
}
return integral * h / 2;
}
I would like to do this in parallel using Geforce’s CUDA. How can I do ?
And only you use a thread
– M8n
How I do this method with threads ?
– Raphael Prado de Oliveira
have you ever installed a compiler for CUDA? Start here: http://www.nvidia.com/content/cuda/cuda-toolkit.html
– Bacco
I installed everything already. I don’t know now how to implement this method in parallel
– Raphael Prado de Oliveira
Here the documentation threads http://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__THREAD__DEPRECATED.html#group__CUDART__THREAD__DEPRECATED
– M8n
I believe that in addition to the CUDA Toolkit, you will need a wrapper to access unmanaged code from
C#
. Option of lib for this: http://kunzmi.github.io/managedCuda/– Gomiero