ldd output showing shared object file whose function is not called
I ran ldd command on an executable created by Open MPI. It shows a reference to libpthread.so Using LD_PREL开发者_如何学编程OAD variable I created my own implementation of pthread_create, but from the it output it seems that MPI implementation is not calling pthread_create as I had expected. Why does ldd show pthread so file in output if it is not being used? does Open MPI not use a separate MPI thread for every node to implement the functionality?
MPI uses processes, not threads. So no, Open MPI will not use a separate MPI thread per node.
If the binary is not linked with --as-needed
then it will acquire a reference to every library given on the link command line, regardless of whether it is actually needed. Pass -Wl,--as-needed
to gcc in order to have it pass the option to ld.
精彩评论