Hey!

This was *just* discussed on the list yesterday and I said that we needed to use the official 3rd party import SVN procedures for PLPA. This was *NOT* done here!

I also said that I would do an actual PLPA release before it was imported into Open MPI so that we could have an official drop rather than someone grabbing an arbitrary PLPA release.

Even worse, the new PLPA was mixed in with other code in a single SVN commit. Bad, bad, bad!

r17443 should be backed out immediately and done properly.





On Feb 13, 2008, at 8:09 AM, shar...@osl.iu.edu wrote:

Author: sharonm
Date: 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
New Revision: 17443
URL: https://svn.open-mpi.org/trac/ompi/changeset/17443

Log:
Replaced PLPA to the latest PLPA (plpa-1.1a3r123)


Text files modified:
trunk/ompi/mca/btl/openib/ btl_openib_component.c | 4 trunk/opal/mca/paffinity/base/ base.h | 6 trunk/opal/mca/paffinity/base/ paffinity_base_wrappers.c | 13 +- trunk/opal/mca/paffinity/linux/ paffinity_linux_module.c | 24 ++-- trunk/opal/mca/paffinity/linux/plpa/src/libplpa/ plpa_bottom.h | 9 trunk/opal/mca/paffinity/linux/plpa/src/libplpa/ plpa_map.c | 218 +++++++++++++++++++++++++++------------ trunk/opal/mca/paffinity/linux/plpa/src/plpa-info/plpa- info.c | 23 ++- trunk/opal/mca/paffinity/linux/plpa/src/plpa-taskset/plpa- taskset.c | 15 +- trunk/opal/mca/paffinity/ paffinity.h | 12 +- trunk/opal/mca/paffinity/solaris/ paffinity_solaris_module.c | 18 +- trunk/opal/mca/paffinity/windows/ paffinity_windows_module.c | 18 +-
  11 files changed, 224 insertions(+), 136 deletions(-)

Modified: trunk/ompi/mca/btl/openib/btl_openib_component.c
= = = = = = = = ======================================================================
--- trunk/ompi/mca/btl/openib/btl_openib_component.c    (original)
+++ trunk/ompi/mca/btl/openib/btl_openib_component.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -1175,10 +1175,10 @@
{
    opal_paffinity_base_cpu_set_t cpus;
    opal_carto_base_node_t *hca_node;
-    int min_distance = -1, i, max_proc_id;
+    int min_distance = -1, i, max_proc_id, num_processors;
    const char *hca = ibv_get_device_name(dev);

- if(opal_paffinity_base_max_processor_id(&max_proc_id) != OMPI_SUCCESS) + if(opal_paffinity_base_get_processor_info(&num_processors, &max_proc_id) != OMPI_SUCCESS)
        max_proc_id = 100; /* Choose something big enough */

    hca_node = carto_base_find_node(host_topo, hca);

Modified: trunk/opal/mca/paffinity/base/base.h
= = = = = = = = ======================================================================
--- trunk/opal/mca/paffinity/base/base.h        (original)
+++ trunk/opal/mca/paffinity/base/base.h 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -167,7 +167,7 @@
     * @return int - OPAL_SUCCESS or OPAL_ERR_NOT_SUPPORTED if not
     *         supported
     */
- OPAL_DECLSPEC int opal_paffinity_base_max_processor_id(int *max_processor_id); + OPAL_DECLSPEC int opal_paffinity_base_get_processor_info(int *num_processors, int *max_processor_id);

    /**
     * Return the max socket number
@@ -177,7 +177,7 @@
     * @return int - OPAL_SUCCESS or OPAL_ERR_NOT_SUPPORTED if not
     *         supported
     */
- OPAL_DECLSPEC int opal_paffinity_base_max_socket(int *max_socket); + OPAL_DECLSPEC int opal_paffinity_base_get_socket_info(int *num_sockets, int *max_socket_num);

    /**
     * Return the max core number for a given socket
@@ -188,7 +188,7 @@
     * @return int - OPAL_SUCCESS or OPAL_ERR_NOT_SUPPORTED if not
     *         supported
     */
- OPAL_DECLSPEC int opal_paffinity_base_max_core(int socket, int *max_core); + OPAL_DECLSPEC int opal_paffinity_base_get_core_info(int socket, int *num_cores, int *max_core_num);

    /**
     * Indication of whether a component was successfully selected or

Modified: trunk/opal/mca/paffinity/base/paffinity_base_wrappers.c
= = = = = = = = ======================================================================
--- trunk/opal/mca/paffinity/base/paffinity_base_wrappers.c     (original)
+++ trunk/opal/mca/paffinity/base/paffinity_base_wrappers.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -63,27 +63,28 @@
return opal_paffinity_base_module- >paff_map_to_socket_core(processor_id, socket, core);
}

-int opal_paffinity_base_max_processor_id(int *max_processor_id)
+
+int opal_paffinity_base_get_processor_info(int *num_processors, int *max_processor_id)
{
    if (!opal_paffinity_base_selected) {
        return OPAL_ERR_NOT_FOUND;
    }
- return opal_paffinity_base_module- >paff_max_processor_id(max_processor_id); + return opal_paffinity_base_module- >paff_get_processor_info(num_processors, max_processor_id);
}

-int opal_paffinity_base_max_socket(int *max_socket)
+int opal_paffinity_base_get_socket_info(int *num_sockets, int *max_socket_num)
{
    if (!opal_paffinity_base_selected) {
        return OPAL_ERR_NOT_FOUND;
    }
-    return opal_paffinity_base_module->paff_max_socket(max_socket);
+ return opal_paffinity_base_module- >paff_get_socket_info(num_sockets, max_socket_num);
}

-int opal_paffinity_base_max_core(int socket, int *max_core)
+int opal_paffinity_base_get_core_info(int socket, int *num_cores, int *max_core_num)
{
    if (!opal_paffinity_base_selected) {
        return OPAL_ERR_NOT_FOUND;
    }
- return opal_paffinity_base_module->paff_max_core(socket, max_core); + return opal_paffinity_base_module->paff_get_core_info(socket, num_cores, max_core_num);
}


Modified: trunk/opal/mca/paffinity/linux/paffinity_linux_module.c
= = = = = = = = ======================================================================
--- trunk/opal/mca/paffinity/linux/paffinity_linux_module.c     (original)
+++ trunk/opal/mca/paffinity/linux/paffinity_linux_module.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -45,9 +45,9 @@
static int linux_module_get(opal_paffinity_base_cpu_set_t *cpumask);
static int linux_module_map_to_processor_id(int socket, int core, int *processor_id); static int linux_module_map_to_socket_core(int processor_id, int *socket, int *core);
-static int linux_module_max_processor_id(int *max_processor_id);
-static int linux_module_max_socket(int *max_socket);
-static int linux_module_max_core(int socket, int *max_core);
+static int linux_module_get_processor_info(int *num_processors, int *max_processor_id); +static int linux_module_get_socket_info(int *num_sockets, int *max_socket_num); +static int linux_module_get_core_info(int socket, int *num_cores, int *max_core_num);

/*
 * Linux paffinity module
@@ -64,9 +64,9 @@
    linux_module_get,
    linux_module_map_to_processor_id,
    linux_module_map_to_socket_core,
-    linux_module_max_processor_id,
-    linux_module_max_socket,
-    linux_module_max_core,
+    linux_module_get_processor_info,
+    linux_module_get_socket_info,
+    linux_module_get_core_info,
    NULL
};

@@ -168,18 +168,18 @@
return opal_paffinity_linux_plpa_map_to_socket_core(processor_id, socket, core);
}

-static int linux_module_max_processor_id(int *max_processor_id)
+static int linux_module_get_processor_info(int *num_processors, int *max_processor_id)
{
- return opal_paffinity_linux_plpa_max_processor_id(max_processor_id); + return opal_paffinity_linux_plpa_get_processor_info(num_processors, max_processor_id);
}

-static int linux_module_max_socket(int *max_socket)
+static int linux_module_get_socket_info(int *num_sockets, int *max_socket_num)
{
-   return opal_paffinity_linux_plpa_max_socket(max_socket);
+ return opal_paffinity_linux_plpa_get_socket_info(num_sockets, max_socket_num);
}

-static int linux_module_max_core(int socket, int *max_core)
+static int linux_module_get_core_info(int socket, int *num_cores, int *max_core_num)
{
-   return opal_paffinity_linux_plpa_max_core(socket, max_core);
+ return opal_paffinity_linux_plpa_get_core_info(socket, num_cores, max_core_num);
}


Modified: trunk/opal/mca/paffinity/linux/plpa/src/libplpa/ plpa_bottom.h = = = = = = = = ====================================================================== --- trunk/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_bottom.h (original) +++ trunk/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_bottom.h 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -4,6 +4,7 @@
 *                         All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
+ * Copyright (c) 2006-2007 Cisco, Inc.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
@@ -26,7 +27,7 @@

/* Internal macro to munge names */

-/* Preprocessors are fun -- the double indirection is necessary.
+/* Preprocessors are fun -- the double inderection is necessary.
   Extra bonus points if you can figure out why! :p */
#define PLPA_MUNGE_NAME(a, b) PLPA_MUNGE_NAME2(a, b)
#define PLPA_MUNGE_NAME2(a, b) a ## b
@@ -119,13 +120,13 @@
int PLPA_NAME(map_to_socket_core)(int processor_id, int *socket, int *core);

/* Return the max processor ID */
-int PLPA_NAME(max_processor_id)(int *max_processor_id);
+int PLPA_NAME(get_processor_info)(int *num_processors, int *max_processor_id);

/* Return the max socket number */
-int PLPA_NAME(max_socket)(int *max_socket);
+int PLPA_NAME(get_socket_info)(int *num_sockets, int *max_socket_num);

/* Return the max core number for a given socket */
-int PLPA_NAME(max_core)(int socket, int *max_core);
+int PLPA_NAME(get_core_info)(int socket, int *num_cores, int *max_core_num);

/* Shut down PLPA */
int PLPA_NAME(finalize)(void);

Modified: trunk/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_map.c
= = = = = = = = ====================================================================== --- trunk/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_map.c (original) +++ trunk/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_map.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -130,18 +130,25 @@
} tuple_t;

