Skip to content

Boweny/single controller #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 86 commits into
base: main
Choose a base branch
from
Open

Boweny/single controller #114

wants to merge 86 commits into from

Conversation

bowenyang008
Copy link
Collaborator

No description provided.

# NOTE we have to keep all the MCT orchestrator started processes alive with this barrier
# until the ray cluster is stopped, otherwise the MCT orchestrator will reclaim the resources
# once the processes on a node exit
dist.barrier()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you want a barrier here if im understanding correctly, because then it will timeout once the dist timeout is hit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

indeed, didn't find any good way to enable unlimited timeout for barrier (torch has one that accepts arbitrary long timeout but still not simply unlimited), so added a comment that we may still need a SyncActor

Copy link
Collaborator

@rithwik-db rithwik-db Jul 21, 2025

Choose a reason for hiding this comment

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

In that case, do we want to use the longest reasonable timeout until we add support for a SyncActor (instead of using the default timeout)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

my plan is just to use SyncActor again in a following PR, it is a bit to define longest reasonable timeout, e.g., we can define it to 1 year or more, but that's a bit odd


def init_model(self, model_name: str):
"""Initialize the model."""
self.model = AutoModelForCausalLM.from_pretrained(
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think you want torch_dtype auto, might end up with bf16 master weights. should always be float 32. i know this is just a test, just noting

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed it and seems still working

@bowenyang008 bowenyang008 marked this pull request as ready for review July 21, 2025 20:44
Returns:
bool: True if Ray is setting CUDA_VISIBLE_DEVICES, False otherwise
"""
return os.environ.get(
Copy link
Collaborator

@rithwik-db rithwik-db Jul 21, 2025

Choose a reason for hiding this comment

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

Is this something we want to support or should we disable this feature entirely?

os.environ['RANK'] = str(rank)

# Set LOCAL_RANK based on Ray GPU allocation
os.environ['LOCAL_RANK'] = '0' if is_cuda_visible_devices_set(
Copy link
Collaborator

@rithwik-db rithwik-db Jul 21, 2025

Choose a reason for hiding this comment

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

Seems that setting all nodes' LOCAL_RANK=0 would lead to lack of 2D parallelism compatibility down the line, right?

self.master_port = master_port

# Set up basic environment variables
os.environ['WORLD_SIZE'] = str(world_size)
Copy link
Collaborator

@rithwik-db rithwik-db Jul 21, 2025

Choose a reason for hiding this comment

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

Would updating these env vars lead to issues with the base (gloo) process group defined here or is that process group no longer relevant?

'GPU': 1,
'CPU': 1,
'worker_node': 1,
}] * tensor_parallel_size * num_engines
'worker_node': 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious what the impact of changing worker_node to 0 means in this case? I would assume it makes sense, but wanted to understand if you knew why it was 1 originally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah, good catch, the default should be 1 and am allowing 0 basically for single node testing otherwise it is forcing allocating an entire node for inference engine

def init_train_process_group(self):
"""Initialize the distributed process group."""
# Initialize process group
dist.init_process_group(timeout=timedelta(seconds=30))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also curious about the implications about using dist.init_process_group here and using the vllm_utils.py specific init_process_group for creating the vllm engine...

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