mpid_nem_network.c 1.64 KB
Newer Older
1
2
3
4
5
6
7
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
 *  (C) 2006 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

#include "mpid_nem_impl.h"
8
9
10
#ifdef HAVE_STRINGS_H
    #include "strings.h"
#endif
11

12
13
14
/* initialize to prevent the compiler from generating common symbols */
MPID_nem_netmod_funcs_t *MPID_nem_netmod_func = NULL;
int MPID_nem_netmod_id = -1;
15

16
17
MPID_nem_net_module_vc_dbg_print_sendq_t  MPID_nem_net_module_vc_dbg_print_sendq = 0;

18
#undef FUNCNAME
19
#define FUNCNAME MPID_nem_choose_netmod
20
21
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
22
int MPID_nem_choose_netmod(void)
23
24
{
    int mpi_errno = MPI_SUCCESS;
25
26
27
28
29
    int i;
    MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_CHOOSE_NETMOD);

    MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_CHOOSE_NETMOD);

30
    if (strcmp(MPIR_PARAM_NEMESIS_NETMOD, "") == 0)
31
32
33
    {
        /* netmod not specified, using the default */
        MPID_nem_netmod_func = MPID_nem_netmod_funcs[0];
34
        MPID_nem_netmod_id = 0;
35
36
37
38
39
        goto fn_exit;
    }

    for (i = 0; i < MPID_nem_num_netmods; ++i)
    {
40
        if (!MPIU_Strncasecmp(MPIR_PARAM_NEMESIS_NETMOD, MPID_nem_netmod_strings[i], MPID_NEM_MAX_NETMOD_STRING_LEN))
41
42
        {
            MPID_nem_netmod_func = MPID_nem_netmod_funcs[i];
43
            MPID_nem_netmod_id = i;
44
45
46
#ifdef ENABLE_COMM_OVERRIDES
            MPIDI_Anysource_iprobe_fn = MPID_nem_netmod_func->anysource_iprobe;
#endif
47
48
49
50
            goto fn_exit;
        }
    }

51
52
    MPIU_ERR_SETANDJUMP1(mpi_errno, MPI_ERR_OTHER, "**invalid_netmod", "**invalid_netmod %s", MPIR_PARAM_NEMESIS_NETMOD);

53
54
55
56
57
58
 fn_exit:
    MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_CHOOSE_NETMOD);
    return mpi_errno;
 fn_fail:

    goto fn_exit;
59
}