From: Nicolas Koenig <koenigni@student.ethz.ch>
To: Jerry DeLisle <jvdelisle@charter.net>
Cc: GCC-Fortran-ML <fortran@gcc.gnu.org>
Subject: Re: [Patch, fortran] PR35339 Optimize implied do loops in io statements
Date: Sun, 28 May 2017 23:32:00 -0000 [thread overview]
Message-ID: <4bf3850e-393c-6ef8-3895-4a17931c1b9b@student.ethz.ch> (raw)
In-Reply-To: <910df381-5f26-a05e-6cae-efbd26c1c880@charter.net>
Hello Jerry,
it already handles READ statements ;)
Those were the results i got:
gcc@dcm-linux:~/pr/35339> cat perf_test.f90
program main
implicit none
integer:: i
integer, parameter:: N = 10000000
integer, dimension(N):: g
do i=1,N
g(i) = i
end do
open(10,file="test.dat")
write (10,*) (g(i), i=1,N)
close(10)
end program
gcc@dcm-linux:~/pr/35339> gfortran -O3 perf_test.f90
gcc@dcm-linux:~/pr/35339> time ./a.out
real 0m1.879s
user 0m1.838s
sys 0m0.040s
gcc@dcm-linux:~/pr/35339> gfortran-7 -O3 perf_test.f90
gcc@dcm-linux:~/pr/35339> time ./a.out
real 0m1.929s
user 0m1.901s
sys 0m0.028s
It does seem to make everything a bit faster, but not by much. At least
it gets rid of most of the loops that make problems with asynchronous
io. I noticed while writing the patch that "a(1:size(a):1)" isn't converted
to "a(FULL)". Would their be any performance gain in doing this?
Nicolas
On 05/29/2017 12:06 AM, Jerry DeLisle wrote:
> On 05/27/2017 12:49 PM, Nicolas Koenig wrote:
>> Hello everyone,
>>
>> attached is a patch to simplify implied do loops in io statements by
>> replacing them with their respective array slices. For example "WRITE
>> (*,*) (a(i), i=1,4,2)" becomes "WRITE (*,*) a(1:4:2)".
>>
>> Ok for trunk?
>>
>
> Thanks for patch. Could you do some timing performance tests with and
> without the patch on large arrays and see if we gain anything?
>
> Also, we should expand the test case to include implied do loops in
> read statements. You could probably just rewind the file, copy down
> the WRITEs and change them to READs or similar and check results.
>
> While doing some checks myself I noticed some odd behavior and found
> PR53029. I posted a patch, but what caught my attention was the
> implied do version was faster than the array version. (about .89 sec
> vs 6 sec)
>
> So with my patch there I am now getting (.89 sec vs .007 sec)
>
> This prompted me to have you check some performance cases.
>
> Thanks for additional feedback,
>
> Jerry
>
>
next prev parent reply other threads:[~2017-05-28 23:32 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-27 19:49 Nicolas Koenig
2017-05-28 22:07 ` Jerry DeLisle
2017-05-28 23:32 ` Nicolas Koenig [this message]
2017-05-29 6:40 ` Thomas Koenig
2017-05-29 14:06 ` Thomas Koenig
2017-05-29 15:32 ` Jerry DeLisle
2017-05-29 15:49 Dominique d'Humières
2017-05-29 16:24 ` Nicolas Koenig
2017-05-29 16:51 ` Dominique d'Humières
2017-05-31 15:40 ` Bernhard Reutner-Fischer
2017-05-31 15:49 ` Dominique d'Humières
2017-05-31 19:03 ` Dominique d'Humières
2017-05-31 23:15 ` Nicolas Koenig
2017-06-01 9:31 ` Dominique d'Humières
2017-06-01 14:19 ` Dominique d'Humières
2017-06-01 14:37 ` Dominique d'Humières
2017-06-01 18:26 ` Nicolas Koenig
2017-06-03 13:48 ` Nicolas Koenig
2017-06-03 16:25 ` Jerry DeLisle
2017-06-03 18:12 ` Bernhard Reutner-Fischer
2017-06-05 20:39 ` Nicolas Koenig
2017-06-06 11:05 ` Markus Trippelsdorf
2017-06-07 15:13 ` Renlin Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4bf3850e-393c-6ef8-3895-4a17931c1b9b@student.ethz.ch \
--to=koenigni@student.ethz.ch \
--cc=fortran@gcc.gnu.org \
--cc=jvdelisle@charter.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).