Mail Archives: djgpp/1997/02/20/10:34:32
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 -