Skip to content

Commit

Permalink
Merge pull request #948 from eisenhauer/DPPrioParams
Browse files Browse the repository at this point in the history
Pass Params to DP in the GetPriority phase
  • Loading branch information
eisenhauer committed Oct 24, 2018
2 parents 5ddb6de + cb9c252 commit b18132f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion source/adios2/toolkit/sst/cp/cp_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ SstStream SstReaderOpen(const char *Name, SstParams Params, MPI_Comm comm)
CP_validateParams(Stream, Params, 0 /* reader */);
Stream->ConfigParams = Params;

Stream->DP_Interface = SelectDP(&Svcs, Stream, Stream->DataTransport);
Stream->DP_Interface = SelectDP(&Svcs, Stream, Stream->ConfigParams);

Stream->CPInfo = CP_getCPInfo(Stream->DP_Interface);

Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/sst/cp/cp_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ SstStream SstWriterOpen(const char *Name, SstParams Params, MPI_Comm comm)
Stream->ConfigParams = Params;

char *Filename = strdup(Name);
Stream->DP_Interface = SelectDP(&Svcs, Stream, Stream->DataTransport);
Stream->DP_Interface = SelectDP(&Svcs, Stream, Stream->ConfigParams);

if (!Stream->DP_Interface)
{
Expand Down
21 changes: 12 additions & 9 deletions source/adios2/toolkit/sst/dp/dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ typedef struct _DPElement
} * DPlist;

static DPlist AddDPPossibility(CP_Services Svcs, void *CP_Stream, DPlist List,
CP_DP_Interface Interface, const char *Name)
CP_DP_Interface Interface, const char *Name,
struct _SstParams *Params)
{
int Count = 0;
if (Interface == NULL)
Expand All @@ -42,39 +43,41 @@ static DPlist AddDPPossibility(CP_Services Svcs, void *CP_Stream, DPlist List,
}
List[Count].Interface = Interface;
List[Count].Name = Name;
List[Count].Priority = Interface->getPriority(Svcs, CP_Stream);
List[Count].Priority = Interface->getPriority(Svcs, CP_Stream, Params);
List[Count + 1].Interface = NULL;
return List;
}

CP_DP_Interface SelectDP(CP_Services Svcs, void *CP_Stream,
const char *PreferredDP)
struct _SstParams *Params)
{
CP_DP_Interface Ret;
DPlist List = NULL;
List = AddDPPossibility(Svcs, CP_Stream, List, LoadEVpathDP(), "evpath");
List = AddDPPossibility(Svcs, CP_Stream, List, LoadEVpathDP(), "evpath",
Params);
#ifdef SST_HAVE_LIBFABRIC
List = AddDPPossibility(Svcs, CP_Stream, List, LoadRdmaDP(), "rdma");
List =
AddDPPossibility(Svcs, CP_Stream, List, LoadRdmaDP(), "rdma", Params);
#endif /* SST_HAVE_LIBFABRIC */

int SelectedDP = -1;
int BestPriority = -1;
int BestPrioDP = -1;
int i = 0;
if (PreferredDP)
if (Params->DataTransport)
{
Svcs->verbose(CP_Stream, "Prefered dataplane name is \"%s\"\n",
PreferredDP);
Params->DataTransport);
}
while (List[i].Interface)
{
Svcs->verbose(
CP_Stream,
"Considering DataPlane \"%s\" for possible use, priority is %d\n",
List[i].Name, List[i].Priority);
if (PreferredDP)
if (Params->DataTransport)
{
if (strcasecmp(List[i].Name, PreferredDP) == 0)
if (strcasecmp(List[i].Name, Params->DataTransport) == 0)
{
SelectedDP = i;
break;
Expand Down
3 changes: 2 additions & 1 deletion source/adios2/toolkit/sst/dp/evpath_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,8 @@ static FMStructDescRec EvpathTimestepInfoStructs[] = {

static struct _CP_DP_Interface evpathDPInterface;

static int EvpathGetPriority(CP_Services Svcs, void *CP_Stream)
static int EvpathGetPriority(CP_Services Svcs, void *CP_Stream,
struct _SstParams *Params)
{
/* The evpath DP should be a lower priority than any RDMA dp, so return 1 */
return 1;
Expand Down
3 changes: 2 additions & 1 deletion source/adios2/toolkit/sst/dp/rdma_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,8 @@ static struct _CP_DP_Interface RdmaDPInterface;
* "priority" return value represents some desirability measure
* (like expected bandwidth or something).
*/
static int RdmaGetPriority(CP_Services Svcs, void *CP_Stream)
static int RdmaGetPriority(CP_Services Svcs, void *CP_Stream,
struct _SstParams *Params)
{
int Ret = -1;
Svcs->verbose(
Expand Down
7 changes: 4 additions & 3 deletions source/adios2/toolkit/sst/dp_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,15 @@ typedef void (*CP_DP_ReleaseTimestepFunc)(CP_Services Svcs, DP_WS_Stream Stream,
* function that returns the relative priority of this particular
* dataplane WRT other dataplanes. Its return value is an integer
* where higher means higher priority (more desirable) and -1 means
* that the dataplane cannot be used. The function is really indented
* that the dataplane cannot be used. The function is really intended
* to support dataplanes for which we cannot determine at compile-time
* whether or not the run-time conditions will support their use
* (libfabric is the primum exemplum). The Svcs and CP_Stream
* parameters exist only to support verbosity in the DP-level
* function.
*/
typedef int (*CP_DP_GetPriorityFunc)(CP_Services Svcs, void *CP_Stream);
typedef int (*CP_DP_GetPriorityFunc)(CP_Services Svcs, void *CP_Stream,
struct _SstParams *Params);

/*!
* CP_DP_UnGetPriorityFunc is the type of a dataplane initialization
Expand Down Expand Up @@ -292,6 +293,6 @@ struct _CP_Services
};

CP_DP_Interface SelectDP(CP_Services Svcs, void *CP_Stream,
const char *prefered_dp);
struct _SstParams *Params);

#endif

0 comments on commit b18132f

Please sign in to comment.