shirazbj 发表于 2011-6-20 20:35:52

开始学习openmp编程

编译器在这下载:gfortran for window
http://www.equation.com/servlet/equation.cmd?fa=fortran

第1个程序hello.f90
program hello

integer nthreads,tid,omp_get_num_threads,omp_get_thread_num

!$omp parallel private(tid)
tid=omp_get_thread_num()
print*,'hello world from thread=',tid
if(tid.eq.0) then
nthreads=omp_get_num_threads()
print*,'number of threads=',nthreads
end if
!$omp end parallel

end

编译和运行参见附图

[ 本帖最后由 shirazbj 于 2011-7-21 21:39 编辑 ]

shirazbj 发表于 2011-7-22 12:44:34

要是有个软件能把自己代码里的do循环自动加!$omp语句并行化就好了。
页: [1]
查看完整版本: 开始学习openmp编程