1

I keep encountering this link error when compiling my application:

error LNK2001: unresolved external symbol "public: __cdecl MPI::Comm::Comm(void)" (??0Comm@MPI@@QEAA@XZ)    E:\Users\UT1JVT\Tanoshii\Eden\Inceptor2\Inceptor2\Node.obj  Inceptor2

If I compile it twice in a row, it changes to this (probably bec of incremental linking?):

error LNK2019: unresolved external symbol "public: __cdecl MPI::Comm::Comm(void)" (??0Comm@MPI@@QEAA@XZ) referenced in function "public: __cdecl MPI::Intracomm::Intracomm(struct ompi_communicator_t *)" (??0Intracomm@MPI@@QEAA@PEAUompi_communicator_t@@@Z)  E:\Users\UT1JVT\Tanoshii\Eden\Inceptor2\Inceptor2\Node.obj  Inceptor2

I have tried this in both x64 and 32bit mode with the matching MPI libraries to no avail. I have also defined: OMPI_IMPORTS, OPAL_IMPORTS and ORTE_IMPORTS (which fixed some of my previous link errors) but I still can't get rid of this one.

The offending line is:

_roleLocalComm = &MPI::COMM_WORLD.Split(_roleId,_nodeId);

If I remove this line (all code that creates comm groups), the error goes away. I have built the same source in Linux (Open MPI v1.6.5) and it works fine.

Here's the compile command:

/Zi /nologo /W3 /WX- /Od /D "_DEBUG" /D "_CONSOLE" /D "OMPI_IMPORTS" /D "OPAL_IMPORTS" /D "ORTE_IMPORTS" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"x64\Debug\testx64.pch" /Fa"x64\Debug\" /Fo"x64\Debug\" /Fd"x64\Debug\vc100.pdb" /Gd /errorReport:queue 

Update: I tried stripping it down to bare bones and using mpic++ to compile it but I still get the same exact problem. Here's the command line:

mpic++ EntryPoint.cpp -showme
cl.exe EntryPoint.cpp /D "OMPI_IMPORTS" /I"C:\Program Files\OpenMPI_v1.6.2-x64\include" /TP /EHsc /link /LIBPATH:"C:\Program Files\OpenMPI_v1.6.2-x64\lib" libmpi_cxx.lib libmpi.lib libopen-pal.lib libopen-rte.lib advapi32.lib Ws2_32.lib shlwapi.lib

couldn't get it to work at first (tons of link errors) but then I realized that OMPI_IMPORTS is not defined so I edited %openmpi%/share/openmpi/mpic++-wrapper-data.txt to add /D "OMPI_IMPORTS"

Also, it might both mentioning that I was also getting a Link failure for MPI::Datatype::Free() which seems to be a known issue. I made a workaround for this by adding the following code. I imagine it won't cause me much of a problem since my datatypes won't be cleaned up until the job completes.

void MPI::Datatype::Free(void) {
}
3
  • Might help to show your compiling command. Commented Jul 11, 2013 at 17:54
  • @bob.sacamento I've added the compile command. I'm using visual studio 2010 Commented Jul 12, 2013 at 3:39
  • Sorry, not familiar with vis studio 2010. I might try rearranging the order of the libraries you're linking with. That helps with errors like these sometimes. That's all I've got. Good luck! Commented Jul 12, 2013 at 21:15

2 Answers 2

2

To mirror what @cschwan said, MPICH actually doesn't support Windows anymore either. Support was discontinued at version 1.4.1p. Unfortunately, none of the big open source implementations have time for a lot of Windows support anymore since it's not used by too many people anymore outside the classroom and none of the developers use Windows. However, the best solution for MPI in Windows is to go directly to Microsoft. I would double check that their license will agree with whatever use you are planning before you start publishing any work based on MS-MPI though. I'm not overly familiar with how theirs works.

http://www.microsoft.com/en-us/download/details.aspx?id=36045

Here's the wiki page that explains MPICH's stance on things now:

http://wiki.mpich.org/mpich/index.php/Frequently_Asked_Questions#Q:_Why_can.27t_I_build_MPICH_on_Windows_anymore.3F

As far as the C++ bindings go, you won't get much support on those from the big open source implementations anymore either since they've been removed from MPI. However, there are other bindings available out there. I know that Boost has some available (http://www.boost.org/doc/libs/1_54_0/doc/html/mpi.html), though I have no experience with how usable they are. There's actually an interesting discussion about this going on over on the scicomp site right now. You might weigh in if you have an opinion and some experience:

https://scicomp.stackexchange.com/questions/7978/what-features-do-users-need-from-an-mpi-c-interface

Sign up to request clarification or add additional context in comments.

1 Comment

That explains why MPICH still has a download for Windows that actually links to the Microsoft site.
1
+50

I don't know the reason for your problem, but I think you ran into unmaintained code:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.