getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Markus Bürg
Subject: [Getfem-commits] (no subject)
Date: Tue, 28 Aug 2018 07:00:05 -0400 (EDT)

branch: mb-Parallelise_interpolation
commit f08de78cbf7469e2c405ea50840bb2201b1c5184
Author: mb <address@hidden>
Date:   Tue Aug 28 12:59:54 2018 +0200

    Parallelise interpolation on different meshes.
---
 src/getfem/getfem_interpolation.h | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/getfem/getfem_interpolation.h 
b/src/getfem/getfem_interpolation.h
index 0b98094..708db21 100644
--- a/src/getfem/getfem_interpolation.h
+++ b/src/getfem/getfem_interpolation.h
@@ -702,9 +702,31 @@ namespace getfem {
         rg_source.id() == mesh_region::all_convexes().id() &&
         rg_target.id() == mesh_region::all_convexes().id())
       interpolation_same_mesh(mf_source, mf_target, U, V, M, 0);
-    else
-      interpolation(mf_source, mf_target, U, V, M, 0, extrapolation, EPS,
-                    rg_source, rg_target);
+    else {
+      omp_distribute<VECTV> V_distributed;
+      thread_exception exception;
+      rg_source.prohibit_partitioning();
+
+      #pragma omp parallel default(shared)
+      {
+        exception.run(
+        [&] {
+          auto &V_thrd = V_distributed.thrd_cast();
+          gmm::resize(V_thrd, V.size());
+          interpolation(
+            mf_source, mf_target, U, V_thrd, M, 0, extrapolation, EPS,
+            rg_source, rg_target);
+
+          #pragma omp critical
+            for (size_type i = 0; i < V_thrd.size(); ++i) {
+              if (abs(V_thrd[i]) > EPS) V[i] = V_thrd[i];
+            }
+        });
+      }
+
+      rg_source.allow_partitioning();
+      exception.rethrow();
+    }
   }
 
   template<typename MAT>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]