Index: hs_operators.py =================================================================== --- hs_operators.py (revision 7489) +++ hs_operators.py (working copy) @@ -26,7 +26,8 @@ async = True hermitian = True - def __init__(self, bd, gd, ksl, nblocks=None, async=None, hermitian=None): + def __init__(self, bd, gd, ksl, dtype, + nblocks=None, async=None, hermitian=None): """The constructor now calculates the work array sizes, but does not allocate them. Here is a summary of the relevant variables and the cases handled. @@ -61,6 +62,7 @@ """ self.bd = bd self.gd = gd + self.dtype = dtype self.work1_xG = None self.work2_xG = None self.A_qnn = None @@ -81,6 +83,18 @@ mynbands = self.bd.mynbands nbands = self.bd.nbands G = self.gd.n_c.prod() + + # Handle nblocks specified as a literal to mean MB. + # Converts to closest value of integer nblocks. + # if isinstance (self.nblocks,str): + # sizeof_single_wfs = self.gd.bytecount(self.dtype) + # number_wfs = float(self.nblocks)*1024*1024/sizeof_single_wfs + # temp_nblocks = int(np.floor(mynbands/multiple_wfs)) + # while (mynbands % temp_nblocks) != 0: + # temp_nblocks -= temp_nblocks + # assert temp_nblocks > 0 + # self.nblocks = temp_nblocks + if ngroups == 1 and self.nblocks == 1: pass else: @@ -115,7 +129,7 @@ gdbytes = self.gd.bytecount(dtype) count = self.Q * mynbands**2 - # Code semipasted from allocate_work_arrays + # Code semipasted from allocate_work_arrays if ngroups == 1 and self.nblocks == 1: mem.subnode('work1_xG', mynbands * gdbytes) else: