I have a functioning implementation of a MPI routine, which work开发者_如何学Cs fine. In the process of making this a hybrid between MPI and shared memory, I am using pthreads. This in turn proofed the need of pthread_barriers.
But when I try to compile my code with the mpicc compiler, it complains over pthread_barrier_t and other barrier commands. If I remove these, and keep other threading parts it compiles just fine.
This is the line of code I insert to break the compilation:
pthread_barrier_t* barrier;
And for compilation I use:
mpicc -lm myprogram.c -o myprogram
The error returned from the compiler is:
myprogram.c:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
Where line 34 corresponds to what I wrote above.
[Edit] I am runnings this on Ubuntu 9.10, with the following gcc/mpicc compiler: gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1. [/Edit]
Does anyone know what could be wrong and how I can make it compile?
Cheers!
pthread_barrier_t
is part of the ADVANCED REALTIME THREAD option, so it might not be available on your system.
BTW, if you pose such a specific question you should always mention OS, version number and things like that.
This means that pthread_barrier_t
type is not in scope. Have you #include
'd pthread.h
?
精彩评论