www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/20/10:34:32

From: jesse AT lenny DOT dseg DOT ti DOT com (Jesse Bennett)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Netlib code [was Re: flops...]
Date: 20 Feb 1997 04:14:54 GMT
Organization: Texas Instruments
Lines: 29
Message-ID: <5egj3u$k7g$2@superb.csc.ti.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970219100950 DOT 22519I-100000 AT is>
Reply-To: jbennett AT ti DOT com (Jesse Bennett)
NNTP-Posting-Host: lenny.dseg.ti.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT SUN DOT 3 DOT 91 DOT 970219100950 DOT 22519I-100000 AT is>,
	Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> writes:
> 
> On Tue, 18 Feb 1997 kagel AT quasar DOT bloomberg DOT com wrote:
> 
>>    say the least.  The problem is not with the performance of the Fortran
>>    code but with the memory bandwidth overhead associated with converting
>>    the C row-major matrices to the Fortran column-major order prior to
>> 
>> What conversion?  The FORTRAN is not converting you arrays.  FORTRAN and C
>> share a common calling convention (ignoring the facts that FORTRAN passes
>> string lengths and always passes pointers).  They just disagree on which
>> dimension to increment first.  You are not inverting the arrays are you?  Just
>> declare the C arrays with the indices reversed and everything will be fine.
> 
> I don't know whether this is or isn't the problem which causes the 
> slow-down, but note that accessing a large array columnwise might hurt 
> performance due to CPU cache trashing and the virtual memory trashing (if 
> the array is large enough to exceed the physical RAM).

It is true that accessing a C (row-major) array columnwise will likely
cause cache thrashing.  Since a FORTRAN array is stored in
column-major order the converse is true, so in FORTRAN columnwise
access is generally preferred.

The performance bottleneck in my application is in performing a large
number of matrix transpositions (copying arrays).

--Jesse

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019