Open MPI logo

PLPA Users' Mailing List Archives

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

From: David Creasy (dcreasy_at_[hidden])
Date: 2007-01-29 14:01:10


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);
             }
         }
     }
}

-- 
David Creasy
Matrix Science
64 Baker Street
London W1U 7GB, UK
Tel: +44 (0)20 7486 1050
Fax: +44 (0)20 7224 1344
dcreasy_at_[hidden]
http://www.matrixscience.com