Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This fixes #123 (problem with geninterp with more processors than kpoints) #129

Merged
merged 1 commit into from
Apr 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/disentangle.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1602,18 +1602,18 @@ subroutine dis_extract()

! for MPI
call comms_array_split(num_kpts,counts,displs)
allocate(u_matrix_opt_loc(num_bands,num_wann,counts(my_node_id)),stat=ierr)
allocate(u_matrix_opt_loc(num_bands,num_wann,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error allocating u_matrix_opt_loc in dis_extract')
! Copy matrix elements from global U matrix to local U matrix
do nkp_loc = 1, counts(my_node_id)
nkp = nkp_loc + displs(my_node_id)
u_matrix_opt_loc(:,:,nkp_loc) = u_matrix_opt(:,:,nkp)
enddo
allocate(wkomegai1_loc(counts(my_node_id)),stat=ierr)
allocate(wkomegai1_loc(max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error allocating wkomegai1_loc in dis_extract')
allocate(czmat_in_loc(num_bands,num_bands,counts(my_node_id)),stat=ierr)
allocate(czmat_in_loc(num_bands,num_bands,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error allocating czmat_in_loc in dis_extract')
allocate(czmat_out_loc(num_bands,num_bands,counts(my_node_id)),stat=ierr)
allocate(czmat_out_loc(num_bands,num_bands,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error allocating czmat_out_loc in dis_extract')

allocate(wkomegai1(num_kpts),stat=ierr)
Expand Down Expand Up @@ -1759,7 +1759,7 @@ subroutine dis_extract()
if (timing_level>1 .and. on_root) call io_stopwatch('dis: extract_3',1)

! send chunks of wkomegai1 to root node
call comms_gatherv(wkomegai1_loc(1),counts(my_node_id),wkomegai1(1),counts,displs)
call comms_gatherv(wkomegai1_loc,counts(my_node_id),wkomegai1,counts,displs)
! send back the whole wkomegai1 array to other nodes
call comms_bcast(wkomegai1(1),num_kpts)

Expand Down Expand Up @@ -1829,7 +1829,7 @@ subroutine dis_extract()
if (iter.eq.dis_num_iter) then
allocate(camp(num_bands,num_bands,num_kpts),stat=ierr)
if (ierr/=0) call io_error('Error allocating camp in dis_extract')
allocate(camp_loc(num_bands,num_bands,counts(my_node_id)),stat=ierr)
allocate(camp_loc(num_bands,num_bands,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error allocating ucamp_loc in dis_extract')

if (ndimwin(nkp).gt.num_wann) then
Expand Down Expand Up @@ -1860,22 +1860,22 @@ subroutine dis_extract()


! send chunks of wkomegai1 to root node
call comms_gatherv(wkomegai1_loc(1),counts(my_node_id),wkomegai1(1),counts,displs)
call comms_gatherv(wkomegai1_loc,counts(my_node_id),wkomegai1,counts,displs)
! send back the whole wkomegai1 array to other nodes
call comms_bcast(wkomegai1(1),num_kpts)

call comms_allreduce(womegai1,1,'SUM')

if ( num_wann.gt.ndimfroz(nkp) ) then
call comms_gatherv(u_matrix_opt_loc(1,1,1),num_bands*num_wann*counts(my_node_id),&
u_matrix_opt(1,1,1),num_bands*num_wann*counts,num_bands*num_wann*displs)
call comms_gatherv(u_matrix_opt_loc,num_bands*num_wann*counts(my_node_id),&
u_matrix_opt,num_bands*num_wann*counts,num_bands*num_wann*displs)
call comms_bcast(u_matrix_opt(1,1,1),num_bands*num_wann*num_kpts)
endif

if(index(devel_flag,'compspace')>0) then
if (iter.eq.dis_num_iter) then
call comms_gatherv(camp_loc(1,1,1),num_bands*num_bands*counts(my_node_id),&
camp(1,1,1),num_bands*num_bands*counts,num_bands*num_bands*displs)
call comms_gatherv(camp_loc,num_bands*num_bands*counts(my_node_id),&
camp,num_bands*num_bands*counts,num_bands*num_bands*displs)

call comms_bcast(camp(1,1,1),num_bands*num_bands*num_kpts)
endif
Expand Down
17 changes: 9 additions & 8 deletions src/postw90/boltzwann.F90
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,14 @@ subroutine boltzwann_main()
call comms_array_split(TempNumPoints * MuNumPoints,counts,displs)

! I allocate the arrays for the spectra
allocate(LocalElCond(6,counts(my_node_id)),stat=ierr)
! Allocate at least 1 entry
allocate(LocalElCond(6,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error in allocating LocalElCond in boltzwann_main')
allocate(LocalSigmaS(6,counts(my_node_id)),stat=ierr)
allocate(LocalSigmaS(6,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error in allocating LocalSigmaS in boltzwann_main')
allocate(LocalSeebeck(9,counts(my_node_id)),stat=ierr)
allocate(LocalSeebeck(9,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error in allocating LocalSeebeck in boltzwann_main')
allocate(LocalKappa(6,counts(my_node_id)),stat=ierr)
allocate(LocalKappa(6,max(1,counts(my_node_id))),stat=ierr)
if (ierr/=0) call io_error('Error in allocating LocalKappa in boltzwann_main')
LocalElCond = 0._dp
LocalSeebeck = 0._dp
Expand Down Expand Up @@ -462,10 +463,10 @@ subroutine boltzwann_main()

! The 6* factors are due to the fact that for each (T,mu) pair we have 6 components (xx,xy,yy,xz,yz,zz)
! NOTE THAT INSTEAD SEEBECK IS A FULL MATRIX AND HAS 9 COMPONENTS!
call comms_gatherv(LocalElCond(1,1),6*counts(my_node_id),ElCond(1,1,1),6*counts,6*displs)
call comms_gatherv(LocalSigmaS(1,1),6*counts(my_node_id),SigmaS(1,1,1),6*counts,6*displs)
call comms_gatherv(LocalSeebeck(1,1),9*counts(my_node_id),Seebeck(1,1,1),9*counts,9*displs)
call comms_gatherv(LocalKappa(1,1),6*counts(my_node_id),Kappa(1,1,1),6*counts,6*displs)
call comms_gatherv(LocalElCond,6*counts(my_node_id),ElCond,6*counts,6*displs)
call comms_gatherv(LocalSigmaS,6*counts(my_node_id),SigmaS,6*counts,6*displs)
call comms_gatherv(LocalSeebeck,9*counts(my_node_id),Seebeck,9*counts,9*displs)
call comms_gatherv(LocalKappa,6*counts(my_node_id),Kappa,6*counts,6*displs)

if(on_root .and. (timing_level>0)) call io_stopwatch('boltzwann_main: calc_props',2)

Expand Down
Loading