From 55051a207e448d6a8d5e2848ccf3ddb423c1aa6e Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Thu, 12 Jul 2018 14:32:08 +0200
Subject: [PATCH] Fix type size issue with starpu

---
 runtime/starpu/codelets/codelet_zgetrf.c        |  2 +-
 runtime/starpu/codelets/codelet_zgetrf_incpiv.c |  2 +-
 runtime/starpu/codelets/codelet_ztstrf.c        |  2 +-
 runtime/starpu/control/runtime_descriptor.c     | 17 ++++++-----------
 4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/runtime/starpu/codelets/codelet_zgetrf.c b/runtime/starpu/codelets/codelet_zgetrf.c
index 816538243..74ed2c3e6 100644
--- a/runtime/starpu/codelets/codelet_zgetrf.c
+++ b/runtime/starpu/codelets/codelet_zgetrf.c
@@ -45,7 +45,7 @@ void INSERT_TASK_zgetrf( const RUNTIME_option_t *options,
         STARPU_RW,                     RTBLKADDR(A, CHAMELEON_Complex64_t, Am, An),
         STARPU_VALUE,           &lda,                        sizeof(int),
         STARPU_VALUE,                  &IPIV,                      sizeof(int*),
-        STARPU_VALUE,    &check_info,                sizeof(int),
+        STARPU_VALUE,    &check_info,                sizeof(cham_bool_t),
         STARPU_VALUE,         &iinfo,                        sizeof(int),
         STARPU_PRIORITY,    options->priority,
         STARPU_CALLBACK,    callback,
diff --git a/runtime/starpu/codelets/codelet_zgetrf_incpiv.c b/runtime/starpu/codelets/codelet_zgetrf_incpiv.c
index e9f2232e1..4c701b35c 100644
--- a/runtime/starpu/codelets/codelet_zgetrf_incpiv.c
+++ b/runtime/starpu/codelets/codelet_zgetrf_incpiv.c
@@ -109,7 +109,7 @@ void INSERT_TASK_zgetrf_incpiv(const RUNTIME_option_t *options,
         STARPU_W,         RTBLKADDR(L, CHAMELEON_Complex64_t, Lm, Ln),
         STARPU_VALUE,    &ldl,               sizeof(int),
         STARPU_VALUE,    &IPIV,              sizeof(int*),
-        STARPU_VALUE,    &check_info,        sizeof(int),
+        STARPU_VALUE,    &check_info,        sizeof(cham_bool_t),
         STARPU_VALUE,    &iinfo,             sizeof(int),
         STARPU_SCRATCH,   options->ws_worker,
         STARPU_VALUE,    &h_work,            sizeof(CHAMELEON_starpu_ws_t *),
diff --git a/runtime/starpu/codelets/codelet_ztstrf.c b/runtime/starpu/codelets/codelet_ztstrf.c
index fd22108cf..b943c4091 100644
--- a/runtime/starpu/codelets/codelet_ztstrf.c
+++ b/runtime/starpu/codelets/codelet_ztstrf.c
@@ -128,7 +128,7 @@ void INSERT_TASK_ztstrf(const RUNTIME_option_t *options,
         STARPU_SCRATCH,   options->ws_worker,
         STARPU_VALUE,    &d_work,                    sizeof(CHAMELEON_starpu_ws_t *),
         STARPU_VALUE,    &nb,                        sizeof(int),
-        STARPU_VALUE,    &check_info,                sizeof(int),
+        STARPU_VALUE,    &check_info,                sizeof(cham_bool_t),
         STARPU_VALUE,    &iinfo,                     sizeof(int),
         STARPU_PRIORITY,  options->priority,
         STARPU_CALLBACK,  callback,
diff --git a/runtime/starpu/control/runtime_descriptor.c b/runtime/starpu/control/runtime_descriptor.c
index 60c368432..c49978d86 100644
--- a/runtime/starpu/control/runtime_descriptor.c
+++ b/runtime/starpu/control/runtime_descriptor.c
@@ -45,15 +45,13 @@ chameleon_starpu_tag_init( int user_tag_width,
         tag_width = user_tag_width;
         tag_sep   = user_tag_sep;
 
+        void *tag_ub_p = NULL;
 #if defined(HAVE_STARPU_MPI_COMM_GET_ATTR)
-        int64_t *tag_ub_p = NULL;
         starpu_mpi_comm_get_attr(MPI_COMM_WORLD, STARPU_MPI_TAG_UB, &tag_ub_p, &ok);
-        tag_ub = *tag_ub_p;
 #else
-        int *tag_ub_p = NULL;
         MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_TAG_UB, &tag_ub_p, &ok);
-        tag_ub = *tag_ub_p;
 #endif
+        tag_ub = (uintptr_t)tag_ub_p;
 
         if ( !ok ) {
             chameleon_error("RUNTIME_desc_create", "MPI_TAG_UB not known by StarPU");
@@ -235,12 +233,9 @@ void RUNTIME_desc_destroy( CHAM_desc_t *desc )
         for (n = 0; n < lnt; n++) {
             for (m = 0; m < lmt; m++)
             {
-                if (*handle == NULL)
-                {
-                    handle++;
-                    continue;
+                if (*handle != NULL) {
+                    starpu_data_unregister(*handle);
                 }
-                starpu_data_unregister(*handle);
                 handle++;
             }
         }
@@ -252,8 +247,8 @@ void RUNTIME_desc_destroy( CHAM_desc_t *desc )
             if (cudaHostUnregister(desc->mat) != cudaSuccess)
             {
                 chameleon_warning("RUNTIME_desc_destroy(StarPU)",
-                              "cudaHostUnregister failed to unregister the "
-                              "pinned memory associated to the matrix");
+                                  "cudaHostUnregister failed to unregister the "
+                                  "pinned memory associated to the matrix");
             }
         }
 #endif /* defined(CHAMELEON_USE_CUDA) */
-- 
GitLab