throw exception for inappropriate usage
This commit is contained in:
parent
42353ef775
commit
acc089a449
1 changed files with 5 additions and 0 deletions
|
@ -121,6 +121,11 @@ def sample_pdf(bins, weights, N_samples, det=False):
|
||||||
def render_single_image(rank, world_size, models, ray_sampler, chunk_size):
|
def render_single_image(rank, world_size, models, ray_sampler, chunk_size):
|
||||||
##### parallel rendering of a single image
|
##### parallel rendering of a single image
|
||||||
ray_batch = ray_sampler.get_all()
|
ray_batch = ray_sampler.get_all()
|
||||||
|
|
||||||
|
if (ray_batch['ray_d'].shape[0] // world_size) * world_size != ray_batch['ray_d'].shape[0]:
|
||||||
|
raise Exception('Number of pixels in the image is not divisible by the number of GPUs!\n\t# pixels: {}\n\t# GPUs: {}'.format(ray_batch['ray_d'].shape[0],
|
||||||
|
world_size))
|
||||||
|
|
||||||
# split into ranks; make sure different processes don't overlap
|
# split into ranks; make sure different processes don't overlap
|
||||||
rank_split_sizes = [ray_batch['ray_d'].shape[0] // world_size, ] * world_size
|
rank_split_sizes = [ray_batch['ray_d'].shape[0] // world_size, ] * world_size
|
||||||
rank_split_sizes[-1] = ray_batch['ray_d'].shape[0] - sum(rank_split_sizes[:-1])
|
rank_split_sizes[-1] = ray_batch['ray_d'].shape[0] - sum(rank_split_sizes[:-1])
|
||||||
|
|
Loading…
Reference in a new issue