ponweist / Wannier90-PRACE

Optimizations for Wannier90 (fork repository - see http://wannier.org for the official version).
GNU General Public License v2.0
1 stars 0 forks source link

Parallelize k_path #5

Closed ponweist closed 10 years ago

ponweist commented 10 years ago

The following loop (kpath.F90) needs to be parallelized:

       ! Loop over k-points on the path and evaluate the requested quantities
       !
       do loop_kpt=1,total_pts       
          kpt(:)=plot_kpoint(:,loop_kpt)

          if(plot_bands) then
             call fourier_R_to_k(kpt,HH_R,HH,0)
             call utility_diagonalize(HH,num_wann,eig(:,loop_kpt),UU)
             !
             ! Color-code energy bands with the spin projection along the
             ! chosen spin quantization axis
             !
             if(kpath_bands_colour=='spin') then
                call get_spin_nk(kpt,spn_k)
                color(:,loop_kpt)=spn_k(:)
                !
                ! The following is needed to prevent bands from disappearing 
                ! when the magnitude of the Wannier interpolated spn_k (very 
                ! slightly) exceeds 1.0 (e.g. in bcc Fe along N--G--H)
                !
                do n=1,num_wann
                   if(color(n,loop_kpt)>1.0_dp-eps8) then
                      color(n,loop_kpt)=1.0_dp-eps8
                   elseif(color(n,loop_kpt)<-1.0_dp+eps8) then
                      color(n,loop_kpt)=-1.0_dp+eps8
                   endif
                enddo
             end if
          endif

          if(plot_morb) then 
             call get_imfgh_k_list(kpt,imf_k_list,img_k_list,imh_k_list)
             Morb_k=img_k_list(:,:,1)+imh_k_list(:,:,1)&
                   -2.0_dp*fermi_energy_list(1)*imf_k_list(:,:,1)
             Morb_k=-Morb_k/2.0_dp ! differs by -1/2 from Eq.97 LVTS12
             morb(loop_kpt,1)=sum(Morb_k(:,1))
             morb(loop_kpt,2)=sum(Morb_k(:,2))
             morb(loop_kpt,3)=sum(Morb_k(:,3))
          end if

          if(plot_curv) then
             if(.not. plot_morb) then
                call get_imfgh_k_list(kpt,imf_k_list)
             end if
             curv(loop_kpt,1)=sum(imf_k_list(:,1,1))
             curv(loop_kpt,2)=sum(imf_k_list(:,2,1))
             curv(loop_kpt,3)=sum(imf_k_list(:,3,1))
          end if

       end do !loop_kpt
ponweist commented 10 years ago

Parallelization now done in this commit.

Output files (*.dat) are identical compared to c9be08b2c09a868a9c4da6662cb6c62a7778b87f.

Scaling is good (as expected); runtime is down from 123s to 17s for the 16sm case running at 16 processes.

Trace files before: iss5 ... and after: trace-iss5-fix