PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Matmul problem

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Phil Livermore



Joined: 27 Sep 2004
Posts: 4

PostPosted: Mon Sep 27, 2004 2:30 am    Post subject: Matmul problem Reply with quote

Hi,
I've discovered what I think is a fault in the pgf90 compiler, version 4.0-2, involving the MATMUL command. The following code should multiply the vector v=(1,2,3,4,5,6,7,8) by an array segment a(:,5) (equal to v), but for some unknown reason seems to multiply v by a(:,1) instead.
Pgf90 gives the answer -204 (incorrect)
Ifc gives the answer 204 (correct)

Is it a bug, or a problem with my code?

Phil

PS Code enclosed here - consists of one module and one program.
Code:


MODULE GLOBAL
  REAL( KIND = 8), ALLOCATABLE, PUBLIC :: ARRAY(:,:)
 
  CONTAINS
 
  SUBROUTINE INIT
  IMPLICIT NONE
  ALLOCATE(ARRAY(1:8,1:6) )
  ARRAY = 0.0D0
 
  ARRAY(1:8,1) = (/-1,-2,-3,-4,-5,-6,-7,-8/)
  ARRAY(1:8,5) = (/1,2,3,4,5,6,7,8/)
 
 
  RETURN
  END SUBROUTINE INIT
 
  END MODULE GLOBAL

 program simple
  USE GLOBAL
  IMPLICIT NONE
  REAL( KIND = 8) :: TEMP(8)
  TEMP = (/1,2,3,4,5,6,7,8/)
  CALL INIT
 
   
  PRINT*, MATMUL( TEMP(1:8), ARRAY(1:8,5:5) )
  PRINT*, SUM( TEMP(1:8) * ARRAY(1:8,5) ) !should be the same
  STOP
  END
 

Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5871
Location: The Portland Group Inc.

PostPosted: Mon Sep 27, 2004 5:28 pm    Post subject: Bug in 4.0-2, fixed in 4.0-4 Reply with quote

Thanks for the great example. It really helps in determining the problem.

I can confirm that this was a bug that crept into the 4.0-2 release. Fortunately, it was fixed shortly after so downloading the latest 4.0 compilers should correct the problem. You can find the 4.0-3 compilers in the download archives at http://www.pgroup.com/support/download_archive.php

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group