99 * reserved.
1010 * Copyright (c) 2015 Research Organization for Information Science
1111 * and Technology (RIST). All rights reserved.
12+ * Copyright (c) 2015 Intel, Inc. All rights reserved.
1213 * $COPYRIGHT$
1314 *
1415 * Additional copyrights may follow
@@ -41,43 +42,6 @@ static const char FUNC_NAME[] = "OMPI_Affinity";
4142static const char ompi_nobind_str [] = "Open MPI did not bind this process" ;
4243static const char not_bound_str [] = "Not bound (i.e., bound to all processors)" ;
4344
44- /**************************************************************************
45- * Utility routine
46- **************************************************************************/
47-
48- static void no_hwloc_support (char ompi_bound [OMPI_AFFINITY_STRING_MAX ],
49- char current_binding [OMPI_AFFINITY_STRING_MAX ],
50- char exists [OMPI_AFFINITY_STRING_MAX ])
51- {
52- strncpy (ompi_bound , "Not supported" , OMPI_AFFINITY_STRING_MAX );
53- strncpy (current_binding , "Not supported" , OMPI_AFFINITY_STRING_MAX );
54- strncpy (exists , "Not supported" , OMPI_AFFINITY_STRING_MAX );
55- }
56-
57- /**************************************************************************
58- * If we have no hwloc support compiled in, do almost nothing.
59- **************************************************************************/
60-
61- #if !OPAL_HAVE_HWLOC
62- /*
63- * If hwloc support was not compiled in, then just return "Not
64- * supported".
65- */
66- int OMPI_Affinity_str (ompi_affinity_fmt_t fmt_type ,
67- char ompi_bound [OMPI_AFFINITY_STRING_MAX ],
68- char current_binding [OMPI_AFFINITY_STRING_MAX ],
69- char exists [OMPI_AFFINITY_STRING_MAX ])
70- {
71- no_hwloc_support (ompi_bound , current_binding , exists );
72- return MPI_SUCCESS ;
73- }
74- #endif // !OPAL_HAVE_HWLOC
75-
76- /**************************************************************************
77- * If we have hwloc support compiled in, do the actual work.
78- **************************************************************************/
79-
80- #if OPAL_HAVE_HWLOC
8145
8246static int get_rsrc_ompi_bound (char str [OMPI_AFFINITY_STRING_MAX ]);
8347static int get_rsrc_current_binding (char str [OMPI_AFFINITY_STRING_MAX ]);
@@ -99,29 +63,27 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
9963
10064 /* If we have no hwloc support, return nothing */
10165 if (NULL == opal_hwloc_topology ) {
102- no_hwloc_support (ompi_bound , current_binding , exists );
103-
10466 return MPI_SUCCESS ;
10567 }
10668
10769 /* Otherwise, return useful information */
10870 switch (fmt_type ) {
10971 case OMPI_AFFINITY_RSRC_STRING_FMT :
110- if (OMPI_SUCCESS != (ret = get_rsrc_ompi_bound (ompi_bound )) ||
111- OMPI_SUCCESS != (ret = get_rsrc_current_binding (current_binding )) ||
112- OMPI_SUCCESS != (ret = get_rsrc_exists (exists ))) {
113- return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD , ret , FUNC_NAME );
114- }
115- break ;
72+ if (OMPI_SUCCESS != (ret = get_rsrc_ompi_bound (ompi_bound )) ||
73+ OMPI_SUCCESS != (ret = get_rsrc_current_binding (current_binding )) ||
74+ OMPI_SUCCESS != (ret = get_rsrc_exists (exists ))) {
75+ return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD , ret , FUNC_NAME );
76+ }
77+ break ;
11678 case OMPI_AFFINITY_LAYOUT_FMT :
117- if (OMPI_SUCCESS != (ret = get_layout_ompi_bound (ompi_bound )) ||
118- OMPI_SUCCESS != (ret = get_layout_current_binding (current_binding )) ||
119- OMPI_SUCCESS != (ret = get_layout_exists (exists ))) {
120- return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD , ret , FUNC_NAME );
121- }
122- break ;
79+ if (OMPI_SUCCESS != (ret = get_layout_ompi_bound (ompi_bound )) ||
80+ OMPI_SUCCESS != (ret = get_layout_current_binding (current_binding )) ||
81+ OMPI_SUCCESS != (ret = get_layout_exists (exists ))) {
82+ return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD , ret , FUNC_NAME );
83+ }
84+ break ;
12385 default :
124- return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD , MPI_ERR_ARG , FUNC_NAME );
86+ return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD , MPI_ERR_ARG , FUNC_NAME );
12587 }
12688
12789 return MPI_SUCCESS ;
@@ -457,4 +419,3 @@ static int get_layout_exists(char str[OMPI_AFFINITY_STRING_MAX])
457419
458420 return OMPI_SUCCESS ;
459421}
460- #endif /* OPAL_HAVE_HWLOC */
0 commit comments