Open MPI logo

PLPA Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all PLPA Users mailing list

From: Paul H. Hargrove (PHHargrove_at_[hidden])
Date: 2007-01-29 14:42:51


I think I see the problem - a minor "thinko" in the plpa code.
Try with the following patch applied to plpa:

--- src/libplpa/plpa_dispatch.c (revision 69)
+++ src/libplpa/plpa_dispatch.c (working copy)
@@ -141,7 +141,7 @@
            bits at the top are cleared (since they won't be set by the
            kernel) */
         if (cpusetsize > PLPA_NAME(len)) {
- memset(cpuset, 0, sizeof(*cpuset));
+ memset(cpuset, 0, cpusetsize);
         }
 
         /* Now do the syscall */

-Paul

David Creasy wrote:
> Hi,
> I may well be doing something wrong here, but the code below doesn't do
> what I expect. It works fine when compiled with a 32 bit compiler, but
> 'behaves interestingly' when compiled in 64 bit mode.
>
> I'm running RH EL3 on a dual cpu, dual core AMD system and the plpa
> routines seem to think I have 8 logical cpus, whereas I only have 4.
>
> The output when compiled in 64 bit mode is:
>
> [davidc_at_frill tmp]$ ./a.out
> Size = 128 - CPU_SETSIZE = 1024
> 0 - 1
> 1 - 1
> 2 - 1
> 3 - 1
>
> Now for plpa
> 0 - 1
> 1 - 1
> 2 - 1
> 3 - 1
> 32 - 1
> 33 - 1
> 34 - 1
> 35 - 1
>
> whereas in 32 bit mode (same system, same compiler) I get:
>
> [davidc_at_frill tmp]$ ./a.out
> Size = 128 - CPU_SETSIZE = 1024
> 0 - 1
> 1 - 1
> 2 - 1
> 3 - 1
>
> Now for plpa
> 0 - 1
> 1 - 1
> 2 - 1
> 3 - 1
>
> Thanks in advance for any help you can offer.
>
> David
>
> #include <stdio.h>
> #include <sched.h>
> #include <plpa.h>
>
>
> int main()
> {
> cpu_set_t mask;
> printf("Size = %ld - CPU_SETSIZE = %d\n", sizeof(mask), CPU_SETSIZE);
> sched_getaffinity(0, &mask);
> for (int i=0; i < CPU_SETSIZE; i++) {
> if (CPU_ISSET(i, &mask)) {
> printf("%d - 1\n", i);
> }
> }
>
> printf("\nNow for plpa\n");
> plpa_cpu_set_t cpuset;
> PLPA_CPU_ZERO(&cpuset);
> int ret = plpa_sched_getaffinity(0, sizeof(cpuset), &cpuset);
>
> if (ret == 0)
> {
> for (int i=0; i < PLPA_BITMASK_CPU_MAX; i++) {
> if (PLPA_CPU_ISSET(i, &cpuset)) {
> printf("%d - 1\n", i);
> }
> }
> }
> }
>
>

-- 
Paul H. Hargrove                          PHHargrove_at_[hidden]
Future Technologies Group                 
HPC Research Department                   Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900