public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nadavhalahmi560 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/100855] New: pow run time gfortran vs ifort
Date: Tue, 01 Jun 2021 13:01:29 +0000	[thread overview]
Message-ID: <bug-100855-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100855

            Bug ID: 100855
           Summary: pow run time gfortran vs ifort
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nadavhalahmi560 at gmail dot com
  Target Milestone: ---

I wrote the code below:

```
program power
    implicit none

    real :: sum, n, q
    integer :: i, j
    integer :: limit
    real :: start, finish

    sum = 0d0
    limit = 10000
    n = 2.0
    q = 0.5
    call CPU_TIME(start)
    do j=1,limit
        do i=1, limit
            n = n*q
            sum = sum + (i ** (0.05 + n))
        end do
    end do
    call CPU_TIME(finish)
    print *, sum
    print '("Time = ",f6.3," seconds.")',finish-start
end program power
```

and compiled it using:

ifort pow.f90 -O3 -no-vec -o intel.out

gfortran pow.f90 -O3 -fno-tree-vectorize -o gnu.out

When I run `./intel.out` I get the following output:
  3.3554432E+07
Time =  1.615 seconds.

When I run `./gnu.out` I get the following output:
  33554432.0    
Time =  7.817 seconds.

Therefore, gfortran is much slower than ifort. I get similar behavior for `log`
and `exp` functions.

gfortran -v:
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/software/x86_64/3.10.0/gcc/11.1.0/libexec/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/software/x86_64/3.10.0/gcc/11.1.0
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.1.0 (GCC) 

ifort -v:
ifort version 19.1.3.304

             reply	other threads:[~2021-06-01 13:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 13:01 nadavhalahmi560 at gmail dot com [this message]
2021-06-01 16:19 ` [Bug fortran/100855] " kargl at gcc dot gnu.org
2021-06-01 17:20 ` anlauf at gcc dot gnu.org
2021-06-02  7:52 ` rguenth at gcc dot gnu.org
2021-06-02  9:37 ` nadavhalahmi560 at gmail dot com
2021-06-02  9:38 ` nadavhalahmi560 at gmail dot com
2021-06-02 16:34 ` dominiq at lps dot ens.fr
2021-06-03  8:21 ` nadavhalahmi560 at gmail dot com
2021-06-03 14:24 ` dominiq at lps dot ens.fr
2021-06-05 11:59 ` dominiq at lps dot ens.fr
2021-06-06  8:52 ` nadavhalahmi560 at gmail dot com

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=bug-100855-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).