From fe80ed2491f593599a62fd1fb788f6545ba4d912 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 31 Jan 2018 16:51:52 +0100
Subject: [PATCH] Add migration function

---
 include/chameleon/chameleon_config.h.in |  4 +++
 include/chameleon/morse_runtime.h       | 33 +++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/include/chameleon/chameleon_config.h.in b/include/chameleon/chameleon_config.h.in
index b2ea05211..512101346 100644
--- a/include/chameleon/chameleon_config.h.in
+++ b/include/chameleon/chameleon_config.h.in
@@ -36,6 +36,10 @@
 
 /* Communication engine */
 #cmakedefine CHAMELEON_USE_MPI
+#cmakedefine CHAMELEON_USE_MIGRATE
+#if !defined(CHAMELEON_USE_MPI) && defined(CHAMELEON_USE_MIGRATE)
+#undef CHAMELEON_USE_MIGRATE
+#endif
 
 /* GPU Support */
 #cmakedefine CHAMELEON_USE_CUDA
diff --git a/include/chameleon/morse_runtime.h b/include/chameleon/morse_runtime.h
index 76c83ce85..5f009f30a 100644
--- a/include/chameleon/morse_runtime.h
+++ b/include/chameleon/morse_runtime.h
@@ -444,6 +444,39 @@ void
 RUNTIME_data_flush( const MORSE_sequence_t *sequence,
                     const MORSE_desc_t *A, int Am, int An );
 
+/**
+ * @brief Migrate a single piece of data.
+ *
+ * This function migrate a piece of data from its original rank to the new_rank
+ * and changes its ownership.
+ *
+ * @param[in] sequence
+ *            The sequence in which the data is used.
+ *
+ * @param[in] A
+ *            The descriptor to which the piece of data belongs.
+ *
+ * @param[in] Am
+ *            The row coordinate of the piece of data in the matrix
+ *
+ * @param[in] An
+ *            The column coordinate of the piece of data in the matrix
+ *
+ * @param[in] new_rank
+ *            The new_rank on which to migrate the data
+ */
+#if defined(CHAMELEON_USE_MIGRATE)
+void
+RUNTIME_data_migrate( const MORSE_sequence_t *sequence,
+                      const MORSE_desc_t *A, int Am, int An, int new_rank );
+#else
+static inline void
+RUNTIME_data_migrate( const MORSE_sequence_t *sequence,
+                      const MORSE_desc_t *A, int Am, int An, int new_rank ) {
+    (void)sequence; (void)A; (void)Am; (void)An; (void)new_rank;
+}
+#endif
+
 /**
  * @brief Get the pointer to the data or the runtime handler associated to the
  * piece of data (m, n) in desc.
-- 
GitLab