提高Fortran 30
我这有一段Fortran的加法计算程序,用OpenMP实现并行计算,在visualstudio2010下计算,有两台主机一台是两个IntelXeonE5CPU的,另外一台...
我这有一段Fortran的加法计算程序,用OpenMP实现并行计算,在visual studio2010下计算,有两台主机一台是两个Intel Xeon E5 CPU的,另外一台是4个Intel Xeon E7CPU,系统用的是Windows2008,问题:4个CPU的计算机并行计算的时间跟2个CPU的并行计算时间相差不大,但是Intel Xeon E7比E5性能强很多,而且还有4个E7,为什么计算效率却相差不大呢?要怎么设置才可以提高4个CPU计算机的计算效率? 跪求答案,谢谢!
以下是程序
program test1
implicit none
integer,parameter::nscanpts =8
integer:: n=10000,m=5000
integer i,j,k
real time1,time2,timescan(nscanpts),time3,time4
integer rel(nscanpts)
rel = 0
call cputime(time3)
!$OMP PARALLEL SHARED(n,m,timescan,rel), PRIVATE(i,j,k,time1,time2)
!$OMP DO
do i = 1, nscanpts
write(*,*) "iscan=",i
call cputime(time1)
do j = 1, 4*n
do k = 1, 4*m
rel(i) = k*(j-1)/j
end do
end do
call cputime(time2)
timescan(i) = time2-time1 展开
以下是程序
program test1
implicit none
integer,parameter::nscanpts =8
integer:: n=10000,m=5000
integer i,j,k
real time1,time2,timescan(nscanpts),time3,time4
integer rel(nscanpts)
rel = 0
call cputime(time3)
!$OMP PARALLEL SHARED(n,m,timescan,rel), PRIVATE(i,j,k,time1,time2)
!$OMP DO
do i = 1, nscanpts
write(*,*) "iscan=",i
call cputime(time1)
do j = 1, 4*n
do k = 1, 4*m
rel(i) = k*(j-1)/j
end do
end do
call cputime(time2)
timescan(i) = time2-time1 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询