21 integer :: m_pds_neqns
25 integer :: m_pds_neqns1
26 integer :: m_pds_neqns2
27 integer :: m_pds_neqnsd
29 real(8),
pointer :: m_pds_d(:,:)
30 type(ccls_matrix),
pointer :: m_pds_c1, m_pds_c2
31 integer,
pointer :: m_pds_part(:)
32 logical :: m_pds_isready_dc = .false.
35 integer,
parameter :: m_pds_lenv=80000000
36 real(8),
pointer :: m_pds_v(:)
37 logical :: m_pds_isready_v = .false.
59 character(132),
parameter::
version=
'sp_LINEQ: $Revision: 1.2 $ $Date: 2007/11/21 02:13:45 $'
62 type (sp_matrix) :: sp_mat
75 else if (istrunk)
then
99 character(132),
parameter :: version=
'sp_direct_root: $Revision: 1.2 $ $Date: 2007/11/21 02:13:45 $'
104 type (sp_matrix) :: sp_mat
110 type (irjc_matrix),
target :: a0
111 real(8),
allocatable,
dimension(:) :: r
114 integer :: nprof, nprof2
119 integer,
allocatable,
dimension(:) :: iperm
122 type (irjc_matrix) :: a1, a2
123 type (ccls_matrix),
target :: c1, c2
126 real(8),
allocatable,
dimension(:,:) :: d1, d2
131 integer :: i,j,k,l,m,n
134 integer,
dimension(MPI_STATUS_SIZE) :: istatus
138 logical,
parameter :: elap=.true.
139 real(8) :: t00s, t00e
140 real(8) :: t10s, t10e
141 real(8) :: t20s, t20e, t21s, t21e
142 real(8) :: t30s, t30e, t31s, t31e
143 real(8) :: t40s, t40e
144 real(8) :: t50s, t50e
145 real(8) :: t60s, t60e
148 integer,
allocatable,
dimension(:),
target :: part
149 real(8),
allocatable,
dimension(:,:),
target :: d
150 integer :: neqns1, neqns2, neqnsd, nd
151 real(8),
allocatable,
dimension(:) :: oldb
159 call elapout(
'sp_direct_root: begin')
170 nprof=sp_mat%ipoi(sp_mat%ncol+1)-1
171 nprof2=nprof/2+a0%neqns
172 allocate(a0%irow(nprof/2+a0%neqns),a0%jcol(nprof/2+a0%neqns),a0%val(nndeg,nprof/2+a0%neqns))
178 a0%val(1:nndeg,ll)=sp_mat%d(jj,1:nndeg)
181 ii=sp_mat%irowno(loc)
187 a0%val(1:nndeg,ll)=sp_mat%elm(loc,1:nndeg)
195 allocate(r(a0%neqns*ndeg))
198 r(ndeg*(i-1)+j)=sp_mat%b(j,i)
203 call elapout(
'sp_direct_root: get matrix information done ')
208 call elapout(
'sp_direct_root: begin divide matrix ')
211 allocate(part(a0%neqns))
212 allocate(iperm(a0%neqns))
215 call mkpart(a0%neqns, a0%nttbr, ndeg, a0%irow, a0%jcol, neqns1, neqns2, neqnsd, part, iperm)
221 call divmat(a0, part, iperm, neqns1, neqns2, neqnsd, ndeg, a1, a2, c1, c2, d)
223 call elapout(
'sp_direct_root: end divide matrix')
233 call elapout(
'sp_direct_root: begin send a1 ')
235 call mpi_send(a1%neqns, 1, mpi_integer,ip1,1,mpi_comm_world,ierr)
236 call mpi_send(a1%nttbr, 1, mpi_integer,ip1,1,mpi_comm_world,ierr)
237 call mpi_send(a1%ndeg, 1, mpi_integer,ip1,1,mpi_comm_world,ierr)
239 call mpi_send(a1%irow, a1%nttbr, mpi_integer, ip1,1,mpi_comm_world,ierr)
240 call mpi_send(a1%jcol, a1%nttbr, mpi_integer, ip1,1,mpi_comm_world,ierr)
241 call mpi_send(a1%val, a1%nttbr*nndeg, mpi_real8, ip1,1,mpi_comm_world,ierr)
242 call elapout(
'sp_direct_root: end send a1 ')
244 call elapout(
'sp_direct_root: begin send a2 ')
246 call mpi_send(a2%neqns, 1, mpi_integer,ip2,1,mpi_comm_world,ierr)
247 call mpi_send(a2%nttbr, 1, mpi_integer,ip2,1,mpi_comm_world,ierr)
248 call mpi_send(a2%ndeg, 1, mpi_integer,ip2,1,mpi_comm_world,ierr)
250 call mpi_send(a2%irow, a2%nttbr, mpi_integer, ip2,1,mpi_comm_world,ierr)
251 call mpi_send(a2%jcol, a2%nttbr, mpi_integer, ip2,1,mpi_comm_world,ierr)
252 call mpi_send(a2%val, a2%nttbr*nndeg, mpi_real8, ip2,1,mpi_comm_world,ierr)
253 call elapout(
'sp_direct_root: end send a2 ')
266 call elapout(
'sp_direct_root: begin send c1 ')
267 call mpi_send(c1%neqns, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
268 call mpi_send(c1%ncol, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
269 call mpi_send(c1%nttbr, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
270 call mpi_send(c1%ndeg, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
271 call mpi_send(c1%ia, c1%ncol+1, mpi_integer, ip1,1,mpi_comm_world,ierr)
272 call mpi_send(c1%ja, c1%nttbr, mpi_integer, ip1,1,mpi_comm_world,ierr)
273 call mpi_send(c1%val, c1%nttbr*nndeg, mpi_real8, ip1,1,mpi_comm_world,ierr)
274 call elapout(
'sp_direct_root: end send c1 ')
276 call elapout(
'sp_direct_root: begin send c2')
277 call mpi_send(c2%neqns, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
278 call mpi_send(c2%ncol, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
279 call mpi_send(c2%nttbr, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
280 call mpi_send(c2%ndeg, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
281 call mpi_send(c2%ia, c2%ncol+1, mpi_integer, ip2,1,mpi_comm_world,ierr)
282 call mpi_send(c2%ja, c2%nttbr, mpi_integer, ip2,1,mpi_comm_world,ierr)
283 call mpi_send(c2%val, c2%nttbr*nndeg, mpi_real8, ip2,1,mpi_comm_world,ierr)
284 call elapout(
'sp_direct_root: end send c2')
286 allocate(d1(nd,nd), d2(nd,nd))
290 call elapout(
'sp_direct_root: wait until receive D1, D2')
291 call mpi_recv(d1, nd*nd, mpi_real8, ip1, 1,mpi_comm_world, istatus, ierr)
292 call mpi_recv(d2, nd*nd, mpi_real8, ip2, 1,mpi_comm_world, istatus, ierr)
293 call elapout(
'sp_direct_root: receive d1, d2 from children')
296 call elapout(
'sp_direct_root: modify D and LDU decompose it.')
303 call elapout(
'sp_direct_root: LDU decompose for denssol done.')
306 m_pds_neqns = a0%neqns
308 m_pds_neqns1 = neqns1
309 m_pds_neqns2 = neqns2
310 m_pds_neqnsd = neqnsd
317 m_pds_isready_dc=.true.
329 allocate(oldb(a0%neqns*ndeg))
331 call elapout(
'sp_direct_root: entering trunksolve')
333 call elapout(
'sp_direct_root: end trunksolve')
335 call verif0(a0%neqns, a0%ndeg, a0%nttbr, a0%irow, a0%jcol, a0%val, oldb, r)
340 sp_mat%x(j,i)=r(ndeg*(i-1)+j)
346 call elapout(
'sp_direct_root: send stop flag to children')
348 call mpi_send(do_calc, 1, mpi_logical, ip1,1,mpi_comm_world,ierr)
349 call mpi_send(do_calc, 1, mpi_logical, ip2,1,mpi_comm_world,ierr)
351 call elapout(
'sp_direct_root: end')
375 character(132),
parameter :: version=
'sp_direct_trunk: $Revision: 1.2 $ $Date: 2007/11/21 02:13:45 $'
382 type (irjc_matrix),
target :: a0
387 integer,
allocatable,
dimension(:) :: iperm
390 type (irjc_matrix) :: a1, a2
391 type (ccls_matrix),
target :: c1, c2
394 real(8),
allocatable,
dimension(:,:) :: d1, d2
399 integer :: i,j,k,l,m,n
402 integer,
dimension(MPI_STATUS_SIZE) :: istatus
405 logical,
parameter :: elap=.true.
406 real(8) :: t00s, t00e
407 real(8) :: t10s, t10e
408 real(8) :: t20s, t20e, t21s, t21e
409 real(8) :: t30s, t30e, t31s, t31e
410 real(8) :: t40s, t40e
411 real(8) :: t50s, t50e
412 real(8) :: t60s, t60e
415 integer,
allocatable,
dimension(:),
target :: part
416 real(8),
allocatable,
dimension(:,:),
target :: d
417 integer :: neqns1, neqns2, neqnsd, nd
424 call elapout(
'sp_direct_trunk: begin')
425 call elapout(
'sp_direct_trunk: waiting matrix via MPI')
427 call mpi_recv(a0%neqns, 1,mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
428 call mpi_recv(a0%nttbr, 1,mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
429 call mpi_recv(a0%ndeg, 1,mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
430 allocate(a0%irow(a0%nttbr))
431 allocate(a0%jcol(a0%nttbr))
432 allocate(a0%val(a0%ndeg*a0%ndeg,a0%nttbr))
434 call elapout(
'sp_direct_trunk: begen get matrix via MPI')
435 call mpi_recv(a0%irow, a0%nttbr, mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
436 call mpi_recv(a0%jcol, a0%nttbr, mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
437 call mpi_recv(a0%val, a0%nttbr*a0%ndeg*a0%ndeg, mpi_real8,imp,1,mpi_comm_world,istatus,ierr)
439 call elapout(
'sp_direct_trunk: end get matrix via MPI')
448 call elapout(
'sp_direct_trunk: begin divide matrix')
450 allocate(part(a0%neqns))
451 allocate(iperm(a0%neqns))
454 call mkpart(a0%neqns, a0%nttbr, ndeg, a0%irow, a0%jcol, neqns1, neqns2, neqnsd, part, iperm)
460 call divmat(a0, part, iperm, neqns1, neqns2, neqnsd, ndeg, a1, a2, c1, c2, d)
461 call elapout(
'sp_direct_trunk: end divide matrix')
469 call elapout(
'sp_direct_trunk: begin send a1 ')
471 call mpi_send(a1%neqns, 1, mpi_integer,ip1,1,mpi_comm_world,ierr)
472 call mpi_send(a1%nttbr, 1, mpi_integer,ip1,1,mpi_comm_world,ierr)
473 call mpi_send(a1%ndeg, 1, mpi_integer,ip1,1,mpi_comm_world,ierr)
475 call mpi_send(a1%irow, a1%nttbr, mpi_integer, ip1,1,mpi_comm_world,ierr)
476 call mpi_send(a1%jcol, a1%nttbr, mpi_integer, ip1,1,mpi_comm_world,ierr)
477 call mpi_send(a1%val, a1%nttbr*nndeg, mpi_real8, ip1,1,mpi_comm_world,ierr)
478 call elapout(
'sp_direct_trunk: end send a1 ')
480 call elapout(
'sp_direct_trunk: begin send a2 ')
482 call mpi_send(a2%neqns, 1, mpi_integer,ip2,1,mpi_comm_world,ierr)
483 call mpi_send(a2%nttbr, 1, mpi_integer,ip2,1,mpi_comm_world,ierr)
484 call mpi_send(a2%ndeg, 1, mpi_integer,ip2,1,mpi_comm_world,ierr)
486 call mpi_send(a2%irow, a2%nttbr, mpi_integer, ip2,1,mpi_comm_world,ierr)
487 call mpi_send(a2%jcol, a2%nttbr, mpi_integer, ip2,1,mpi_comm_world,ierr)
488 call mpi_send(a2%val, a2%nttbr*nndeg, mpi_real8, ip2,1,mpi_comm_world,ierr)
489 call elapout(
'sp_direct_trunk: end send a2')
500 call elapout(
'sp_direct_trunk: send c1')
501 call mpi_send(c1%neqns, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
502 call mpi_send(c1%ncol, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
503 call mpi_send(c1%nttbr, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
504 call mpi_send(c1%ndeg, 1, mpi_integer, ip1,1,mpi_comm_world,ierr)
505 call mpi_send(c1%ia, c1%ncol+1, mpi_integer, ip1,1,mpi_comm_world,ierr)
506 call mpi_send(c1%ja, c1%nttbr, mpi_integer, ip1,1,mpi_comm_world,ierr)
507 call mpi_send(c1%val, c1%nttbr*nndeg, mpi_real8, ip1,1,mpi_comm_world,ierr)
509 call elapout(
'sp_direct_trunk: send c2')
510 call mpi_send(c2%neqns, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
511 call mpi_send(c2%ncol, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
512 call mpi_send(c2%nttbr, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
513 call mpi_send(c2%ndeg, 1, mpi_integer, ip2,1,mpi_comm_world,ierr)
514 call mpi_send(c2%ia, c2%ncol+1, mpi_integer, ip2,1,mpi_comm_world,ierr)
515 call mpi_send(c2%ja, c2%nttbr, mpi_integer, ip2,1,mpi_comm_world,ierr)
516 call mpi_send(c2%val, c2%nttbr*nndeg, mpi_real8, ip2,1,mpi_comm_world,ierr)
518 allocate(d1(nd,nd), d2(nd,nd))
522 call elapout(
'sp_direct_trunk: wait until receive D1, D2')
523 call mpi_recv(d1, nd*nd, mpi_real8, ip1, 1,mpi_comm_world, istatus, ierr)
524 call mpi_recv(d2, nd*nd, mpi_real8, ip2, 1,mpi_comm_world, istatus, ierr)
525 call elapout(
'sp_direct_trunk: receive d1, d2 from children')
528 call elapout(
'sp_direct_trunk: modify D and LDU decompose it.')
535 call elapout(
'sp_direct_trunk: LDU decompose for denssol done.')
538 m_pds_neqns = a0%neqns
540 m_pds_neqns1 = neqns1
541 m_pds_neqns2 = neqns2
542 m_pds_neqnsd = neqnsd
549 m_pds_isready_dc=.true.
556 call elapout(
'sp_direct_trunk: begin calcCtAC()')
558 call elapout(
'sp_direct_trunk: end calcCtAC()')
565 call elapout(
'sp_direct_trunk: begin recsolve()')
567 call elapout(
'sp_direct_trunk: end recsolve()')
586 type (irjc_matrix) :: a
589 integer,
dimension(MPI_STATUS_SIZE) :: istatus
596 real(8) :: t00s, t00e
597 real(8) :: t10s, t10e
598 real(8) :: t20s, t20e, t21s, t21e
599 real(8) :: t30s, t30e, t31s, t31e
600 real(8) :: t40s, t40e
601 real(8) :: t50s, t50e
602 real(8) :: t60s, t60e
609 call elapout(
'sp_direct_leaf: begin')
610 call elapout(
'sp_direct_leaf: waiting matrix via MPI')
612 call mpi_recv(a%neqns, 1,mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
613 call mpi_recv(a%nttbr, 1,mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
614 call mpi_recv(a%ndeg, 1,mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
615 allocate(a%irow(a%nttbr))
616 allocate(a%jcol(a%nttbr))
617 allocate(a%val(a%ndeg*a%ndeg,a%nttbr))
619 call elapout(
'sp_direct_leaf: begin receive matrix')
621 call mpi_recv(a%irow, a%nttbr, mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
622 call mpi_recv(a%jcol, a%nttbr, mpi_integer,imp,1,mpi_comm_world,istatus,ierr)
623 call mpi_recv(a%val, a%nttbr*a%ndeg*a%ndeg, mpi_real8,imp,1,mpi_comm_world,istatus,ierr)
625 call elapout(
'sp_direct_leaf: end get matrix via MPI')
633 allocate(m_pds_v(m_pds_lenv))
635 call elapout(
'sp_direct_leaf: begin matini()')
636 call matini(a%neqns, a%nttbr, a%irow, a%jcol, m_pds_lenv, m_pds_v, ierr)
637 if (ierr .ne. 0)
call errtrp(
'sp_direct_leaf: matini')
638 call elapout(
'sp_direct_leaf: end matini()')
640 call elapout(
'sp_direct_leaf: begin staij1()')
642 call staij1(0, a%irow(i), a%jcol(i), a%val(1,i), m_pds_v, a%ndeg, ierr)
643 if (ierr .ne. 0)
call errtrp(
'sp_direct_leaf: staij1')
645 call elapout(
'sp_direct_leaf: end staij1()')
647 call elapout(
'sp_direct_leaf: begin nufct0()')
648 call nufct0(m_pds_v, ierr)
649 if (ierr .ne. 0)
call errtrp(
'sp_direct_leaf: nufct0')
650 call elapout(
'sp_direct_leaf: end nufct0()')
653 m_pds_neqns = a%neqns
655 m_pds_isready_v=.true.
663 call elapout(
'sp_direct_leaf: entering calcCtAC')
667 call elapout(
'sp_direct_leaf: exit calcCtAC')
674 call elapout(
'sp_direct_leaf: entering recsolve')
678 call elapout(
'sp_direct_leaf: exit recsolve')
705 real(8),
dimension(m_pds_ndeg*m_pds_neqns) :: b
709 integer,
dimension(MPI_STATUS_SIZE) :: istatus
714 call mpi_recv(do_calc, 1, mpi_logical, imp, 1,mpi_comm_world, istatus, ierr)
715 if (.false.==do_calc)
then
716 if (.true. == istrunk)
then
718 call mpi_send(do_calc, 1, mpi_logical, ip1,1,mpi_comm_world,ierr)
719 call mpi_send(do_calc, 1, mpi_logical, ip2,1,mpi_comm_world,ierr)
729 call mpi_recv(b, m_pds_ndeg*m_pds_neqns, mpi_real8, imp, 1,mpi_comm_world, istatus, ierr)
731 if (.true. == istrunk)
then
733 else if(.true. == isleaf)
then
736 call errtrp(
'recsolve: never come here')
738 call mpi_send(b, m_pds_ndeg*m_pds_neqns, mpi_real8, imp, 1,mpi_comm_world, ierr)
747 subroutine trunksolve(b)
764 real(8),
dimension(:),
intent(inout) :: b
767 real(8),
allocatable,
dimension(:) :: b1, x1, v1, w1, xab1, vtmp1
768 real(8),
allocatable,
dimension(:) :: b2, x2, v2, w2, xab2, vtmp2
769 real(8),
allocatable,
dimension(:) :: bd, xd
770 type (ccls_matrix) :: c1, c2
772 integer :: neqns, ndeg, neqns1, neqns2, neqnsd, nd
776 integer :: i,j,k,l,m,n
779 integer,
dimension(MPI_STATUS_SIZE) :: istatus
784 if (.false.==m_pds_isready_dc)
then
785 call errtrp(
'trunksolve is not ready.')
791 neqns1 = m_pds_neqns1
792 neqns2 = m_pds_neqns2
793 neqnsd = m_pds_neqnsd
799 allocate(b1(neqns1*ndeg), x1(neqns1*ndeg), v1(neqns1*ndeg), w1(neqns1*ndeg), xab1(neqns1*ndeg), vtmp1(neqns1*ndeg))
800 allocate(b2(neqns2*ndeg), x2(neqns2*ndeg), v2(neqns2*ndeg), w2(neqns2*ndeg), xab2(neqns2*ndeg), vtmp2(neqns2*ndeg))
801 allocate(bd(nd), xd(nd))
810 call divvec(neqns, ndeg, m_pds_part, b, b1, b2, bd)
815 call mpi_send(do_calc, 1, mpi_logical, ip1,1,mpi_comm_world,ierr)
816 call mpi_send(do_calc, 1, mpi_logical, ip2,1,mpi_comm_world,ierr)
818 call mpi_send(b1, ndeg*neqns1, mpi_real8, ip1,1,mpi_comm_world,ierr)
819 call mpi_send(b2, ndeg*neqns2, mpi_real8, ip2,1,mpi_comm_world,ierr)
821 call mpi_recv(xab1, ndeg*neqns1, mpi_real8, ip1, 1,mpi_comm_world, istatus, ierr)
822 call mpi_recv(xab2, ndeg*neqns2, mpi_real8, ip2, 1,mpi_comm_world, istatus, ierr)
827 bd(k) = bd(k) -(vtmp1(i) * xab1(i))
831 bd(k) = bd(k) -(vtmp2(i) * xab2(i))
842 call denssolve(m_pds_d, nd, bd)
855 v1(i) = v1(i) + vtmp1(i)*xd(k)
863 v2(i) = v2(i) + vtmp2(i)*xd(k)
872 call mpi_send(do_calc, 1, mpi_logical, ip1,1,mpi_comm_world,ierr)
873 call mpi_send(do_calc, 1, mpi_logical, ip2,1,mpi_comm_world,ierr)
875 call mpi_send(v1, ndeg*neqns1, mpi_real8, ip1,1,mpi_comm_world,ierr)
876 call mpi_send(v2, ndeg*neqns2, mpi_real8, ip2,1,mpi_comm_world,ierr)
878 call mpi_recv(w1, ndeg*neqns1, mpi_real8, ip1, 1,mpi_comm_world, istatus, ierr)
879 call mpi_recv(w2, ndeg*neqns2, mpi_real8, ip2, 1,mpi_comm_world, istatus, ierr)
894 call reovec(neqns, ndeg, m_pds_part, b, x1, x2, xd)
898 end subroutine trunksolve
907 real(8),
dimension(:),
intent(inout) :: b
912 if (.false.==m_pds_isready_v)
then
913 call errtrp(
'leafsolve is not ready.')
916 call nusol0(b, m_pds_v, ierr)
917 if (ierr .ne. 0)
call errtrp(
'leafsolve: nusol0')
925 subroutine calcctac()
934 type (ccls_matrix) :: pc
935 real(8),
allocatable,
dimension(:,:) :: pd
938 real(8),
allocatable,
dimension(:) :: vtmp, vpc
939 integer :: ndeg, nndeg
940 integer :: jcol, iofset, idx
944 integer,
dimension(MPI_STATUS_SIZE) :: istatus
948 real(8) :: t10s, t10e, t20s, t20e, t30s, t30e
953 call elapout(
'calcCtAC: waiting c matrix via MPI')
954 call mpi_recv(pc%neqns, 1, mpi_integer, imp, 1,mpi_comm_world, istatus, ierr)
955 call mpi_recv(pc%ncol, 1, mpi_integer, imp, 1,mpi_comm_world, istatus, ierr)
956 call mpi_recv(pc%nttbr, 1, mpi_integer, imp, 1,mpi_comm_world, istatus, ierr)
957 call mpi_recv(pc%ndeg, 1, mpi_integer, imp, 1,mpi_comm_world, istatus, ierr)
963 call elapout(
'calcCtAC: begin receive C matrix')
965 call mpi_recv(pc%ia, pc%ncol+1, mpi_integer, imp, 1,mpi_comm_world, istatus, ierr)
966 call mpi_recv(pc%ja, pc%nttbr, mpi_integer, imp, 1,mpi_comm_world, istatus, ierr)
967 call mpi_recv(pc%val, pc%nttbr*nndeg, mpi_real8, imp, 1,mpi_comm_world, istatus, ierr)
969 call elapout(
'calcCtAC: end receive C matrix')
971 allocate(vtmp(pc%neqns*pc%ndeg))
972 allocate(vpc(pc%neqns*pc%ndeg))
973 allocate(pd(npd,npd))
977 call elapout(
'calcCtAC: start solve CtAC')
985 if (.true. == istrunk)
then
986 call trunksolve(vtmp)
987 else if(.true. == isleaf)
then
990 call errtrp(
'calcCtAC: never come here')
996 jcol = (j+ndeg-1) / ndeg
997 iofset = mod(j+ndeg-1, ndeg)
998 do k=pc%ia(jcol),pc%ia(jcol+1)-1
1001 pd(j,i)=pd(j,i)+pc%val(ndeg*iofset + l,k) * vtmp(ndeg*(idx-1)+l)
1010 call elapout(
'calcCtAC: end solve CtAC')
1012 call elapout(
'calcCtAC: start send CtAC')
1014 call mpi_send(pd, npd*npd, mpi_real8, imp, 1,mpi_comm_world, ierr)
1016 deallocate(vtmp,pd,vpc)
1017 call elapout(
'calcCtAC: end send CtAC')
1032 subroutine mkpart(neqns, nttbr, ndeg, irow, jcol, neqns1, neqns2, neqnsd, part, iperm)
1041 integer,
intent(in) :: neqns, nttbr, ndeg
1042 integer,
dimension(:),
intent(in) :: irow
1043 integer,
dimension(:),
intent(in) :: jcol
1045 integer,
intent(out) :: neqns1, neqns2
1046 integer,
intent(out) :: neqnsd
1047 integer,
dimension(:),
intent(out) :: part
1048 integer,
dimension(:),
intent(out) :: iperm
1050 integer :: ipart1(neqns),ipart2(neqns),isp(neqns)
1051 integer :: loc1, loc2, loc3
1052 integer :: i,j,k,l,m,n
1071 if(part(i).eq.1)
then
1075 if(part(i).eq.2)
then
1079 if(part(i).eq.3)
then
1091 subroutine divmat(a0, part, iperm, neqns1, neqns2, neqnsd, ndeg, a1, a2, c1, c2, d)
1107 type (irjc_matrix),
intent(in) :: a0
1108 integer,
dimension(:),
intent(in) :: part
1109 integer,
dimension(:),
intent(in) :: iperm
1110 integer,
intent(in) :: neqns1
1111 integer,
intent(in) :: neqns2
1112 integer,
intent(in) :: neqnsd
1113 integer,
intent(in) :: ndeg
1115 type (irjc_matrix),
intent(out) :: a1, a2
1116 type (ccls_matrix),
intent(out) :: c1, c2
1117 real(8),
dimension(:,:),
intent(out) :: d
1120 integer,
allocatable :: jstat1(:), irpt1(:), irowno1(:)
1121 integer,
allocatable :: jstat2(:), irpt2(:), irowno2(:)
1122 integer :: nttbr1, nttbr2, ntt1, ntt2
1124 integer :: ipass, nndeg
1125 integer :: i,j,k,l,m,n
1129 allocate(jstat1(neqnsd), jstat2(neqnsd))
1130 allocate(irpt1(a0%nttbr), irpt2(a0%nttbr))
1131 allocate(irowno1(a0%nttbr), irowno2(a0%nttbr))
1152 if(part(i).eq.1.and.part(j).eq.1)
then
1155 a1%irow(nttbr1)=iperm(i)
1156 a1%jcol(nttbr1)=iperm(j)
1158 a1%val(k,nttbr1)=a0%val(k,l)
1163 if(part(i).eq.2.and.part(j).eq.2)
then
1166 a2%irow(nttbr2)=iperm(i)
1167 a2%jcol(nttbr2)=iperm(j)
1169 a2%val(k,nttbr2)=a0%val(k,l)
1174 if(part(i).eq.1.and.part(j).eq.3)
then
1176 call reserv(iperm(i),iperm(j),jstat1,irpt1,irowno1,ntt1)
1179 call stval(c1,iperm(i),iperm(j),a0%val(1,l),0)
1183 if(part(i).eq.2.and.part(j).eq.3)
then
1185 call reserv(iperm(i),iperm(j),jstat2,irpt2,irowno2,ntt2)
1188 call stval(c2,iperm(i),iperm(j),a0%val(1,l),0)
1192 if(part(i).eq.3.and.part(j).eq.1)
then
1194 call reserv(iperm(j),iperm(i),jstat1,irpt1,irowno1,ntt1)
1197 call stval(c1,iperm(j),iperm(i),a0%val(1,l),1)
1201 if(part(i).eq.3.and.part(j).eq.2)
then
1203 call reserv(iperm(j),iperm(i),jstat2,irpt2,irowno2,ntt2)
1206 call stval(c2,iperm(j),iperm(i),a0%val(1,l),1)
1210 if(part(i).eq.3.and.part(j).eq.3)
then
1214 d(ndeg*(iperm(i)-1)+k,ndeg*(iperm(j)-1)+m)=a0%val(ndeg*(m-1)+k,l)
1216 d(ndeg*(iperm(j)-1)+k,ndeg*(iperm(i)-1)+m)=a0%val(ndeg*(k-1)+m,l)
1223 if(part(i).eq.1.and.part(j).eq.2)
then
1224 write(20,*)
"divmat: wrong",i,j
1227 if(part(i).eq.2.and.part(j).eq.1)
then
1228 write(20,*)
"divmat: wrong",i,j
1242 allocate(a1%irow(nttbr1), a1%jcol(nttbr1), a1%val(ndeg*ndeg,nttbr1))
1243 allocate(a2%irow(nttbr2), a2%jcol(nttbr2), a2%val(ndeg*ndeg,nttbr2))
1249 allocate(c1%ia(c1%ncol+1))
1250 allocate(c1%ja(c1%nttbr))
1251 allocate(c1%val(ndeg*ndeg,c1%nttbr))
1257 allocate(c2%ia(c2%ncol+1))
1258 allocate(c2%ja(c2%nttbr))
1259 allocate(c2%val(ndeg*ndeg,c2%nttbr))
1265 call stiajac(c1,jstat1,irpt1,irowno1)
1266 call stiajac(c2,jstat2,irpt2,irowno2)
1267 deallocate(jstat1,irpt1,irowno1)
1268 deallocate(jstat2,irpt2,irowno2)
1277 end subroutine divmat
1282 subroutine divvec(neqns, ndeg, part, r, r1, r2, rd)
1286 integer,
intent(in) :: neqns, ndeg
1287 real(8),
dimension(:),
intent(in) :: r
1288 integer,
dimension(:),
intent(in) :: part
1290 real(8),
dimension(:),
intent(out) :: r1
1291 real(8),
dimension(:),
intent(out) :: r2
1292 real(8),
dimension(:),
intent(out) :: rd
1294 integer :: idx1, idx2, idxd, idxr
1302 if(part(i).eq.1)
then
1303 r1(idx1:idx1+ndeg-1)=r(idxr:idxr+ndeg-1)
1307 if(part(i).eq.2)
then
1308 r2(idx2:idx2+ndeg-1)=r(idxr:idxr+ndeg-1)
1312 if(part(i).eq.3)
then
1313 rd(idxd:idxd+ndeg-1)=r(idxr:idxr+ndeg-1)
1324 subroutine reovec(neqns, ndeg, part, r, r1, r2, rd)
1328 integer,
intent(in) :: neqns, ndeg
1329 integer,
dimension(:),
intent(in) :: part
1330 real(8),
dimension(:),
intent(in) :: r1
1331 real(8),
dimension(:),
intent(in) :: r2
1332 real(8),
dimension(:),
intent(in) :: rd
1334 real(8),
dimension(:),
intent(out) :: r
1336 integer :: idx1, idx2, idxd, idxr
1345 if(part(i).eq.1)
then
1346 r(idxr:idxr+ndeg-1)=r1(idx1:idx1+ndeg-1)
1350 if(part(i).eq.2)
then
1351 r(idxr:idxr+ndeg-1)=r2(idx2:idx2+ndeg-1)
1355 if(part(i).eq.3)
then
1356 r(idxr:idxr+ndeg-1)=rd(idxd:idxd+ndeg-1)
1362 end subroutine reovec
1366 subroutine densldu(a,n)
1391 integer :: i,j,k,l,m,n
1392 real(8),
dimension(n,n) :: a
1403 a(1,j) = a(1,j)/a(1,1)
1408 a(i,i) = a(i,i) - a(i,k)*a(k,i)
1413 a(j,i)=a(j,i)-a(j,k)*a(k,i)
1417 a(i,j)=a(i,j)-a(i,k)*a(k,j)
1419 a(i,j) = a(i,j)/a(i,i)
1426 a(i,j) = a(i,j)/a(j,j)
1438 end subroutine densldu
1443 subroutine denssolve(a,ndim,r)
1448 real(8),
dimension(:,:) :: a
1449 real(8),
dimension(:) :: r
1454 integer :: i,j,k,l,m,n
1459 r(i)=r(i)-a(i,j)*r(j)
1471 r(i)=r(i)-a(i,j)*r(j)
1475 end subroutine denssolve
1491 call mpi_comm_size(mpi_comm_world, npe, ierr)
1492 call mpi_comm_rank(mpi_comm_world, myid, ierr)
1494 if ((mod(npe,2)==0) .and. (myid == npe-1))
then
1510 if (myid*2+1 < npe-1)
then
1524 subroutine errtrp(mes)
1526 write(6,*)
'Error in : process ', myid
1531 end subroutine errtrp