Commit bf25e628 authored by Matthias Redies's avatar Matthias Redies

added parallelization test for OpenMP

parent c558fbfd
......@@ -39,6 +39,7 @@ time.F90
args.F90
sysinfo.F90
check_arguments.F90
check_para.f90
xmlOutput.F90
)
if (JUDFT_USE_MPI)
......
MODULE m_judft_para
CONTAINS
subroutine juDFT_check_para()
implicit none
call check_omp_para()
end subroutine juDFT_check_para
subroutine check_omp_para()
use omp_lib
use m_judft_string
use m_judft_stop
implicit none
real(8) :: summe, t_omp, t_seq
integer(4) :: rank, size, ierr
integer :: i, omp_threads
integer, parameter :: loop_end = 300000000
summe = 0.0
!$omp parallel reduction(+: t_omp)
omp_threads = OMP_GET_NUM_THREADS()
t_omp = OMP_GET_WTIME()
!$omp do reduction(+:summe)
do i = 1, loop_end*omp_threads
summe = summe + 1.0
enddo
!$omp end do
t_omp = OMP_GET_WTIME() - t_omp
!$omp end parallel
t_omp = t_omp / omp_threads
summe = summe / omp_threads
t_seq = OMP_GET_WTIME()
do i = 1, loop_end
summe = summe - 1.0
enddo
t_seq = OMP_GET_WTIME() - t_seq
if( abs(t_seq/t_omp -1.0) < 0.1)then
write (*,*) "Parallelization OK"
else
write (*,*) "t_omp = ", t_omp
write (*,*) "t_seq = ", t_seq
write (*,*) "Summe = ", summe
call juDFT_warn("OMP parallelization underperform with a parallel efficiency of " // &
float2str(t_seq/t_omp), hint="check if your slurm files is set properly")
endif
end subroutine check_omp_para
END MODULE m_judft_para
......@@ -11,4 +11,5 @@ MODULE m_juDFT
USE m_judft_args
USE m_judft_info
USE m_judft_usage
use m_judft_para
END MODULE m_juDFT
......@@ -111,6 +111,7 @@
#ifdef CPP_HDF
CALL hdf_init()
#endif
call juDFT_check_para()
CALL field%init(input)
input%gw = -1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment