Bug#612621: ERROR: SCOTCH_dgraphInit: linking with both libScotch and libPTScotch is not allowed
Johannes Ring
johannr at simula.no
Wed Feb 9 15:52:19 UTC 2011
Package: libptscotch-dev
Version: 5.1.11.dfsg-3
Hi,
Compiling and running a simple program (see below) for testing
PT-SCOTCH results in the following error:
$ mpic++ -o ptscotch_test ptscotch_test.cpp -DSCOTCH_PTSCOTCH
-I/usr/include/scotch -lptscotch -lptscotcherr
$ ./ptscotch_test
ERROR: SCOTCH_dgraphInit: linking with both libScotch and
libPTScotch is not allowed
MPI implementation is not thread-safe:
SCOTCH should be compiled without SCOTCH_PTHREAD
The line containing the "ERROR" is from SCOTCH while the last two
lines are added by me because I believe that SCOTCH should be built
without the -DSCOTCH_PTHREAD flag since the OpenMPI library in Debian
does not support the MPI_THREAD_MULTIPLE level. This is a quote from
the INSTALL.txt file in the SCOTCH source tarball:
"2.5) Threads issues
-------------------
Scotch can also take advantage of Posix threads when they are
available. They are used in two places:
- [snip]
- to create distributed graphs in parallel. Since this taks involves
concurrent MPI communications, the MPI library must support the
MPI_THREAD_MULTIPLE level. The use of threads within Scotch itself
is controlled by the SCOTCH_PTHREAD flag, which is completely
independent from the COMMON_PTHREAD flag. Any of them can be set
without setting the other.
Note that if you compile Scotch with the -DSCOTCH_PTHREAD flag,
you will have to initialize your communication subsystem by using
the MPI_Init_thread() MPI call, not MPI_Init(), and the provided
thread support level value returned by the routine must be
checked carefully.
If you have doubts on the stability of your MPI implementation, it
is better not to set -DSCOTCH_PTHREAD. For instance, on Linux
platforms, concurrency problems have been experienced with MPICH2
versions prior to 1.0.7 using TCP; consequently, if the MPI
implementation on your platform is based on an older MPICH2 version,
do not set the SCOTCH_PTHREAD flag."
Best regards,
Johannes
ptscotch_test.cpp:
#include <mpi.h>
#include <ptscotch.h>
#include <iostream>
#include <cstdlib>
int main() {
int provided;
SCOTCH_Dgraph dgrafdat;
MPI_Init_thread(0, 0, MPI_THREAD_MULTIPLE, &provided);
if (SCOTCH_dgraphInit(&dgrafdat, MPI_COMM_WORLD) != 0) {
if (MPI_THREAD_MULTIPLE > provided) {
std::cout << "MPI implementation is not thread-safe:" << std::endl;
std::cout << "SCOTCH should be compiled without SCOTCH_PTHREAD"
<< std::endl;
exit(1);
}
}
else {
SCOTCH_dgraphExit(&dgrafdat);
}
MPI_Finalize();
return 0;
}
More information about the debian-science-maintainers
mailing list