def warp_occupancy(info, cc, smem_config=None):
 ret = {}
 try:
  limits = PHYSICAL_LIMITS[cc]
 except KeyError:
  raise ValueError(('%s is not a supported compute capability' % '.'.join((str(c) for c in cc))))
 if (smem_config is None):
  smem_config = limits['default_smem_config']
 warpsize = limits['thread_per_warp']
 max_thread = info.maxthreads
 for tpb in range(warpsize, (max_thread + 1), warpsize):
  result = compute_warp_occupancy(tpb=tpb, reg=info.regs, smem=info.shared, smem_config=smem_config, limits=limits)
  if result[0]:
   ret[tpb] = result
 return ret

def warp_occupancy ( info , cc , smem_config = None ) : ret = { } try : limits = PHYSICAL_LIMITS [ cc ] except KeyError : raise ValueError ( ( '%s is not a supported compute capability' % '.' . join ( ( str ( c ) for c in cc ) ) ) ) if ( smem_config is None ) : smem_config = limits [ 'default_smem_config' ] warpsize = limits [ 'thread_per_warp' ] max_thread = info . maxthreads for tpb in range ( warpsize , ( max_thread + 1 ) , warpsize ) : result = compute_warp_occupancy ( tpb = tpb , reg = info . regs , smem = info . shared , smem_config = smem_config , limits = limits ) if result [ 0 ] : ret [ tpb ] = result return ret
returns a dictionary of {threadperblock: occupancy .