Skip to content Skip to sidebar Skip to footer

Dramatic Slow-down When Executing Multiple Processes At The Same Time

I write a very simple code which contains summation of arrays by using both Fortran and Python. When I submit multiple (independent) jobs using shell, there will be dramatic slow-d

Solution 1:

The code is likely slow when running multiple times, because you have more and more memory that must flow through the limited bandwidth memory buses.

If you run just one process, that works just with one array at one time, but enable OpenMP threading, it can be made faster:

integer*8:: begin, end, rate
...

call system_clock(count_rate=rate)
call system_clock(count=begin)

!$omp parallel dodo i = 1, 1001do j = 1, 50
    test_theta = test_theta+0.5d0*test_e
  enddoenddo
!$ompend parallel do

call system_clock(count=end)
write(*, *) 'total time cost is : ', (end-begin)*1.d0/rate

On a quad-core CPU:

> gfortran -O3 testperformance.f90 -o result> ./result 
 total time cost is :    15.135917384000001
> gfortran -O3 testperformance.f90 -fopenmp -o result> ./result 
 total time cost is :    3.9464441830000001

Post a Comment for "Dramatic Slow-down When Executing Multiple Processes At The Same Time"