Commit 192eda52 authored by Antoine Jego's avatar Antoine Jego
Browse files

add delayed registration

parent 11ca6e86
......@@ -23,6 +23,7 @@ program fstarpu_example_dgemm
real(kind=c_double), allocatable :: c(:,:)
type(c_ptr) :: h = c_null_ptr
integer :: owner
integer(c_int64_t) :: tag
end type block_type
type dsmat_type
......@@ -37,6 +38,7 @@ program fstarpu_example_dgemm
logical :: prune = .false.
logical :: super_prune = .false.
logical :: prune_handles = .false.
logical :: delay = .false.
integer(c_int) :: comm_size, comm_rank
integer(c_int), target :: comm_world
......@@ -113,6 +115,8 @@ program fstarpu_example_dgemm
super_prune = .true.
case('-h')
prune_handles = .true.
case('-d')
delay = .true.
end select
end do
......@@ -134,6 +138,7 @@ program fstarpu_example_dgemm
if (super_prune) then; write(*,*) "(S)uper-pruning enabled"
else if (prune) then ; write(*,*) "(P)runing enabled"; endif
if (prune_handles) write(*,*) "(H)andles pruning enabled"
if (delay) write (*,*) "(D)elayed handle registration enabled"
write(*,'("========================================")')
end if
ret = fstarpu_mpi_barrier(comm_world)
......@@ -175,6 +180,11 @@ program fstarpu_example_dgemm
!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
if (delay) then
call block_register(A,i,l)
call block_register(B,l,j)
call block_register(C,i,j)
end if
call fstarpu_mpi_task_insert((/ c_loc(comm_world), cl_mm, &
FSTARPU_VALUE, c_loc(alpha), FSTARPU_SZ_REAL8, &
FSTARPU_VALUE, c_loc(zbeta), FSTARPU_SZ_REAL8, &
......@@ -261,14 +271,15 @@ contains
do j=1,nb
xij => x%blocks(i,j)
xij%owner = mod(i-1,p)*q + mod(j-1,q)
xij%tag = tag
if (comm_rank.eq.xij%owner) then
! write(*,*) comm_rank,"] I own ",cname,"_",i,j,"so I register it with tag",tag
allocate(xij%c(bs,bs))
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.(lrow.and.comm_row.eq.mod(i-1,p)).or.&
(lcol.and.comm_col.eq.mod(j-1,q)) ) then
else if (.not.delay.and.(.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) )
......@@ -279,6 +290,15 @@ contains
end do
end subroutine initialize_matrix
subroutine block_register(X,i,j)
type(dsmat_type), target :: x
integer :: mb, nb
if (c_associated(x%blocks(i,j)%h)) return
call fstarpu_matrix_data_register( x%blocks(i,j)%h, -1, c_null_ptr, &
x%b, x%b, x%b, c_sizeof(alpha) )
call fstarpu_mpi_data_register(x%blocks(i,j)%h, x%blocks(i,j)%tag, x%blocks(i,j)%owner)
end subroutine block_register
subroutine fill_matrix(x,mb,nb,cname)
implicit none
type(dsmat_type), target :: x
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment