注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

随机过程

http://superware.blog.163.com

 
 
 

日志

 
 

Optimizing programs with option -Ofast in gfortran  

2015-08-26 23:18:13|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

The options how to optimize the program can be obained  from here  for old releases of the GCC, but in the latest releases of GCC, e.g. the releases newer than GCC 4.8, the optimizing option -Ofast can make the program faster than ifort -O3.

My test 1: for source code of single particle of the solid precipitating,the simulation region is 256X256 square area.

The releases of the compilers ifort and gfortran are listed below

$ gfortran --version


GNU Fortran (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING


$ ifort --version


ifort (IFORT) 11.1 20100414
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.


Test 1.
results for ifort -O2
real 543.50
user 525.94
sys 16.91

results for gfortran -O2
real 605.80
user 466.60
sys 138.53

Test 2.
results for ifort -O3
real 543.94
user 525.75
sys 17.44

results for gfortran -O3 -march=native -ffast-math -funroll-loops -flto -fwhole-program -fno-protect-parens
real 577.53
user 440.15
sys 136.80

Test 3.
results for ifort -O3
real 546.21
user 529.14
sys 16.29

results for gfortran -O3
real 594.26
user 454.16
sys 139.48

Test 4.
results for ifort -O3
real 537.38
user 520.20
sys 16.56

results for gfortran -Ofast
real 461.10
user 460.20
sys 0.36

显然 gfortran -O3 的速度比 ifort -O3 慢 8% 左右,但 gfortran -Ofast 速度明显比 ifort  -O3 的速度快了 20% 左右。以前对 gfortran 速度慢的印象完全消除了。

gfortran -Ofast 等价于下面的优化
gfortran -O3 -ffast-math -fno-protect-parens -fstack-arrays 
  评论这张
 
阅读(141)| 评论(0)
推荐

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017