program main
real*8, allocatable :: x(:), y(:)
real*8 time
integer*4 time0, time1, dtime
integer i, j, n, m
n = 10000
m = 100000
allocate(x(n), y(n))
do i=1,n
x(i) = rand()
end do
call system_clock(time0)
do j=1,m
do i=1,n
y(i) = x(i) + 1d0
end do
end do
call system_clock(time1, dtime)
time = 1d0*(time1-time0)/dtime
write(*,"(a7,f16.7)")"Time = ",time
deallocate(x, y)
end program作者: li913 时间: 2015-4-21 10:51
25% 和 12%如果是指的cpu使用率,那么这是正常的。串行程序只能使用一个核心进行计算,如果是四核CPU,能到25%;八核CPU,就是12%。作者: andy8496 时间: 2015-4-21 19:35