The implementation of parallel Computing in upwind scheme (OpenMP)
Krigo小于 1 分钟HPCParallel ComputingCoding
subroutine get_stream_tn_parallel
use omp_lib
implicit none
integer :: i, thread_id,partial_Sum,total_Sum
t1_vertex(0)%value = t0_vertex(0)%value - dt * (t0_vertex(0)%value - t0_vertex(nx)%value)/dx
!$OMP PARALLEL PRIVATE(partial_Sum) SHARED(total_Sum)
!$OMP DO
do i = 1,nx + nghost
t1_vertex(i)%value = t0_vertex(i)%value - dt * (t0_vertex(i)%value - t0_vertex(i-1)%value)/dx
!thread_id = OMP_GET_THREAD_NUM()
!print *, "Upwind process: ", thread_id
enddo
!$OMP end DO
!$OMP DO
do i = 1 - nghost, nx + nghost
t0_vertex(i)%value = t1_vertex(i)%value
enddo
!$OMP end DO
!$OMP END PARALLEL
end subroutine get_stream_tn_parallel
12802560512010240204804096081920163840327680 non-Parallel(Standard)0.1718750.7343752.468759.85937539.828125156.234375625.4375002561.90625010378.484375non-Parallel(System)0.1640000.7360002.4580009.85200039.866000156.492000626.7750002566.59800010398.286000Parallel(Standard)2.3281254.00000011.82812539.562500162.031250613.9531252343.296879150.62500035902.890625non-Parallel(System)0.3560000.4500001.19300004.099000016.06500060.7620000231.953000905.9570003592.304000