From 11ca6e86325e3bf198bbec9b9d9de5adbaece1cc Mon Sep 17 00:00:00 2001
From: Antoine JEGO <antoine.jego@etu.enseeiht.fr>
Date: Mon, 29 Nov 2021 19:47:53 +0100
Subject: [PATCH] fixed initialization

---
 fstarpu_example_dgemm.f90 | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/fstarpu_example_dgemm.f90 b/fstarpu_example_dgemm.f90
index bcdba45..ec586f9 100644
--- a/fstarpu_example_dgemm.f90
+++ b/fstarpu_example_dgemm.f90
@@ -145,9 +145,9 @@ program fstarpu_example_dgemm
 
   do trial=1,t
      ! allocate matrices
-     call initialize_matrix(a,mb,kb,"A",.true. ,.false.)
-     call initialize_matrix(b,kb,nb,"B",.false.,.true.)
-     call initialize_matrix(c,mb,nb,"C",.true. ,.true.)
+     call initialize_matrix(A,mb,kb,"A",.true. ,.false.)
+     call initialize_matrix(B,kb,nb,"B",.false.,.true.)
+     call initialize_matrix(C,mb,nb,"C",.true. ,.true.)
      ret = fstarpu_mpi_barrier(comm_world)
 
      call fill_matrix(A, mb,kb,"A")
@@ -166,6 +166,13 @@ program fstarpu_example_dgemm
            C_local = C%blocks(i,j)%owner == comm_rank
            if ( (.not.super_prune.or.(C_local.or.l<=q.or.l<=p)).and.&
                 (.not.prune.or.(A_local.or.B_local.or.C_local))) then
+ !if (c_local) then;  write(*,*) "executing",i,j,l,"with A",c_associated(A%blocks(i,l)%h),&
+ !                                    "with B",c_associated(B%blocks(l,j)%h),&
+ !                                    "with C",c_associated(C%blocks(i,j)%h)
+ !else;       write(*,*) "inserting",i,j,l,"with A",c_associated(A%blocks(i,l)%h),&
+ !                                    "with B",c_associated(B%blocks(l,j)%h),&
+ !                                    "with C",c_associated(C%blocks(i,j)%h)
+ !endif
              ! if (comm_rank.eq.0) write(*,*) "GEMM", b_col,b_row,b_aisle
              if (l.eq.1) then; zbeta = beta; else; zbeta = 1.0d0; end if
              call fstarpu_mpi_task_insert((/ c_loc(comm_world), cl_mm, &
@@ -175,6 +182,8 @@ program fstarpu_example_dgemm
                   FSTARPU_R,  B%blocks(l,j)%h,                         &
                   FSTARPU_RW, C%blocks(i,j)%h,                         &
                   c_null_ptr /))
+           else
+              !could write something 
            end if
          end do
        end do
@@ -245,6 +254,7 @@ contains
     x%n = nb*bs
     x%b = bs
     allocate(x%blocks(mb,nb))
+    ! comm_rank = q*comm_row + comm_col
     comm_col = mod(comm_rank, q)
     comm_row = (comm_rank - comm_col)/q
     do i=1,mb
@@ -257,9 +267,9 @@ contains
              call fstarpu_matrix_data_register( xij%h, 0, c_loc( xij%c(1,1) ), &
                   bs, bs, bs, c_sizeof(xij%c(1,1)) )
              call fstarpu_mpi_data_register(xij%h, tag, xij%owner)
-          else if (.not.prune_handles.or.(prune_row.and.comm_row.eq.mod(i,p)).or.&
-                                         (prune_col.and.comm_col.eq.mod(j,q)) ) then 
-             ! write(*,*) comm_rank,"] ",xij%owner," owns ",cname,"_",i,j,"so it registers it with tag",tag  
+          else if (.not.prune_handles.or.(lrow.and.comm_row.eq.mod(i-1,p)).or.&
+                                         (lcol.and.comm_col.eq.mod(j-1,q)) ) then 
+          !   write(*,*) comm_rank,"] ",xij%owner," owns ",cname,"_",i,j,"so it registers it with tag",tag  
              call fstarpu_matrix_data_register( xij%h, -1, c_null_ptr, &
                   bs, bs, bs, c_sizeof(alpha) )
              call fstarpu_mpi_data_register(xij%h, tag, xij%owner)
-- 
GitLab