code: def _compile_dependencies():
      args = get_args()
  
      # =========================
      # Compile dataset C++ code.
      # =========================
      # TODO: move this to ninja
      if torch.distributed.get_rank() == 0:
          start_time = time.time()
          print("> compiling dataset index builder ...")
          from megatron.core.datasets.utils import compile_helpers
  
          compile_helpers()
          print(
              ">>> done with dataset index builder. Compilation time: {:.3f} "
              "seconds".format(time.time() - start_time),
              flush=True,
          )
  
      # ==================
      # Load fused kernels
      # ==================
  
      # Custom kernel constraints check.
      seq_len = args.seq_length
      attn_batch_size = (
          args.num_attention_heads / args.tensor_model_parallel_size
      ) * args.micro_batch_size
      # Constraints on sequence length and attn_batch_size to enable warp based
      # optimization and upper triangular optimization (for causal mask)
      custom_kernel_constraint = (
          seq_len > 16
          and seq_len <= 16384
          and seq_len % 4 == 0
          and attn_batch_size % 4 == 0
      )
      # Print a warning.
      if not (
          (args.fp16 or args.bf16)
          and custom_kernel_constraint
          and args.masked_softmax_fusion
      ):
          if args.rank == 0:
              print(
                  "WARNING: constraints for invoking optimized"
                  " fused softmax kernel are not met. We default"
                  " back to unfused kernel invocations.",
                  flush=True,
              )
  
      # Always build on rank zero first.
      if torch.distributed.get_rank() == 0:
          start_time = time.time()
          print("> compiling and loading fused kernels ...", flush=True)
          fused_kernels.load(args)
          torch.distributed.barrier()
      else:
          torch.distributed.barrier()
          fused_kernels.load(args)
      # Simple barrier to make sure all ranks have passed the
      # compilation phase successfully before moving on to the
      # rest of the program. We think this might ensure that
      # the lock is released.
      torch.distributed.barrier()
      if torch.distributed.get_rank() == 0:
          print(
              ">>> done with compiling and loading fused kernels. "
              "Compilation time: {:.3f} seconds".format(
                  time.time() - start_time
              ),
              flush=True,
          )
  
imports: import random
  import os
  import time
  import numpy
  import torch
  from datetime import timedelta
  from megatron import fused_kernels
  from megatron import get_adlr_autoresume
  from megatron import get_args
  from megatron import get_tensorboard_writer
  from megatron.core import mpu, tensor_parallel
  from megatron.arguments import parse_args, validate_args
  from megatron.checkpointing import load_args_from_checkpoint
  from megatron.global_vars import set_global_variables
  from megatron.model.transformer import bias_dropout_add_fused_train
  from megatron.model.fused_bias_gelu import bias_gelu
label_desc: Use image node_id 2 for calling a global function with example usage: _compile_dependencies() without return types