Skip to main content

MegatronInstaller

Struct MegatronInstaller 

Source
pub struct MegatronInstaller { /* private fields */ }
Expand description

The Megatron-LM installer.

Implementations§

Source§

impl MegatronInstaller

Source

pub fn new(config: MegatronConfig) -> Self

Create a new Megatron installer with the given config.

Source

pub fn with_defaults() -> Self

Create with default config.

Source

pub fn dependencies(&self) -> &[&str]

Get the list of required dependencies.

Megatron-LM depends on:

  • PyTorch (ROCm-enabled)
  • MPI4Py
Source

pub fn rocm_env(&self, rocm_env: &RocmEnv) -> Vec<(String, String)>

Get the ROCm environment variables needed for Megatron.

The original script sets:

  • AMD_LOG_LEVEL=0
  • HIP_VISIBLE_DEVICES
  • ROCR_VISIBLE_DEVICES
  • HSA_OVERRIDE_GFX_VERSION=11.0.0
  • PYTORCH_ROCM_ARCH=gfx1100
  • ROCM_PATH
  • HSA_TOOLS_LIB
  • PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
Source

pub fn build_git_clone_command(&self) -> ShellCommand

Construct the git clone command for Megatron-LM.

The original script clones: git clone https://github.com/NVIDIA/Megatron-LM.git <dir>

It retries up to 3 times on failure.

Source

pub fn max_clone_retries(&self) -> u32

Get the maximum number of clone retries.

Source

pub fn build_pip_install_command(&self) -> ShellCommand

Construct the pip install command for Megatron-LM.

The original script installs with: pip install -e . --no-deps

The editable install is done from the cloned directory. Dependencies are resolved separately (safe requirements filtering).

§Pip Target Directory

The working directory is set to install_dir(), which is the git clone target directory. The NVIDIA/Megatron-LM repository has setup.py at the repository root (not in a subdirectory), so pip install -e . works correctly from the clone root.

Source

pub fn build_dep_install_command(&self, package: &str) -> ShellCommand

Construct the pip install command for a specific dependency.

Used for installing individual safe dependencies.

Source

pub fn build_requirements_install_command( &self, requirements_path: &str, ) -> ShellCommand

Construct a pip install command for a requirements file.

Source

pub fn is_safe_package(&self, package_name: &str) -> bool

Check if a Python package is safe to install (non-CUDA/non-NVIDIA).

Delegates to the single canonical blocklist crate::installers::common::nvidia_blocklist::is_cuda_nvidia_package (Stage 2: one unified rule for the “no nvidia deps ever” tenet).

Source

pub fn check_build_output( &self, stdout: &str, stderr: &str, exit_code: i32, ) -> Result<(), String>

Check build output for errors.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more