Skip to content

Add wait_for_devices_ready utility to pathwaysutils. - #314

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_968248469
Open

Add wait_for_devices_ready utility to pathwaysutils.#314
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_968248469

Conversation

@copybara-service

Copy link
Copy Markdown

Add wait_for_devices_ready utility to pathwaysutils.

Workloads connecting to Pathways or initializing JAX may need to ensure all target devices are placed, warm, and ready to accept computations before starting training or inference.

@copybara-service
copybara-service Bot force-pushed the test_968248469 branch 2 times, most recently from 0daf83d to cf95576 Compare August 21, 2026 05:19
Comment thread pathwaysutils/_initialize.py Outdated

_logger.info("Waiting for %d devices to be ready.", len(devices))
results = [jax.jit(lambda x: x + 1, device=d)(0) for d in devices]
jax.block_until_ready(results)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add a timeout here (controlled through an arg)

E.g. users might want to fail fast if devices are not ready after 30 mins.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Workloads connecting to Pathways or initializing JAX may need to ensure all target devices are placed, warm, and ready to accept computations before starting training or inference.

PiperOrigin-RevId: 968248469
)


def wait_for_devices_ready(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty much duplicating the existing wait_for_slices API at https://github.com/AI-Hypercomputer/pathways-utils/blob/main/pathwaysutils%2Felastic%2Felastic.py#L173

Please clarify why you cannot use that API or propose a modification to that API to fit your desired use case

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API is different and implementation is as well. The elastic wait for slices does more things.

I wanted an API that waits_for_devices_ready and requires no arguments to pass or figure out how many slices there are. In addition I don't want to have to check the return status. I just want it to wait on for all devices to be ready and continue when they are ready. Or raise an exception when timeout is specified and timeout is reached.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest writing a wrapper over that API so you do not do duplicate work like checking for timeout, test program to check health etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants