please help, psgemv

Post here if you have a question about LAPACK or ScaLAPACK algorithm or data format

please help, psgemv

Postby kroyls » Fri May 03, 2013 2:04 pm

hello every one, please help me, I don't know why I get wrong result
thank in advance
Code: Select all
program exo1
    implicit none

 REAL A(9,9), X(9,1), Y(9,1), ALPHA, BETA
 integer :: r,rr, icontxt,NPROW, NPCOL, MYROW, MYCOl, INFO,INCX,INCY,LDA,m,n,nb,np,nq, NUMROC,npx,dim1,ii
 integer :: desca(9) ,descx(9),descy(9), i, j
  INCX = 1
  INCY = 1
  LDA = 9
  M = 9
  N = 9
  ALPHA = 1
  BETA = 0
a=0
x=0
y=0
  !call sgemv('n', m, n, alpha,a,9,x,1,beta,y,1)
  !call sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)

   call blacs_pinfo( r, rr )
   
    NPROW = INT( SQRT( REAL(rr) ) )
    NPCOL = rr / NPROW
CALL BLACS_GET(0, 0, ICONTXT)
CALL BLACS_GRIDINIT(ICONTXT, 'C', NPROW, NPCOL)
CALL BLACS_GRIDINFO(ICONTXT, NPROW, NPCOL, MYROW, MYCOL)

Call genmat ( MYROW , MYCOL, a, x)
nb=2
NP    = NUMROC( 9, nb, MYROW, 0, NPROW )
NQ    = NUMROC( 9, nb, MYCOL, 0, NPCOL )
NPX=numroc(9, nb, myrow, 0, nprow)

print*, 'np=' , np
 CALL DESCINIT( desca, N, N, NB, NB, 0, 0, ICONTXT, MAX( 1, Np ), INFO )
 CALL DESCINIT( descx, N, 1, NB, NB, 0, 0, ICONTXT, MAX( 1, NpX ), INFO )
 CALL DESCINIT( descy, N, 1, NB, NB, 0, 0, ICONTXT, MAX( 1, NpX ), INFO )

!CALL DESCINIT (desc, m, n, mb, nb, irsrc, icsrc, ictxt, lld, info)

  call psgemv('n', m, n, alpha, a, 1, 1, desca, x, 1, 1, descx, incx, beta, y, 1, 1, descy, incx)


  if(mycol.eq.0) then
        dim1 = max(1,numroc(9, nb, myrow, 0, nprow))
          !dim1 = max(1,numroc(m, nb, myrow, 0, nprow))
        write(*,"('For process row',i3,':',(5f8.1))") myrow, (y (ii,1),ii=1,dim1)
      endif
 
! if (mycol.eq.0) then
!do i=1,9

!write(*,*),  y

!end do
!endif

  CALL BLACS_EXIT(0)
   
    end
        subroutine genmat(myrow,mycol,a,b)
    implicit none
    integer myrow, mycol
    real a(9,9), b(9,1)
    if (myrow.eq.0 .and. mycol.eq.0) then
        A(1,1) = 11
        A(1,2) = 12
        A(1,3) = 17
        A(1,4) = 18
        A(2,1) = 21
        A(2,2) = 22
        A(2,3) = 27
        A(2,4) = 28
        A(3,1) = 51
        A(3,2) = 52
        A(3,3) = 57
        A(3,4) = 58
        A(4,1) = 61
        A(4,2) = 62
        A(4,3) = 67
        A(4,4) = 68
        A(5,1) = 91
        A(5,2) = 92
        A(5,3) = 97
        A(5,4) = 98
        B(1,1) = 1
        B(2,1) = 2
        B(3,1) = 5
        B(4,1) = 6
        B(5,1) = 9
      else if (myrow.eq.0 .and. mycol.eq.1) then
        A(1,1) = 13
        A(1,2) = 14
        A(1,3) = 19
        A(2,1) = 23
        A(2,2) = 24
        A(2,3) = 29
        A(3,1) = 53
        A(3,2) = 54
        A(3,3) = 59
        A(4,1) = 63
        A(4,2) = 64
        A(4,3) = 69
        A(5,1) = 93
        A(5,2) = 94
        A(5,3) = 99
               
      else if (myrow.eq.0 .and. mycol.eq.2) then
        A(1,1) = 15
        A(1,2) = 16
        A(2,1) = 25
        A(2,2) = 26
        A(3,1) = 55
        A(3,2) = 56
        A(4,1) = 65
        A(4,2) = 66
        A(5,1) = 95
        A(5,2) = 96
               
      else if (myrow.eq.1 .and. mycol.eq.0) then
        A(1,1) = 31
        A(1,2) = 32
        A(1,3) = 37
        A(1,4) = 38
        A(2,1) = 41
        A(2,2) = 42
        A(2,3) = 47
        A(2,4) = 48
        A(3,1) = 71
        A(3,2) = 72
        A(3,3) = 77
        A(3,4) = 78
        A(4,1) = 81
        A(4,2) = 82
        A(4,3) = 87
        A(4,4) = 88
        B(1,1) = 3
        B(2,1) = 4
        B(3,1) = 7
        B(4,1) = 8
      else if (myrow.eq.1 .and. mycol.eq.1) then
        A(1,1) = 33
        A(1,2) = 34
        A(1,3) = 39
        A(2,1) = 43
        A(2,2) = 44
        A(2,3) = 49
        A(3,1) = 73
        A(3,2) = 74
        A(3,3) = 79
        A(4,1) = 83
        A(4,2) = 84
        A(4,3) = 89
     
      else if (myrow.eq.1 .and. mycol.eq.2) then
        A(1,1) = 35
        A(1,2) = 36
        A(2,1) = 45
        A(2,2) = 46
        A(3,1) = 75
        A(3,2) = 76
        A(4,1) = 85
        A(4,2) = 86
     
      endif

      return
      end
kroyls
 
Posts: 1
Joined: Fri May 03, 2013 1:59 pm

Return to Algorithm / Data

Who is online

Users browsing this forum: No registered users and 1 guest

cron