24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

450 end do<br />

close(20)<br />

end<br />

Per<strong>for</strong>mance<br />

To maximize the benefits of asynchronous I/O, you should only use it <strong>for</strong> large<br />

contiguous data items.<br />

It is possible to per<strong>for</strong>m asynchronous I/O on a large number of small items, but<br />

the overall per<strong>for</strong>mance will suffer. This is because extra processing overhead is<br />

required to maintain each item <strong>for</strong> asynchronous I/O. Per<strong>for</strong>ming asynchronous<br />

I/O on a larger number of small items is strongly discouraged. The following are<br />

two examples:<br />

1. WRITE(unit_number, ID=idvar) a1(1:100000000:2)<br />

2. WRITE(unit_number, ID=idvar) (a2(i,j),j=1,100000000)<br />

Per<strong>for</strong>ming asynchronous I/O on un<strong>for</strong>matted sequential files is less efficient. This<br />

is because each record might have a different length, and these lengths are stored<br />

with the records themselves. You should use un<strong>for</strong>matted direct access or<br />

un<strong>for</strong>matted stream access, if possible, to maximize the benefits of asynchronous<br />

I/O.<br />

Compiler-Generated Temporary I/O Items<br />

There are situations when the compiler must generate a temporary variable to hold<br />

the result of an I/O item expression. In such cases, synchronous I/O is per<strong>for</strong>med<br />

on the temporary variable, regardless of the mode of transfer that you specified in<br />

the I/O statement. The following are examples of such cases:<br />

1. For READ, when an array with vector subscripts appears as an input item:<br />

a. integer a(5), b(3)<br />

b = (/1,3,5/)<br />

read(99, id=i) a(b)<br />

b. real a(10)<br />

read(99,id=i) a((/1,3,5/))<br />

2. For WRITE, when an output item is an expression that is a constant or a<br />

constant of certain derived types:<br />

a. write(99,id=i) 1000<br />

b. integer a<br />

parameter(a=1000)<br />

write(99,id=i) a<br />

338 <strong>XL</strong> <strong>Fortran</strong> <strong>Enterprise</strong> <strong>Edition</strong> <strong>for</strong> <strong>AIX</strong> : User’s <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!