#NEWLINE# def launch_configuration( self , part ) : #NEWLINE# #INDENT# if self . _is_direct : #NEWLINE# #INDENT# max_smem = self . _max_shared_memory_needed_per_set_element #NEWLINE# smem_offset = ( max_smem * _WARPSIZE ) #NEWLINE# max_block = _device . get_attribute ( driver . device_attribute . MAX_BLOCK_DIM_X ) #NEWLINE# if ( max_smem == 0 ) : #NEWLINE# #INDENT# block_size = max_block #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# threads_per_sm = ( _AVAILABLE_SHARED_MEMORY / threads_per_sm ) #NEWLINE# block_size = min ( max_block , ( ( threads_per_sm / _WARPSIZE ) * _WARPSIZE ) ) #NEWLINE# #UNINDENT# max_grid = _device . get_attribute ( driver . device_attribute . MAX_GRID_DIM_X ) #NEWLINE# grid_size = min ( max_grid , ( ( block_size + part . size ) / block_size ) ) #NEWLINE# grid_size = np . asscalar ( np . int64 ( grid_size ) ) #NEWLINE# block_size = ( block_size , 1 , 1 ) #NEWLINE# grid_size = ( grid_size , 1 , 1 ) #NEWLINE# required_smem = np . asscalar ( ( max_smem * np . prod ( block_size ) ) ) #NEWLINE# return { #NEWLINE# #INDENT# 'op2stride' : self . _it_space . size , #NEWLINE# 'smem_offset' : smem_offset , #NEWLINE# 'WARPSIZE' : _WARPSIZE , #NEWLINE# 'required_smem' : required_smem , #NEWLINE# 'block_size' : block_size , #NEWLINE# 'grid_size' : grid_size , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'op2stride' : self . _it_space . size , #NEWLINE# 'WARPSIZE' : 32 , #NEWLINE# #UNINDENT# }