'Returns the best tpb in the given range inclusively.'

def best_within(self, mintpb, maxtpb):

    warpsize = PHYSICAL_LIMITS[self.cc]['thread_per_warp']
    mintpb = int(ceil(mintpb, warpsize))
    maxtpb = int(floor(maxtpb, warpsize))
    return self.prefer(*range(mintpb, (maxtpb + 1), warpsize))
