root / synthbench / euroben-dm / mod2g / .svn / text-base / gtrans.f.svn-base @ 0:839f52ef7657
History | View | Annotate | Download (1.9 kB)
1 |
Subroutine gtrans( a, at, n1, n2, size1, size2, ctime ) |
---|---|
2 |
! ---------------------------------------------------------------------- |
3 |
! --- 'gtrans' does a global transpose of array 'a' and puts it in |
4 |
! array 'at'. |
5 |
! ---------------------------------------------------------------------- |
6 |
Use numerics |
7 |
Use dist_module ! Contains # of proc.s & proc. no.s |
8 |
Implicit None |
9 |
Include 'mpif.h' |
10 |
|
11 |
Integer :: n1, n2, size1, size2 |
12 |
Real(l_) :: a(n1,size2), at(n2,size1) |
13 |
Real(l_) :: ctime |
14 |
|
15 |
Real(l_) :: wrk(size2,n1) |
16 |
Real(l_) :: time |
17 |
Integer :: actsiz(0:nodes-1,2), base(0:nodes-1,2) |
18 |
Integer :: scnts(0:nodes-1), sdpls(0:nodes-1), |
19 |
& rcnts(0:nodes-1), rdpls(0:nodes-1) |
20 |
Integer :: ierr |
21 |
! ---------------------------------------------------------------------- |
22 |
! --- Get distribution & offsets for a. |
23 |
|
24 |
Call sizoff( n1, n2, actsiz, base ) |
25 |
! ---------------------------------------------------------------------- |
26 |
! --- Do local transposition. |
27 |
|
28 |
Call ltrans( n1, actsiz(me,2), a, at ) |
29 |
! ---------------------------------------------------------------------- |
30 |
! --- Determine sizes and displacements of data to be sent. |
31 |
|
32 |
Call cntdpls( actsiz, scnts, sdpls, rcnts, rdpls ) |
33 |
|
34 |
! ---------------------------------------------------------------------- |
35 |
! --- Distribute appropriate blocks over the processors. |
36 |
|
37 |
time = MPI_Wtime() |
38 |
Call MPI_AlltoAllv( at, scnts, sdpls, MPI_Real8, |
39 |
& wrk, rcnts, rdpls, MPI_Real8, |
40 |
& MPI_Comm_World, ierr ) |
41 |
ctime = ctime + MPI_Wtime() - time |
42 |
! ---------------------------------------------------------------------- |
43 |
! --- Do block transposition of the communicated data. |
44 |
|
45 |
Call btrans( wrk, actsiz(me,1), n2, actsiz, at ) |
46 |
! ---------------------------------------------------------------------- |
47 |
End Subroutine gtrans |