]> AND Private Git Repository - kahina_paper2.git/blobdiff - code.c
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
new
[kahina_paper2.git] / code.c
diff --git a/code.c b/code.c
index d681fa0a63a4adbf805f4cc39b48121992074f84..0059fc01a347919b9bf0c65295079e55efea39d2 100644 (file)
--- a/code.c
+++ b/code.c
@@ -1,8 +1,5 @@
-
-
-
-
 //Normal version of the Ehrlich-Aberth method
+__device__
 cuDoubleComplex FirstH_EA(int i, cuDoubleComplex *Z) {
   
   cuDoubleComplex  result;
@@ -37,6 +34,7 @@ cuDoubleComplex FirstH_EA(int i, cuDoubleComplex *Z) {
 
 
 //Log Exp version of the Ehrlich-Aberth method
+__device__
 cuDoubleComplex NewH_EA(int i, cuDoubleComplex *Z) {
 
   cuDoubleComplex result;
@@ -78,19 +76,22 @@ cuDoubleComplex NewH_EA(int i, cuDoubleComplex *Z) {
 
 
 //kernels to update a root i
-cuDoubleComplex H_EA(int i, cuDoubleComplex *Z) {
-  cuDoubleComplex c;
-  //if the root needs to be updated
-  if(!finished[i]) {
-    //according to the module of the root
-    if (Cmodule(Z[i])<=maxRadius)
-      //selects the normal version
-      c = FirstH_EA(i,Z);  
-    else
-      //of the Log Exp version
-      c = NewH_EA(i,Z);
-    return c;
+__global__
+void Dev_EA(int i, cuDoubleComplex *Z, int* finished,
+           int size) {
+  int i= blockIdx.x*blockDim.x+ threadIdx.x;
+  if(i<size) {
+    //if the root needs to be updated
+    if(!finished[i]) {
+      //according to the module of the root
+      if (Cmodule(Z[i])<=maxRadius)
+       //selects the normal version
+       Z[i] = FirstH_EA(i,Z);  
+      else
+       //of the Log Exp version
+       Z[i] = NewH_EA(i,Z);
+      return c;
+    }
   }
-  else return Z[i];
 }