2
votes

I wrote down an MPI/pthread hybrid code and I execute it on a cluster. Specifically, I compile it using mpicc -lpthread and launch 2 MPI processes on different nodes (6 nodes total, with 8 cores per node) using mpirun -np 2 -bynode and then create 8 threads on each node. However, the threads do not execute in parallel and they follow a sequential execution?

Parts of my code:

        MPI_Init(&argc, &argv);
        MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
        MPI_Comm_rank(MPI_COMM_WORLD, &taskid);
        MPI_Get_processor_name(hostname, &len);
        // more code between these..
        pthread_create(&thread_id, NULL, &sort, (void*) arrays[0]);
        pthread_create(&thread_id2, NULL, &sort, (void*) arrays[1]);
1
how do you determine that the processes are not executed in parallel?niklasfi
i used the sched_getcpu() function, and all threads returned 0ganton09
what happens, when you specify the affinity with sched_setaffinity?niklasfi
arleady tried that, cluster wouldnt recognise CPU_SET nor CPU_ZERO though i included <sched.h>, define _GNU_SOURCE and compiling it using -D__USE_GNU..ganton09

1 Answers

0
votes

Finally solved the problem, i just used a latest version of mpicc and it's all okay now