IntelMPI binds processes by default, while OMPI doesn't. What's your mpiexec/mpirun command-line?
Brice Le 15/02/2013 17:34, Kranthi Kumar a écrit : > Hello Sir > > Here below is the code which I wrote using hwloc for getting the > bindings of the processes. > I tested this code on SDSC Gordon Super Computer which has Open MPI > 1.4.3 and on TACC Stampede which uses intel's MPI library IMPI. > With Open MPI I get all the core ids for all the processes as 0. Using > Intel MPI library I get different coreids. I tried even binding the > processes > in the command line using taskset. Open MPI gives me core id 0 for all > the processes whereas IMPI gives me correct bindings. > Please look into this > > > #include <stdio.h> > #include <sched.h> > #include <math.h> > #include "mpi.h" > #include <hwloc.h> > int main(int argc, char* argv[]) > { > int rank, size; > cpu_set_t mask; > long num; > int proc_num(long num); > > hwloc_topology_t topology; > hwloc_cpuset_t cpuset; > hwloc_obj_t obj; > > MPI_Init(&argc, &argv); > MPI_Comm_rank(MPI_COMM_WORLD, &rank); > MPI_Comm_size(MPI_COMM_WORLD, &size); > > hwloc_topology_init ( &topology); > hwloc_topology_load ( topology); > > hwloc_bitmap_t set = hwloc_bitmap_alloc(); > hwloc_obj_t pu; > int err; > > err = hwloc_get_proc_cpubind(topology, getpid(), set, > HWLOC_CPUBIND_PROCESS); > if (err) { > printf ("Error Cannot find\n"), exit(1); > } > > pu = hwloc_get_pu_obj_by_os_index(topology, hwloc_bitmap_first(set)); > printf ("Hello World, I am %d and pid: %d > coreid:%d\n",rank,getpid(),hwloc_bitmap_first(set)); > > hwloc_bitmap_free(set); > MPI_Finalize(); > fclose(stdout); > return 0; > } > Thank You > -- > Kranthi > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users