Mpirun Authorization required, but no authorization protocol specified

You may try to run mpirun between two systems, and you may get a warning like this:

florin@spark:~$ mpirun -H media uptime
Authorization required, but no authorization protocol specified

Authorization required, but no authorization protocol specified

 18:01:02 up 17:51,  3 users,  load average: 0.00, 0.00, 0.00

This may happen when the target machine (or perhaps even both machines? not sure) is running X11, but you’re not actually using the GUI, you just run commands remotely on that machine (mpirun over ssh).

There are many opinions about this issue online. What it boils down to is this: mpirun invokes orted on the target machine, orted tries to run something related to X11 for some bizarre and unrelated reason (I think the package is misconfigured), and fails because it does not have the right permissions or settings.

You can read a long discussion on this topic on the Open MPI repo:

Here’s the solution in a nutshell:

You can stop orted from doing that if you pass it this environment variable: HWLOC_COMPONENTS=-gl. You could try to export that variable in ~/.bashrc on the target machine, but it will not work.

The reason is that Ubuntu has a guard at the top of ~/.bashrc that prevents non-interactive tasks from using that file. Your task (launched by mpirun over the network to the target machine) is non-interactive.

The solution: export that variable at the top of ~/.bashrc before the guard. It’s extremely unlikely it will harm anything this way, the name of that variable is quite unique. Make it look like this:

florin@media:~$ head -n 14 ~/.bashrc 
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# export this var for all sessions, before the interactive check
# it's only needed for mpirun / orted and should not harm anything else
# https://github.com/open-mpi/ompi/issues/13535
export HWLOC_COMPONENTS=-gl

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

You may add it to all machines that run mpirun but I think it’s only really needed on the target machines (mpirun reaches out to them over the network) and only if they still have the GUI enabled. YMMV

Moving to GB10 projects