diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb31a1be1..929f0e1b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ include: - apt-get install --yes --no-install-recommends ssh - curl https://download.open-mpi.org/release/open-mpi/v${OPENMPI_VER}/openmpi-${OPENMPI_VER_FULL}.tar.gz --output openmpi.tar.gz - tar xf openmpi.tar.gz + - patch -p1 -d openmpi-${OPENMPI_VER_FULL} < conf/ompi_rootenv.patch - pushd openmpi-${OPENMPI_VER_FULL} - ./configure --with-cuda --prefix=${HOME}/mpi - make -j diff --git a/conf/ompi_rootenv.patch b/conf/ompi_rootenv.patch new file mode 100644 index 000000000..64c6035e8 --- /dev/null +++ b/conf/ompi_rootenv.patch @@ -0,0 +1,28 @@ +Allow override environment variables to work. This is required for running as root inside a docker container (e.g. Gitlab CI) + +See https://github.com/open-mpi/ompi/pull/5597#issuecomment-520612783 +--- a/orte/tools/orterun/orterun.c ++++ b/orte/tools/orterun/orterun.c +@@ -143,6 +143,14 @@ int orterun(int argc, char *argv[]) + * exit with a giant warning flag + */ + if (0 == geteuid() && !orte_cmd_options.run_as_root) { ++ char *r1, *r2; ++ if (NULL != (r1 = getenv("OMPI_ALLOW_RUN_AS_ROOT")) && ++ NULL != (r2 = getenv("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"))) { ++ if (0 == strcmp(r1, "1") && 0 == strcmp(r2, "1")) { ++ goto moveon; ++ } ++ } ++ + fprintf(stderr, "--------------------------------------------------------------------------\n"); + if (NULL != orte_cmd_options.help) { + fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename); +@@ -160,6 +168,7 @@ int orterun(int argc, char *argv[]) + exit(1); + } + ++ moveon: + /* setup to listen for commands sent specifically to me, even though I would probably + * be the one sending them! Unfortunately, since I am a participating daemon, + * there are times I need to send a command to "all daemons", and that means *I* have