def run_script(args, gpu_id, self_id):
    """
    Run the script by passing the GPU ID and self ID to environment variables and execute the main.py script.

    Args:
        gpu_id (int): ID of the GPU.
        self_id (int): ID of the process.

    Returns:
        None
    """
    env = os.environ.copy()
    env["CUDA_VISIBLE_DEVICES"] = str(gpu_id)
    env["SELF_ID"] = str(self_id)

    command = (
        f"source {args.conda_path} &&"
        'eval "$(conda shell.bash hook)" && '
        f"conda activate {args.conda_env_name} && "
        "python main.py"
    )

    try:
        process = subprocess.Popen(command, shell=True, env=env, executable="/bin/bash")
        process.wait()
        logger.info(f"Process for GPU {gpu_id} completed successfully.")
    except KeyboardInterrupt:
        logger.warning(f"Multi - GPU {gpu_id}: Interrupted by keyboard, exiting...")
    except Exception as e:
        logger.error(f"Error occurred for GPU {gpu_id}: {e}")
Run the script by passing the GPU ID and self ID to environment variables and execute the main.py script.

Args:
gpu_id (int): ID of the GPU.
self_id (int): ID of the process.

Returns:
None
preprocessors/Emilia/main_multi.py