automatically compute the tile size