def get2dgridsize(sz, tpb = (8, 8)):
    """Return CUDA grid size for 2d arrays.
    
    :param sz: input array size
    :param tpb: (optional) threads per block
    """
    bpg0 = (sz[0] + (tpb[0] - 1)) // tpb[0]
    bpg1 = (sz[1] + (tpb[1] - 1)) // tpb[1]
    return (bpg0, bpg1), tpb