Hi guys,
I'm using OpenMPI 1.10.1 with gasnet and ompss @ cluster on Ubuntu 14.04.3 (linux 3.19.0-33).

When I launch mpirun, I need to pass some (ompss/nanos++) environment variable like NX_ARGS
in the following way:
export NX_ARGS="--verbose --cluster --cluster-network=mpi"
mpirun -np 2 -hostfile myhostfile -x NX_ARGS -x LD_PRELOAD testapp

I saw that NX_ARGS is not passed and I found the problem in the orte/tools/orterun/orterun.c file. In line 1739, after use getenv(), you check if there is '=' in the string. If it's true, you assumed that the string is in the form 'param'='value', but in this case fails, because
getenv() POSIX specification always returns a pointer to the value
in the environment, without "param=".

The following patch solve this problem for OpenMPI 1.10.1:
--- orte/tools/orterun/orterun.c.orig    2015-12-01 15:14:27.798014356 +0100
+++ orte/tools/orterun/orterun.c    2015-12-01 15:15:12.574013555 +0100
@@ -1736,17 +1736,11 @@
             } else {
                 value = getenv(param);
                 if (NULL != value) {
-                    if (NULL != strchr(value, '=')) {
- opal_argv_append_nosize(&app->env, value);
-                        /* save it for any comm_spawn'd apps */
- opal_argv_append_nosize(&orte_forwarded_envars, value);
-                    } else {
                         asprintf(&value2, "%s=%s", param, value);
opal_argv_append_nosize(&app->env, value2);
                         /* save it for any comm_spawn'd apps */
opal_argv_append_nosize(&orte_forwarded_envars, value2);
                         free(value2);
-                    }
                 } else {
opal_output(0, "Warning: could not find environment variable \"%s\"\n", param);
                 }


I noticed that the development repo (https://github.com/open-mpi/ompi) doesn't have this bug, but the release repo (https://github.com/open-mpi/ompi-release) has this bug and I send a pull request to solve it.
(https://github.com/open-mpi/ompi-release/pull/792)

Cheers,
Stefano

--
Stefano Garzarella
Software Engineer

Evidence Srl
http://www.evidence.eu.com
Via Carducci 56 - Localita' Ghezzano
56010 S.Giuliano Terme Pisa - Italy
Phone: +39 050 99 11 122
Fax: +39 050 99 10 812

Reply via email to