diff --git a/auxdir/x_ac_ofed.m4 b/auxdir/x_ac_ofed.m4 index 08ceea4c60c924cf04945030fd2a6836a0e2a831..8b7975b2a17df3252de8a43f15e4abc969910970 100644 --- a/auxdir/x_ac_ofed.m4 +++ b/auxdir/x_ac_ofed.m4 @@ -33,10 +33,13 @@ AC_DEFUN([X_AC_OFED], CPPFLAGS="-I$d/include $CPPFLAGS" _x_ac_ofed_libs_save="$LIBS" LIBS="-L$d/$bit -libmad -libumad $LIBS" - - AC_LINK_IFELSE( - [AC_LANG_CALL([], mad_rpc_open_port)], -AS_VAR_SET(x_ac_cv_ofed_dir, $d), []) + AC_LINK_IFELSE( + [AC_LANG_CALL([], mad_rpc_open_port)], + AS_VAR_SET(x_ac_cv_ofed_dir, $d), []) + AC_LINK_IFELSE( + [AC_LANG_CALL([], pma_query_via)], + [have_pma_query_via=yes], + [AC_MSG_RESULT(Using old libmad)]) CPPFLAGS="$_x_ac_ofed_cppflags_save" LIBS="$_x_ac_ofed_libs_save" test -n "$x_ac_cv_ofed_dir" && break @@ -52,6 +55,9 @@ AS_VAR_SET(x_ac_cv_ofed_dir, $d), []) OFED_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_ofed_dir/$bit -L$x_ac_cv_ofed_dir/$bit" OFED_LIBS="-libmad -libumad" AC_DEFINE(HAVE_OFED, 1, [Define to 1 if ofed library found]) + if test ! -z "$have_pma_query_via" ; then + AC_DEFINE(HAVE_OFED_PMA_QUERY_VIA, 1, [Define to 1 if using code with pma_query_via]) + fi fi AC_SUBST(OFED_LIBS) diff --git a/config.h.in b/config.h.in index abb11f19a01121e2040b70b37a19a2ef0f752162..239a1c4e8e4f93a04d85813373272882b1e7243c 100644 --- a/config.h.in +++ b/config.h.in @@ -191,6 +191,9 @@ /* Define to 1 if ofed library found */ #undef HAVE_OFED +/* Define to 1 if using code with pma_query_via */ +#undef HAVE_OFED_PMA_QUERY_VIA + /* define if you have openssl. */ #undef HAVE_OPENSSL diff --git a/configure b/configure index c659130537b13510f57779efc162be585c00f49c..ec9c120d4f1e8e70b7a62f83f096386f8b78ffa6 100755 --- a/configure +++ b/configure @@ -19801,8 +19801,7 @@ else CPPFLAGS="-I$d/include $CPPFLAGS" _x_ac_ofed_libs_save="$LIBS" LIBS="-L$d/$bit -libmad -libumad $LIBS" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -19823,6 +19822,32 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : x_ac_cv_ofed_dir=$d fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pma_query_via (); +int +main () +{ +return pma_query_via (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + have_pma_query_via=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using old libmad" >&5 +$as_echo "Using old libmad" >&6; } +fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$_x_ac_ofed_cppflags_save" @@ -19846,6 +19871,11 @@ $as_echo "$as_me: WARNING: unable to locate ofed installation" >&2;} $as_echo "#define HAVE_OFED 1" >>confdefs.h + if test ! -z "$have_pma_query_via" ; then + +$as_echo "#define HAVE_OFED_PMA_QUERY_VIA 1" >>confdefs.h + + fi fi diff --git a/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c b/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c index 848436e9db996fed724a8d302a02a4e92d35a7c4..e34cfc3fc5da87074b667e846d8c514c86216d07 100644 --- a/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c +++ b/src/plugins/acct_gather_infiniband/ofed/acct_gather_infiniband_ofed.c @@ -148,6 +148,50 @@ static pthread_t thread_ofed_id_run = 0; static pthread_t cleanup_handler_thread = 0; static pthread_mutex_t ofed_lock = PTHREAD_MUTEX_INITIALIZER; +static uint8_t *_slurm_pma_query_via(void *rcvbuf, ib_portid_t * dest, int port, + unsigned timeout, unsigned id, + const struct ibmad_port *srcport) +{ +#ifdef HAVE_OFED_PMA_QUERY_VIA + return pma_query_via(rcvbuf, dest, port, timeout, id, srcport); +#else + switch (id) { + case CLASS_PORT_INFO: + return perf_classportinfo_query_via( + pc, &portid, port, ibd_timeout, srcport); + break; + case IB_GSI_PORT_COUNTERS_EXT: + return port_performance_ext_query_via( + pc, &portid, port, ibd_timeout, srcport); + break; + default: + error("_slurm_pma_query_via: unhandled id"); + } + return NULL; +#endif +} + +static uint8_t *_slurm_performance_reset_via(void *rcvbuf, ib_portid_t * dest, + int port, unsigned mask, + unsigned timeout, unsigned id, + const struct ibmad_port *srcport) +{ +#ifdef HAVE_OFED_PMA_QUERY_VIA + return performance_reset_via( + pc, &portid, port, mask, ibd_timeout, id, srcport); +#else + switch (id) { + case IB_GSI_PORT_COUNTERS_EXT: + return port_performance_ext_reset_via( + pc, &portid, port, mask, ibd_timeout, srcport); + break; + default: + error("_slurm_performance_reset_via: unhandled id"); + } + return NULL; +#endif +} + static void _task_sleep(int rem) { while (rem) @@ -173,8 +217,8 @@ static int _read_ofed_values(void) memset(pc, 0, sizeof(pc)); memcpy(&cap_mask, pc + 2, sizeof(cap_mask)); - if (!port_performance_ext_query_via(pc, &portid, port, ibd_timeout, - srcport)) { + if (!_slurm_pma_query_via(pc, &portid, port, ibd_timeout, + IB_GSI_PORT_COUNTERS_EXT, srcport)) { error("ofed: %m"); exit(1); } @@ -203,8 +247,10 @@ static int _read_ofed_values(void) if (send_val > reset_limit || recv_val > reset_limit) { /* reset cost ~70 mirco secs */ - if (!port_performance_ext_reset_via(pc, &portid, port, mask, - ibd_timeout, srcport)) { + if (!_slurm_performance_reset_via(pc, &portid, port, mask, + ibd_timeout, + IB_GSI_PORT_COUNTERS_EXT, + srcport)) { error("perf reset\n"); exit(1); } @@ -282,20 +328,22 @@ static int _thread_init(void) error("can't resolve self port %d", port); memset(pc, 0, sizeof(pc)); - if (!perf_classportinfo_query_via(pc, &portid, port, ibd_timeout, - srcport)) + if (!_slurm_pma_query_via(pc, &portid, port, ibd_timeout, + CLASS_PORT_INFO, srcport)) error("classportinfo query\n"); memcpy(&cap_mask, pc + 2, sizeof(cap_mask)); - if (!port_performance_ext_query_via(pc, &portid, port, ibd_timeout, - srcport)) { + if (!_slurm_pma_query_via(pc, &portid, port, ibd_timeout, + IB_GSI_PORT_COUNTERS_EXT, srcport)) { error("ofed\n"); exit(1); } /* reset cost ~70 mirco secs */ - if (!port_performance_ext_reset_via(pc, &portid, port, mask, - ibd_timeout, srcport)) { + if (!_slurm_performance_reset_via(pc, &portid, port, mask, + ibd_timeout, + IB_GSI_PORT_COUNTERS_EXT, + srcport)) { error("perf reset\n"); exit(1); }