I think Jeff got lost in the weeds here. If you define a new MCA param in the 
default param file, we will automatically pick it up and it will be in the 
environment of your application. You don’t need to do anything. However, you 
checked for the wrong envar. Anything you provide is going to have an 
“OMPI_MCA_” attached to the front of it. So for your “apath” example, the envar 
will be

OMPI_MCA_apath

HTH
Ralph

> On Feb 24, 2017, at 7:25 AM, Jeff Squyres (jsquyres) <jsquy...@cisco.com> 
> wrote:
> 
> On Feb 24, 2017, at 10:11 AM, Dahai Guo <dahaiguo2...@yahoo.com> wrote:
>> 
>> oops, I should use the word "MCA parameters". If I define a MCA parameter 
>> (apath, for example) in etc/openmpi-mca-params.conf, how can function 
>> setup_fork in ompi/orte/mca/schizo/ompi/schizo_ompi.c get its value?  I 
>> tried to call getenv("apath") there, which return null. 
> 
> Settings MCA parameters does not necessarily set environment variables.  More 
> below.
> 
>> However, If I defined it in the cmd line, mpirun -mca apath=sth .., then I 
>> could get it in setup_fork.
> 
> There are multiple mechanisms in which MCA params are passed to the back-end 
> MPI processes.
> 
> 1. If they are set via "--mca a b" on the mpirun command line, they are 
> passed back to the launching orteds as part of the launch schema for the job. 
>  I.e., the MCA param names and values are bundled up and sent in the network 
> message to each of the orteds that are involved in the launching of the 
> target processes.  IIRC, the launching orteds will fork, setenv a 
> corresponding environment variable for each of the MCA param values in the 
> launch schema, and then exec the MPI process.  The MPI process then picks up 
> those MCA param values from the environment variables.
> 
> 2. If they are set via the openmpi-mca-params.conf file, they are not sent 
> via network message in the launch schema.  Instead, each Open MPI process 
> (including MPI processes and orteds) reads that file upon startup to get the 
> values (more specifically: all Open MPI processes *always* read this file 
> before processing whatever MCA param values are sent in the launch schema).  
> A consequence: if openmpi-mca-params.conf is not on a network filesystem (and 
> visible to all Open MPI processes on all servers), you need to copy the 
> change you made to the one openmpi-mca-params.conf file to all copies of 
> openmpi-mca-params.conf.
> 
> -----
> 
> What are you trying to do?
> 
> If you're working in an MPI application, you can use the MPI_T API to 
> retrieve MCA parameter names and their current values (regardless of whether 
> mechanism #1 or #2 -- or another mechanism -- is used).
> 
> If you're working in the Open MPI code base, you should be using the internal 
> opal_mca_var API to retrieve and/or set MCA param values.  See 
> https://github.com/open-mpi/ompi/blob/master/opal/mca/base/mca_base_var.h for 
> all the functions available in this API.
> 
> -- 
> Jeff Squyres
> jsquy...@cisco.com
> 
> _______________________________________________
> devel mailing list
> devel@lists.open-mpi.org
> https://rfd.newmexicoconsortium.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
devel@lists.open-mpi.org
https://rfd.newmexicoconsortium.org/mailman/listinfo/devel

Reply via email to