开发者

Compiling with mpicc (MPICH2) and pthread_barrier (-lpthread)

开发者 https://www.devze.com 2023-01-05 18:58 出处:网络
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 th

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消