首页 > 其他 > 详细

Fortran&OpenMP - 1.环境配置

时间:2014-01-20 22:33:55      阅读:425      评论:0      收藏:0      [点我收藏+]
编译OpenMP程序的时候,需要在编译源文件和连接时都加入‘-fopenmp’编译选项。
以Code::Blocks13.11为例,需要在‘Project‘-‘Build Option‘-‘Compiler Flags‘中勾选‘Enable the OpenMP extensions [-fopenmp]‘;
bubuko.com,布布扣

在同一窗口的‘Linker Settings’-‘Other Linker Options’中加入“-fopenmp”
bubuko.com,布布扣
环境设置完毕,可以进行程序编辑了。
program main
    implicit none
    include ‘omp_lib.h‘
    integer :: threadCount
    integer :: threadNum
    !$OMP PARALLEL PRIVATE(threadCount, threadNum)
    threadCount = OMP_GET_NUM_THREADS()
    threadNum = OMP_GET_THREAD_NUM()
    write(*, "(‘THREAD: ‘, I2, ‘/‘, I2)") threadNum, threadCount
    !$OMP END PARALLEL
end program

bubuko.com,布布扣

Fortran&OpenMP - 1.环境配置

原文:http://blog.csdn.net/heyzol/article/details/18514883

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!