#NEWLINE# def _allocate_reduction_buffer( self , grid_size , op ) : #NEWLINE# #INDENT# if ( ( not hasattr ( self , '_reduction_buffer' ) ) or ( self . _reduction_buffer . size != grid_size ) ) : #NEWLINE# #INDENT# self . _host_reduction_buffer = np . zeros ( ( np . prod ( grid_size ) * self . cdim ) , dtype = self . dtype ) . reshape ( ( ( ( - 1 ) , ) + self . _dim ) ) #NEWLINE# if ( op is not op2 . INC ) : #NEWLINE# #INDENT# self . _host_reduction_buffer [ : ] = self . _data #NEWLINE# #UNINDENT# self . _reduction_buffer = gpuarray . to_gpu ( self . _host_reduction_buffer ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( op is not op2 . INC ) : #NEWLINE# #INDENT# self . _reduction_buffer . fill ( op . _data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _reduction_buffer . fill ( 0 )