[ofa-general] Re: [PATCH 4/5] infiniband-diags/libibnetdisc: Introduce a context object.

Ira Weiny weiny2 at llnl.gov
Mon Aug 17 08:30:23 PDT 2009


On Sun, 16 Aug 2009 14:02:00 +0300
Sasha Khapyorsky <sashak at voltaire.com> wrote:

> On 20:43 Thu 13 Aug     , Ira Weiny wrote:
> > 
> > From: Ira Weiny <weiny2 at llnl.gov>
> > Date: Thu, 13 Aug 2009 20:16:01 -0700
> > Subject: [PATCH] infiniband-diags/libibnetdisc: Introduce a context object.
> > 
> > 	This object must be created before query functions can be used and is
> > 	used to control the functionality of the queries.
> 
> Why is it needed? I see that it complicates API, but what is a benefits?

The immediate benefit is coming with the multi-threaded implementation where
I plan on adding the following function.[*]

ibnd_set_num_threads(ibnd_ctx_t *ctx, int num);

Set/get functions can be added for anything which we need to pass to discover
without changing the discover (or other query) functionality and breaking the
API.

This also allows us to keep some state for the library private.  For example,
I might persist threads across calls to discover and only destroy them on a
ibnd_destroy_ctx call.

Ira

[*] and the reason behind this function is that I feel the proper number of
threads is going to be variable depending on the size and layout of the fabric
being processed as well as the number of CPU's available on the node.

> 
> Sasha


-- 
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
weiny2 at llnl.gov



More information about the general mailing list