static int supported = 0;
-static int max_processor = -1;
-static int max_socket = -1;
-static int *max_core = NULL;
-static int max_core_overall = -1;
+static int num_processors = -1;
+static int max_processor_num = -1;
+static int num_sockets = -1;
+static int max_socket_num = -1;
+static int *max_core_num = NULL;
+static int *num_cores = NULL;
+static int max_core_num_overall = -1;
static tuple_t *map_processor_id_to_tuple = NULL;
static tuple_t ***map_tuple_to_processor_id = NULL;

static void clear_cache(void)
{
-    if (NULL != max_core) {
-        free(max_core);
-        max_core = NULL;
+    if (NULL != max_core_num) {
+        free(max_core_num);
+        max_core_num = NULL;
+    }
+    if (NULL != num_cores) {
+        free(num_cores);
+        num_cores = NULL;
    }
    if (NULL != map_processor_id_to_tuple) {
        free(map_processor_id_to_tuple);
@@ -156,15 +163,17 @@
        map_tuple_to_processor_id = NULL;
    }

-    max_processor = -1;
-    max_socket = -1;
-    max_core_overall = -1;
+    num_processors = max_processor_num = -1;
+    num_sockets = max_socket_num = -1;
+    max_core_num_overall = -1;
}

static void load_cache(const char *sysfs_mount)
{
    int i, j, k, invalid_entry, fd;
    char path[PATH_MAX], buf[8];
+    PLPA_NAME(cpu_set_t) *cores_on_sockets;
+    int found;

    /* Check for the parent directory */
    sprintf(path, "%s/devices/system/cpu", sysfs_mount);
@@ -173,23 +182,30 @@
    }

    /* Go through and find the max processor ID */
-    for (max_processor = 0; max_processor < PLPA_BITMASK_CPU_MAX;
-         ++max_processor) {
-        sprintf(path, "%s/devices/system/cpu/cpu%d", sysfs_mount,
-                max_processor);
-        if ( access(path, R_OK|X_OK) ) {
+    for (num_processors = max_processor_num = i = 0;
+         i < PLPA_BITMASK_CPU_MAX; ++i) {
+        sprintf(path, "%s/devices/system/cpu/cpu%d", sysfs_mount, i);
+        if (0 != access(path, (R_OK | X_OK))) {
+            max_processor_num = i - 1;
            break;
        }
+        ++num_processors;
+    }
+
+    /* If we found no processors, then we have no topology info */
+    if (0 == num_processors) {
+        clear_cache();
+        return;
    }
-    --max_processor;

    /* Malloc space for the first map (processor ID -> tuple).
       Include enough space for one invalid entry. */
- map_processor_id_to_tuple = malloc(sizeof(tuple_t) * (max_processor + 2));
+    map_processor_id_to_tuple = malloc(sizeof(tuple_t) *
+                                       (max_processor_num + 2));
    if (NULL == map_processor_id_to_tuple) {
        return;
    }
-    for (i = 0; i <= max_processor; ++i) {
+    for (i = 0; i <= max_processor_num; ++i) {
        map_processor_id_to_tuple[i].processor_id = i;
        map_processor_id_to_tuple[i].socket = -1;
        map_processor_id_to_tuple[i].core = -1;
@@ -200,57 +216,119 @@
    map_processor_id_to_tuple[invalid_entry].socket = -1;
    map_processor_id_to_tuple[invalid_entry].core = -1;

-    /* Malloc space for the max number of cores on each socket */
-    max_core = malloc(sizeof(int) * (max_processor + 1));
-    if (NULL == max_core) {
-        clear_cache();
-        return;
-    }
-    for (i = 0; i <= max_processor; ++i) {
-        max_core[i] = -1;
-    }
-
    /* Build a cached map of (socket,core) tuples */
-    for ( i = 0; i <= max_processor; i++ ) {
+    for (found = 0, i = 0; i <= max_processor_num; ++i) {
        sprintf(path, "%s/devices/system/cpu/cpu%d/topology/core_id",
                sysfs_mount, i);
        fd = open(path, O_RDONLY);
        if ( fd < 0 ) {
-            clear_cache();
-            return;
+            continue;
        }
        if ( read(fd, buf, 7) <= 0 ) {
-            clear_cache();
-            return;
+            continue;
        }
        sscanf(buf, "%d", &(map_processor_id_to_tuple[i].core));
        close(fd);

- sprintf(path, "%s/devices/system/cpu/cpu%d/topology/ physical_package_id",
+        sprintf(path,
+ "%s/devices/system/cpu/cpu%d/topology/ physical_package_id",
                sysfs_mount, i);
        fd = open(path, O_RDONLY);
        if ( fd < 0 ) {
-            clear_cache();
-            return;
+            continue;
        }
        if ( read(fd, buf, 7) <= 0 ) {
-            clear_cache();
-            return;
+            continue;
        }
        sscanf(buf, "%d", &(map_processor_id_to_tuple[i].socket));
        close(fd);
+        found = 1;

-        /* Compute some globals */
-        if (map_processor_id_to_tuple[i].socket > max_socket) {
-            max_socket = map_processor_id_to_tuple[i].socket;
+        /* Keep a running tab on the max socket number */
+        if (map_processor_id_to_tuple[i].socket > max_socket_num) {
+            max_socket_num = map_processor_id_to_tuple[i].socket;
        }
+    }
+
+    /* Now that we know the max number of sockets, allocate some
+       arrays */
+    max_core_num = malloc(sizeof(int) * (max_socket_num + 1));
+    if (NULL == max_core_num) {
+        clear_cache();
+        return;
+    }
+    num_cores = malloc(sizeof(int) * (max_socket_num + 1));
+    if (NULL == num_cores) {
+        clear_cache();
+        return;
+    }
+    for (i = 0; i <= max_socket_num; ++i) {
+        num_cores[i] = -1;
+        max_core_num[i] = -1;
+    }
+
+    /* Find the max core number on each socket */
+    for (i = 0; i <= max_processor_num; ++i) {
        if (map_processor_id_to_tuple[i].core >
-            max_core[map_processor_id_to_tuple[i].socket]) {
-            max_core[map_processor_id_to_tuple[i].socket] =
+            max_core_num[map_processor_id_to_tuple[i].socket]) {
+            max_core_num[map_processor_id_to_tuple[i].socket] =
                map_processor_id_to_tuple[i].core;
        }
- if (max_core[map_processor_id_to_tuple[i].socket] > max_core_overall) { - max_core_overall = max_core[map_processor_id_to_tuple[i].socket];
+        if (max_core_num[map_processor_id_to_tuple[i].socket] >
+            max_core_num_overall) {
+            max_core_num_overall =
+                max_core_num[map_processor_id_to_tuple[i].socket];
+        }
+    }
+
+    /* If we didn't find any core_id/physical_package_id's, then we
+       don't have the topology info */
+    if (!found) {
+        clear_cache();
+        return;
+    }
+
+    /* Go through and count the number of unique sockets found.  It
+       may not be the same as max_socket_num because there may be
+       "holes" -- e.g., sockets 0 and 3 are used, but sockets 1 and 2
+       are empty. */
+    for (j = i = 0; i <= max_socket_num; ++i) {
+        if (max_core_num[i] >= 0) {
+            ++j;
+        }
+    }
+    if (j > 0) {
+        num_sockets = j;
+    }
+
+    /* Count how many cores are available on each socket.  This may
+       not be the same as max_core_num[socket_num] if there are
+       "holes".  I don't know if holes can happen (i.e., if specific
+       cores can be taken offline), but what the heck... */
+    cores_on_sockets = malloc(sizeof(PLPA_NAME(cpu_set_t)) *
+                              (max_socket_num + 1));
+    if (NULL == cores_on_sockets) {
+        clear_cache();
+        return;
+    }
+    for (i = 0; i <= max_socket_num; ++i) {
+        PLPA_CPU_ZERO(&(cores_on_sockets[i]));
+    }
+    for (i = 0; i <= max_processor_num; ++i) {
+        if (map_processor_id_to_tuple[i].socket >= 0) {
+            PLPA_CPU_SET(map_processor_id_to_tuple[i].core,
+ &(cores_on_sockets[map_processor_id_to_tuple[i].socket]));
+        }
+    }
+    for (i = 0; i <= max_socket_num; ++i) {
+        int count = 0;
+        for (j = 0; j < PLPA_BITMASK_CPU_MAX; ++j) {
+            if (PLPA_CPU_ISSET(j, &(cores_on_sockets[i]))) {
+                ++count;
+            }
+        }
+        if (count > 0) {
+            num_cores[i] = count;
        }
    }

@@ -258,26 +336,27 @@
       (socket,core) => processor_id.  This map simply points to
       entries in the other map (i.e., it's by reference instead of by
       value). */
- map_tuple_to_processor_id = malloc(sizeof(tuple_t **) * (max_socket + 1));
+    map_tuple_to_processor_id = malloc(sizeof(tuple_t **) *
+                                       (max_socket_num + 1));
    if (NULL == map_tuple_to_processor_id) {
        clear_cache();
        return;
    }
    map_tuple_to_processor_id[0] = malloc(sizeof(tuple_t *) *
-                                          ((max_socket + 1) *
-                                           (max_core_overall + 1)));
+                                          ((max_socket_num + 1) *
+ (max_core_num_overall + 1)));
    if (NULL == map_tuple_to_processor_id[0]) {
        clear_cache();
        return;
    }
    /* Set pointers for 2nd dimension */
-    for (i = 1; i <= max_socket; ++i) {
+    for (i = 1; i <= max_socket_num; ++i) {
        map_tuple_to_processor_id[i] =
-            map_tuple_to_processor_id[i - 1] + max_core_overall;
+            map_tuple_to_processor_id[i - 1] + max_core_num_overall;
    }
    /* Compute map */
-    for (i = 0; i <= max_socket; ++i) {
-        for (j = 0; j <= max_core_overall; ++j) {
+    for (i = 0; i <= max_socket_num; ++i) {
+        for (j = 0; j <= max_core_num_overall; ++j) {
            /* Default to the invalid entry in the other map, meaning
               that this (socket,core) combination doesn't exist
               (e.g., the core number does not exist in this socket,
@@ -288,7 +367,7 @@
            /* See if this (socket,core) tuple exists in the other
               map.  If so, set this entry to point to it (overriding
               the invalid entry default). */
-            for (k = 0; k <= max_processor; ++k) {
+            for (k = 0; k <= max_processor_num; ++k) {
                if (map_processor_id_to_tuple[k].socket == i &&
                    map_processor_id_to_tuple[k].core == j) {
                    map_tuple_to_processor_id[i][j] =
@@ -370,8 +449,8 @@
    }

    /* Check for some invalid entries */
-    if (socket < 0 || socket > max_socket ||
-        core < 0 || core > max_core_overall ||
+    if (socket < 0 || socket > max_socket_num ||
+        core < 0 || core > max_core_num_overall ||
        NULL == processor_id) {
        return EINVAL;
    }
@@ -403,7 +482,7 @@
    }

    /* Check for some invalid entries */
-    if (processor_id < 0 || processor_id > max_processor ||
+    if (processor_id < 0 || processor_id > max_processor_num ||
        NULL == socket ||
        NULL == core) {
        return EINVAL;
@@ -415,7 +494,8 @@
    return 0;
}

-int PLPA_NAME(max_processor_id)(int *max_processor_id_arg)
+int PLPA_NAME(get_processor_info)(int *num_processors_arg,
+                                  int *max_processor_num_arg)
{
    int ret;

@@ -427,7 +507,7 @@
    }

    /* Check for bozo arguments */
-    if (NULL == max_processor_id_arg) {
+ if (NULL == max_processor_num_arg || NULL == num_processors_arg) {
        return EINVAL;
    }

@@ -437,12 +517,13 @@
    }

    /* All done */
-    *max_processor_id_arg = max_processor;
+    *num_processors_arg = num_processors;
+    *max_processor_num_arg = max_processor_num;
    return 0;
}

/* Return the max socket number */
-int PLPA_NAME(max_socket)(int *max_socket_arg)
+int PLPA_NAME(get_socket_info)(int *num_sockets_arg, int *max_socket_num_arg)
{
    int ret;

@@ -454,7 +535,7 @@
    }

    /* Check for bozo arguments */
-    if (NULL == max_socket_arg) {
+    if (NULL == max_socket_num_arg || NULL == num_sockets_arg) {
        return EINVAL;
    }

@@ -464,12 +545,14 @@
    }

    /* All done */
-    *max_socket_arg = max_socket;
+    *num_sockets_arg = num_sockets;
+    *max_socket_num_arg = max_socket_num;
    return 0;
}

-/* Return the max core number for a given socket */
-int PLPA_NAME(max_core)(int socket, int *max_core_arg)
+/* Return the number of cores in a socket and the max core ID number */
+int PLPA_NAME(get_core_info)(int socket, int *num_cores_arg,
+                             int *max_core_num_arg)
{
    int ret;

@@ -481,7 +564,7 @@
    }

    /* Check for bozo arguments */
-    if (NULL == max_core_arg) {
+    if (NULL == max_core_num_arg || NULL == num_cores_arg) {
        return EINVAL;
    }

@@ -491,11 +574,12 @@
    }

    /* Check for some invalid entries */
-    if (socket < 0 || socket > max_socket) {
+ if (socket < 0 || socket > max_socket_num || -1 == max_core_num[socket]) {
        return EINVAL;
    }

    /* All done */
-    *max_core_arg = max_core[socket];
+    *num_cores_arg = num_cores[socket];
+    *max_core_num_arg = max_core_num[socket];
    return 0;
}

Modified: trunk/opal/mca/paffinity/linux/plpa/src/plpa-info/plpa- info.c = = = = = = = = ====================================================================== --- trunk/opal/mca/paffinity/linux/plpa/src/plpa-info/plpa-info.c (original) +++ trunk/opal/mca/paffinity/linux/plpa/src/plpa-info/plpa-info.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -23,7 +23,7 @@
    int ret = 0;
    int need_help = 0;
    int show_topo = 0;
-    int have_topo, max_socket, max_core;
+ int have_topo, num_sockets, max_socket_num, num_cores, max_core_num;
    PLPA_NAME(api_type_t) api_probe;

    for (i = 1; i < argc; ++i) {
@@ -73,10 +73,15 @@
        have_topo = 0;
    }
    printf("Kernel topology support: %s\n", have_topo ? "yes" : "no");
-    if (0 != PLPA_NAME(max_socket)(&max_socket)) {
-        max_socket = -1;
+ if (0 != PLPA_NAME(get_socket_info)(&num_sockets, &max_socket_num)) {
+        num_sockets = max_socket_num = -1;
+    }
+    printf("Number of processor sockets: ");
+    if (have_topo && num_sockets >= 0) {
+        printf("%d\n", num_sockets);
+    } else {
+        printf("unknown\n");
    }
- printf("Number of processor sockets: %d\n", have_topo ? max_socket : -1);

    /* If asked, print the map */

@@ -84,13 +89,11 @@
        if (have_topo) {
            /* Remember that max_socket and max_core values are
               0-indexed */
-            for (i = 0; i <= max_socket; ++i) {
-                ret = PLPA_NAME(max_core)(i, &max_core);
+            for (i = 0; i <= max_socket_num; ++i) {
+ ret = PLPA_NAME(get_core_info)(i, &num_cores, &max_core_num);
                if (0 == ret) {
-                    printf("Socket %d: %d core%s\n", i, max_core + 1,
-                           (0 == max_core) ? "" : "s");
-                } else {
-                    printf("Socket %d: unknown cores\n", i);
+                    printf("Socket %d: %d core%s\n", i, num_cores,
+                           (1 == num_cores) ? "" : "s");
                }
            }
        } else {

Modified: trunk/opal/mca/paffinity/linux/plpa/src/plpa-taskset/plpa- taskset.c = = = = = = = = ====================================================================== --- trunk/opal/mca/paffinity/linux/plpa/src/plpa-taskset/plpa- taskset.c (original) +++ trunk/opal/mca/paffinity/linux/plpa/src/plpa-taskset/plpa- taskset.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -87,11 +87,11 @@

static char *cpu_set_to_list(const PLPA_NAME(cpu_set_t) *cpu_set)
{
-    size_t i, j, last_bit, size = PLPA_BITMASK_NUM_ELEMENTS;
+    size_t i, j, last_bit, size = PLPA_BITMASK_CPU_MAX;
    unsigned long long mask_value = 0;
    /* Upper bound on string length: 4 digits per
-       PLPA_BITMASK_NUM_ELEMENTS + 1 comma for each */
-    static char str[PLPA_BITMASK_NUM_ELEMENTS * 5];
+       PLPA_BITMASK_CPU_MAX + 1 comma for each */
+    static char str[PLPA_BITMASK_CPU_MAX * 5];
    char temp[8];

    if (sizeof(mask_value) * 8 < size) {
@@ -156,7 +156,7 @@

static unsigned long long cpu_set_to_ll(const PLPA_NAME(cpu_set_t) *cpu_set)
{
-    size_t i, size = PLPA_BITMASK_NUM_ELEMENTS;
+    size_t i, size = PLPA_BITMASK_CPU_MAX;
    unsigned long long mask_value = 0;

    if (sizeof(mask_value) * 8 < size) {
@@ -164,7 +164,7 @@
    }
    for (i = 0; i < size; ++i) {
        if (PLPA_CPU_ISSET(i, cpu_set)) {
-            mask_value += 1 << i;
+            mask_value |= 1llu << i;
        }
    }
    return mask_value;
@@ -184,7 +184,7 @@
    return ret;
}

-static int mask_to_cpu_set(char *mask_string, PLPA_NAME(cpu_set_t) *cpu_set) +static int mask_to_cpu_set(const char *mask_string, PLPA_NAME(cpu_set_t) *cpu_set)
{
    size_t i;
    unsigned int mask_value;
@@ -192,7 +192,7 @@
    PLPA_CPU_ZERO(cpu_set);
    sscanf(mask_string, "%x", &mask_value);
    for (i = 0; i < sizeof(mask_value) * 8; ++i) {
-        if (0 != (mask_value & (1 << i))) {
+        if (0 != (mask_value & (1u << i))) {
            PLPA_CPU_SET(i, cpu_set);
        }
    }
@@ -371,7 +371,6 @@
        { "cpu-list", 0, NULL, 'c' },
        { "help", 0, NULL, 'h' },
        { "version", 0, NULL, 'V' },
-        { "testing", 0, NULL, 't' },
        /* Undocumented testing function */
        { "testing", 0, NULL, 't' },
        { NULL, 0, NULL, 0 }

Modified: trunk/opal/mca/paffinity/paffinity.h
= = = = = = = = ======================================================================
--- trunk/opal/mca/paffinity/paffinity.h        (original)
+++ trunk/opal/mca/paffinity/paffinity.h 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -194,7 +194,7 @@
 * return OPAL_SUCCESS or OPAL_ERR_NOT_SUPPORTED if not
 * supporeted (solaris, windows, etc...)
 */
-typedef int (*opal_paffinity_base_module_max_processor_id_fn_t)(int *max_processor_id); +typedef int (*opal_paffinity_base_module_get_processor_info_fn_t) (int *num_processors, int *max_processor_id);

/**
 * Provides the number of sockets in a host. currently supported
@@ -203,7 +203,7 @@
 * return OPAL_SUCCESS or OPAL_ERR_NOT_SUPPORTED if not
 * supporeted (solaris, windows, etc...)
 */
-typedef int (*opal_paffinity_base_module_max_socket_fn_t)(int *max_socket); +typedef int (*opal_paffinity_base_module_get_socket_info_fn_t)(int *num_sockets, int *max_socket_num);

/**
 * Provides the number of cores in a socket. currently supported
@@ -212,7 +212,7 @@
 * return OPAL_SUCCESS or OPAL_ERR_NOT_SUPPORTED if not
 * supporeted (solaris, windows, etc...)
 */
-typedef int (*opal_paffinity_base_module_max_core)(int socket, int *max_core); +typedef int (*opal_paffinity_base_module_get_core_info_fn_t)(int socket, int *num_cores, int *max_core_num);


/**
@@ -262,13 +262,13 @@
opal_paffinity_base_module_map_to_socket_core_fn_t paff_map_to_socket_core;

    /** Return the max processor ID */
- opal_paffinity_base_module_max_processor_id_fn_t paff_max_processor_id; + opal_paffinity_base_module_get_processor_info_fn_t paff_get_processor_info;

    /** Return the max socket number */
-    opal_paffinity_base_module_max_socket_fn_t paff_max_socket;
+ opal_paffinity_base_module_get_socket_info_fn_t paff_get_socket_info;

    /** Return the max core number */
-    opal_paffinity_base_module_max_core paff_max_core;
+    opal_paffinity_base_module_get_core_info_fn_t paff_get_core_info;

    /** Shut down this module */
    opal_paffinity_base_module_finalize_fn_t paff_module_finalize;

Modified: trunk/opal/mca/paffinity/solaris/paffinity_solaris_module.c
= = = = = = = = ====================================================================== --- trunk/opal/mca/paffinity/solaris/paffinity_solaris_module.c (original) +++ trunk/opal/mca/paffinity/solaris/paffinity_solaris_module.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -45,9 +45,9 @@
static int cpumask_to_id(opal_paffinity_base_cpu_set_t cpumask);
static int solaris_module_map_to_processor_id(int socket, int core, int *processor_id); static int solaris_module_map_to_socket_core(int processor_id, int *socket, int *core);
-static int solaris_module_max_processor_id(int *max_processor_id);
-static int solaris_module_max_socket(int *max_socket);
-static int solaris_module_max_core(int socket, int *max_core);
+static int solaris_module_get_processor_info(int *num_processors, int *max_processor_id); +static int solaris_module_get_socket_info(int *num_sockets, int *max_socket_num); +static int solaris_module_get_core_info(int socket, int *num_cores, int *max_core_num);

/*
 * Solaris paffinity module
@@ -64,9 +64,9 @@
    solaris_module_get,
    solaris_module_map_to_processor_id,
    solaris_module_map_to_socket_core,
-    solaris_module_max_processor_id,
-    solaris_module_max_socket,
-    solaris_module_max_core,
+    solaris_module_get_processor_info,
+    solaris_module_get_socket_info,
+    solaris_module_get_core_info,
    solaris_module_finalize
};

@@ -173,17 +173,17 @@
    return OPAL_ERR_NOT_SUPPORTED;
}

-static int solaris_module_max_processor_id(int *max_processor_id)
+static int solaris_module_get_processor_info(int *num_processors, int *max_processor_id);
{
    return OPAL_ERR_NOT_SUPPORTED;
}

-static int solaris_module_max_socket(int *max_socket)
+static int solaris_module_get_socket_info(int *num_sockets, int *max_socket_num);
{
    return OPAL_ERR_NOT_SUPPORTED;
}

-static int solaris_module_max_core(int socket, int *max_core)
+static int solaris_module_get_core_info(int socket, int *num_cores, int *max_core_num);
{
    return OPAL_ERR_NOT_SUPPORTED;
}

Modified: trunk/opal/mca/paffinity/windows/paffinity_windows_module.c
= = = = = = = = ====================================================================== --- trunk/opal/mca/paffinity/windows/paffinity_windows_module.c (original) +++ trunk/opal/mca/paffinity/windows/paffinity_windows_module.c 2008-02-13 08:09:11 EST (Wed, 13 Feb 2008)
@@ -34,9 +34,9 @@
static int windows_module_get(opal_paffinity_base_cpu_set_t *cpumask);
static int windows_module_map_to_processor_id(int socket, int core, int *processor_id); static int windows_module_map_to_socket_core(int processor_id, int *socket, int *core);
-static int windows_module_max_processor_id(int *max_processor_id);
-static int windows_module_max_socket(int *max_socket);
-static int windows_module_max_core(int socket, int *max_core);
+static int windows_module_get_processor_info(int *num_processors, int *max_processor_id); +static int windows_module_get_socket_info(int *num_sockets, int *max_socket_num); +static int windows_module_get_core_info(int socket, int *num_cores, int *max_core_num);

static SYSTEM_INFO sys_info;

@@ -54,9 +54,9 @@
    windows_module_get,
    windows_module_map_to_processor_id,
    windows_module_map_to_socket_core,
-    windows_module_max_processor_id,
-    windows_module_max_socket,
-    windows_module_max_core,
+    windows_module_get_processor_info,
+    windows_module_get_socket_info,
+    windows_module_get_core_info,
    windows_module_finalize
};

@@ -134,17 +134,17 @@
    return OPAL_ERR_NOT_SUPPORTED;
}

-static int windows_module_max_processor_id(int *max_processor_id)
+static int windows_module_get_processor_info(int *num_processors, int *max_processor_id);
{
    return OPAL_ERR_NOT_SUPPORTED;
}

-static int windows_module_max_socket(int *max_socket)
+static int windows_module_get_socket_info(int *num_sockets, int *max_socket_num);
{
    return OPAL_ERR_NOT_SUPPORTED;
}

-static int windows_module_max_core(int socket, int *max_core)
+static int windows_module_get_core_info(int socket, int *num_cores, int *max_core_num);
{
    return OPAL_ERR_NOT_SUPPORTED;
}
_______________________________________________
svn-full mailing list
svn-f...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/svn-full


--
Jeff Squyres
Cisco Systems

Reply via email to