Yeah. Though it would be best to just check the source when you need to
see if it should come from the ini. Then if we need to set the value
from the ini either use mca_base_var_set_value or be sure to strdup when
changing the receive_queues value.

The thing to remember is the use may do this:

MPI_T_init_thread ();
set btl_openib_receive_queues using the MPI_T_cvar interface
MPI_Init ()

And you need to catch that case.

-Nathan

On Tue, Jul 29, 2014 at 06:06:33PM -0400, Joshua Ladd wrote:
>    Thanks, Nathan
> 
>    This is a user's patch. So, if I understand correctly, the best thing
>    would be to:
>    vari = mca_base_var_find ("opal", "btl", "openib", "receive_queues");
> 
>    mca_base_var_get_value (vari, NULL, &source, NULL);
> 
>     mca_btl_openib_component.
>    receive_queues_source = source
> 
>    Instead of doing this weird strcmp which assumes that if the variable
>    value is the same as the default, then it was not passed in as an MCA
>    param.
> 
>     mca_btl_openib_component.
>    receive_queues_source = source
>    > -        (0 == strcmp(default_qps,
>    > -                     mca_btl_openib_component.receive_queues)) ?
>    > -        BTL_OPENIB_RQ_SOURCE_DEFAULT : BTL_OPENIB_RQ_SOURCE_MCA;
> 
>    Josh
> 
>    On Tue, Jul 29, 2014 at 5:53 PM, Nathan Hjelm <hje...@lanl.gov> wrote:
> 
>      Josh, you can not free from a memory location that has been registered
>      with the MCA variable system. It will likely SEGV when the component is
>      unloaded.
> 
>      You should call mca_base_var_get_value to get the source of the
>      value. The following should do it:
> 
>      vari = mca_base_var_find ("opal", "btl", "openib", "receive_queues");
> 
>      mca_base_var_get_value (vari, NULL, &source, NULL);
> 
>      If the source is MCA_BASE_VAR_SOURCE_DEFAULT then the value was not
>      modified by a file, the enviornment, or MPI_T.
> 
>      -Nathan
> 
>      On Tue, Jul 29, 2014 at 05:42:20PM -0400, svn-commit-mai...@open-mpi.org
>      wrote:
>      > Author: jladd (Joshua Ladd)
>      > Date: 2014-07-29 17:42:20 EDT (Tue, 29 Jul 2014)
>      > New Revision: 32346
>      > URL: https://svn.open-mpi.org/trac/ompi/changeset/32346
>      >
>      > Log:
>      > This fixes the OpenIB BTL receive queue selection logic in the trunk.
>      Custom patch for 1.8.2 is provided in Refs #4816
>      >
>      > Text files modified:
>      >    trunk/opal/mca/btl/openib/btl_openib_component.c |    11
>      +++++++++++
>      >    trunk/opal/mca/btl/openib/btl_openib_mca.c       |    12
>      +++++++-----
>      >    2 files changed, 18 insertions(+), 5 deletions(-)
>      >
>      > Modified: trunk/opal/mca/btl/openib/btl_openib_component.c
>      >
>      
> ==============================================================================
>      > --- trunk/opal/mca/btl/openib/btl_openib_component.c  Tue Jul 29
>      14:59:59 2014        (r32345)
>      > +++ trunk/opal/mca/btl/openib/btl_openib_component.c  2014-07-29
>      17:42:20 EDT (Tue, 29 Jul 2014)      (r32346)
>      > @@ -265,6 +265,17 @@
>      >      opal_btl_openib_fd_finalize();
>      >      opal_btl_openib_ini_finalize();
>      >
>      > +    if (NULL != mca_btl_openib_component.receive_queues
>      > +            && BTL_OPENIB_RQ_SOURCE_DEFAULT ==
>      > +                          
>       mca_btl_openib_component.receive_queues_source) {
>      > +        /*
>      > +         * In that case, the string has not been duplicated during
>      variable
>      > +         * registration. So it won't be freed by the mca_base_var
>      system.
>      > +         * Free it here.
>      > +         */
>      > +        free(mca_btl_openib_component.receive_queues);
>      > +    }
>      > +
>      >      if (NULL != mca_btl_openib_component.default_recv_qps) {
>      >          free(mca_btl_openib_component.default_recv_qps);
>      >      }
>      >
>      > Modified: trunk/opal/mca/btl/openib/btl_openib_mca.c
>      >
>      
> ==============================================================================
>      > --- trunk/opal/mca/btl/openib/btl_openib_mca.c        Tue Jul 29
>      14:59:59 2014        (r32345)
>      > +++ trunk/opal/mca/btl/openib/btl_openib_mca.c        2014-07-29
>      17:42:20 EDT (Tue, 29 Jul 2014)      (r32346)
>      > @@ -661,12 +661,14 @@
>      >      mca_btl_openib_component.default_recv_qps = default_qps;
>      >      CHECK(reg_string("receive_queues", NULL,
>      >                       "Colon-delimited, comma-delimited list of
>      receive queues: P,4096,8,6,4:P,32768,8,6,4",
>      > -                     default_qps,
>      &mca_btl_openib_component.receive_queues,
>      > +                     NULL, &mca_btl_openib_component.receive_queues,
>      >                       0));
>      > -    mca_btl_openib_component.receive_queues_source =
>      > -        (0 == strcmp(default_qps,
>      > -                     mca_btl_openib_component.receive_queues)) ?
>      > -        BTL_OPENIB_RQ_SOURCE_DEFAULT : BTL_OPENIB_RQ_SOURCE_MCA;
>      > +    if (NULL == mca_btl_openib_component.receive_queues) {
>      > +        mca_btl_openib_component.receive_queues =
>      strdup(default_qps);
>      > +        mca_btl_openib_component.receive_queues_source =
>      BTL_OPENIB_RQ_SOURCE_DEFAULT;
>      > +    } else {
>      > +        mca_btl_openib_component.receive_queues_source =
>      BTL_OPENIB_RQ_SOURCE_MCA;
>      > +    }
>      >
>      >      CHECK(reg_string("if_include", NULL,
>      >                       "Comma-delimited list of devices/ports to be
>      used (e.g. \"mthca0,mthca1:2\"; empty value means to use all ports
>      found).  Mutually exclusive with btl_openib_if_exclude.",
>      > _______________________________________________
>      > svn mailing list
>      > s...@open-mpi.org
>      > http://www.open-mpi.org/mailman/listinfo.cgi/svn
> 
>      _______________________________________________
>      devel mailing list
>      de...@open-mpi.org
>      Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
>      Link to this post:
>      http://www.open-mpi.org/community/lists/devel/2014/07/15330.php

> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: 
> http://www.open-mpi.org/community/lists/devel/2014/07/15331.php

Attachment: pgpIdhRxxNw1t.pgp
Description: PGP signature

Reply via email to