How about HWLOC_UNSUPPORTED_SYS?
On Nov 11, 2009, at 2:38 AM, <bgog...@osl.iu.edu> wrote:
Author: bgoglin
Date: 2009-11-11 05:38:26 EST (Wed, 11 Nov 2009)
New Revision: 1330
URL: https://svn.open-mpi.org/trac/hwloc/changeset/1330
Log:
Add hwloc_topology_get_support()
This also defines UNSUPPORTED_SYS on not supported systems.
We should report the supported flags in lstopo -v -
but I don't want to modify all linux/tests/*.output now
since some flags may change in the near future.
So we'll see later.
Text files modified:
trunk/configure.ac | 1 +
trunk/doc/Makefile.am | 1 +
trunk/include/hwloc.h | 20 ++++++++++++++++++++
trunk/src/topology.c | 27 +++++++++++++++++++++++++++
4 files changed, 49 insertions(+), 0 deletions(-)
Modified: trunk/configure.ac
=
=
=
=
=
=
=
=
======================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac 2009-11-11 05:38:26 EST (Wed, 11 Nov 2009)
@@ -203,6 +203,7 @@
;;
*)
AC_MSG_RESULT([Unsupported! ($target)])
+ AC_DEFINE(UNSUPPORTED_SYS, 1, [Define to 1 on unsupported
systems])
AC_MSG_WARN
([***********************************************************])
AC_MSG_WARN([*** hwloc does not support this system.])
AC_MSG_WARN([*** hwloc will *attempt* to build (but it may not
work).])
Modified: trunk/doc/Makefile.am
=
=
=
=
=
=
=
=
======================================================================
--- trunk/doc/Makefile.am (original)
+++ trunk/doc/Makefile.am 2009-11-11 05:38:26 EST (Wed, 11 Nov
2009)
@@ -299,6 +299,7 @@
$(DOX_MAN_DIR)/man3/hwloc_topology_export_xml.3 \
$(DOX_MAN_DIR)/man3/hwloc_topology_flags_e.3 \
$(DOX_MAN_DIR)/man3/hwloc_topology_get_depth.3 \
+ $(DOX_MAN_DIR)/man3/hwloc_topology_get_support.3 \
$(DOX_MAN_DIR)/man3/
hwloc_topology_ignore_all_keep_structure.3 \
$(DOX_MAN_DIR)/man3/hwloc_topology_ignore_type.3 \
$(DOX_MAN_DIR)/man3/
hwloc_topology_ignore_type_keep_structure.3 \
Modified: trunk/include/hwloc.h
=
=
=
=
=
=
=
=
======================================================================
--- trunk/include/hwloc.h (original)
+++ trunk/include/hwloc.h 2009-11-11 05:38:26 EST (Wed, 11 Nov
2009)
@@ -360,6 +360,26 @@
*/
extern int hwloc_topology_set_xml(hwloc_topology_t __hwloc_restrict
topology, const char * __hwloc_restrict xmlpath);
+/** \brief Flags describing the actual OS support for this topology.
+ *
+ * Flags are retrieved with hwloc_topology_get_support().
+ */
+enum hwloc_topology_support_flags_e {
+ /* \brief Topology discovery is supported. */
+ HWLOC_SUPPORT_DISCOVERY = (1<<0),
+ /* \brief Binding a process is supported. */
+ HWLOC_SUPPORT_SET_PROC_CPUBIND = (1<<1),
+ /* \brief Binding a thread is supported. */
+ HWLOC_SUPPORT_SET_THREAD_CPUBIND = (1<<2),
+ /* \brief Getting the binding of a process is supported. */
+ HWLOC_SUPPORT_GET_PROC_CPUBIND = (1<<3),
+ /* \brief Getting the binding of a thread is supported. */
+ HWLOC_SUPPORT_GET_THREAD_CPUBIND = (1<<4),
+};
+
+/** \brief Retrieve the OR'ed flags of topology support. */
+extern int hwloc_topology_get_support(hwloc_topology_t
__hwloc_restrict topology, unsigned long *flags);
+
/** @} */
Modified: trunk/src/topology.c
=
=
=
=
=
=
=
=
======================================================================
--- trunk/src/topology.c (original)
+++ trunk/src/topology.c 2009-11-11 05:38:26 EST (Wed, 11 Nov
2009)
@@ -1611,3 +1611,30 @@
assert(obj->type == HWLOC_OBJ_PROC);
}
}
+
+int
+hwloc_topology_get_support(struct hwloc_topology * topology,
unsigned long *flagsp)
+{
+ unsigned long flags = 0;
+#ifndef UNSUPPORTED_SYS
+ flags |= HWLOC_SUPPORT_DISCOVERY;
+#endif
+
+ /* if not is_thissystem, set_cpubind is fake
+ * and get_cpubind returns the whole system cpuset,
+ * so don't report that set/get_cpubind as supported
+ */
+ if (topology->is_thissystem) {
+ if (topology->set_proc_cpubind)
+ flags |= HWLOC_SUPPORT_SET_PROC_CPUBIND;
+ if (topology->set_thread_cpubind)
+ flags |= HWLOC_SUPPORT_SET_THREAD_CPUBIND;
+ if (topology->get_proc_cpubind)
+ flags |= HWLOC_SUPPORT_GET_PROC_CPUBIND;
+ if (topology->get_thread_cpubind)
+ flags |= HWLOC_SUPPORT_GET_THREAD_CPUBIND;
+ }
+
+ *flagsp = flags;
+ return 0;
+}
_______________________________________________
hwloc-svn mailing list
hwloc-...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-svn
--
Jeff Squyres
jsquy...@cisco.com