yt-project/yt

Volume Rendering Multiple Fields with MPI

biboyd opened this issue · 1 comments

Bug report

Bug summary

When creating a volume render with multiple fields, MPI parallelism only plots part of the second field. In this case we are plotting temperature (red) and density (blue). With 2 MPI procs, the render only saves half the density.

Code for reproduction

import yt
from yt.visualization.volume_rendering.transfer_function_helper import TransferFunctionHelper
from yt.visualization.volume_rendering.api import Scene, create_volume_source

yt.enable_parallelism()

ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")

# create scene and sources
sc = Scene()

source_temperature = create_volume_source(ds.all_data(), 'temperature')
source_density = create_volume_source(ds.all_data(), 'density')

#create transfer functions
tfh1 = TransferFunctionHelper(ds)
tfh1.set_field('temperature')
tfh1.set_bounds((1e3, 1e7))
tfh1.build_transfer_function()
tfh1.tf.add_layers(6, colormap="Reds")
source_temperature.transfer_function = tfh1.tf

tfh2 = TransferFunctionHelper(ds)
tfh2.set_field('density')
tfh2.set_bounds((1e-30, 1e-26))
tfh2.build_transfer_function()
tfh2.tf.add_layers(6, colormap="Blues")
source_density.transfer_function = tfh2.tf

# add sources to scene
sc.add_source(source_temperature)
sc.add_source(source_density)

# add camera
sc.add_camera(ds)
sc.camera.width = (400, "kpc")

#render/save
sc.save("render.png", sigma_clip=4)

Actual outcome
When run with 2 procs

$ mpirun -np 2 python test.py

image

Expected outcome
When run without MPI

$ python test.py

image

Version Information

  • Operating System: Ubuntu 22.04.4 LTS
  • Python Version: 3.11.2
  • yt version: 4.3
  • Other Libraries (if applicable): Open MPI 4.1.2, mpi4py 3.1.5

yt installed via pip

Thanks for the report!

Might be a duplicate of #2622 though it's interesting in your case that it happens only when rendering multiple fields.

EDIT: not a duplicate.