[gpaw-users] broadcasting H_skMM and S_skMM yields Typeerror

Ask Hjorth Larsen askhl at fysik.dtu.dk
Fri Nov 18 19:05:12 CET 2011


Hi

On Fri, 18 Nov 2011, Nichols A. Romero wrote:

> The problem is that this broadcast method only works on NumPy arrays and 
> H is not a NumPy array.
>
> Nichols A. Romero, Ph.D.
> Argonne Leadership Computing Facility
> Argonne National Laboratory
> Building 240 Room 2-127
> 9700 South Cass Avenue
> Argonne, IL 60490
> (630) 252-3441
>
>
> ----- Original Message -----
> From: "Alex Eftimiades" <alexeftimiades at gmail.com>
> To: gpaw-users at listserv.fysik.dtu.dk
> Sent: Thursday, November 17, 2011 11:12:59 PM
> Subject: [gpaw-users] broadcasting H_skMM and S_skMM yields Typeerror
>
>
> When I try to broadcast
> ibz2d_k, weight2d_k, H, S = get_lead_lcao_hamiltonian(lead_copy.calc, direction='z')
> world.broadcast(H,0)
>
> I get:
> TypeError: Not a proper NumPy array for MPI communication.
>
> I have checked all sorts of combinations of barriers, and I have tried declaring the variables H and S at the top of the code, I have tried checking that H and S are None for all other ranks (they are) I have tried printing H and S for rank 0 (typical complex ndarray), I have tried explicitly casting H and S into arrays both before and after setting them equal to H_skMM and S_kMM respctively, and I have tried just broadcasting the real parts of H and S.
>
> Please tell me what I am doing wrong here.
> Alex

Actually the get_lcao_hamiltonian function creates H and S_skMM as 
contiguous numpy arrays (although they are normally not stored as such, 
and performance-wise this is subject to some performance issues if the 
arrays are very large).

The problem here is that H_skMM is None on all ranks except the global 
master.  You must create an empty array of the correct shape on all CPUs 
that participate in the broadcast - if you want to actually broadcast it 
(this is a bit annoying, but it's consistent with how MPI works).

Regards
Ask


More information about the gpaw-users mailing list