<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Have you tried compiling with mpicc?<div><br></div><div>mpicc -o hello main.c&nbsp;</div><div><br></div><div>This sets up the linking etc for you.</div><div><br></div><div><br></div><div><br></div><div>S.</div><div><br></div><div><br><div><div>On 15 Aug 2010, at 16:02, sasha lambert wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I'm fairly new to unix and mpich, so please bear with me.<div><br></div><div>I've tried to compile a simple "hello" program below:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); ">
/*The Parallel Hello World Program*/</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(126, 70, 35); ">#include <span style="color: #e00000">&lt;stdio.h&gt;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(126, 70, 35); ">#include <span style="color: #e00000">&lt;mpi.h&gt;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">main(<span style="color: #c800a3">int</span> argc, <span style="color: #c800a3">char</span> **argv)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">{</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #c800a3">int</span> node;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #430084">MPI_Init</span>(&amp;argc,&amp;argv);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(126, 70, 35); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #430084">MPI_Comm_rank</span><span style="color: #000000">(</span>MPI_COMM_WORLD<span style="color: #000000">, &amp;node);</span></div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(224, 0, 0); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #430084">printf</span><span style="color: #000000">(</span>"Hello World from Node %d\n"<span style="color: #000000">,node);</span></div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(67, 0, 132); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>MPI_Finalize<span style="color: #000000">();</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">}</div></div><div><br></div><div>Here is the shell response:</div><div><br></div><div><div>$ gcc main.c -o hello</div><div>Undefined symbols:</div><div>&nbsp;&nbsp;"_MPI_Comm_rank", referenced from:</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp;_main in ccWLoMyo.o</div><div>&nbsp;&nbsp;"_MPI_Finalize", referenced from:</div><div>&nbsp;&nbsp; &nbsp; &nbsp;_main in ccWLoMyo.o</div><div>&nbsp;&nbsp;"_MPI_Init", referenced from:</div><div>&nbsp;&nbsp; &nbsp; &nbsp;_main in ccWLoMyo.o</div><div>
ld: symbol(s) not found</div><div>collect2: ld returned 1 exit status</div></div><div><br></div><div>I tried searching for "MPI_init" in libmpich.a, thinking it might have to do with the added underscore in " _MPI_Init".</div>
<div>Shell response:</div><div><br></div><div><div>$ nm libmpich.a | grep mpi_init</div><div>nm: can't open file: libmpich.a (No such file or directory)</div></div><div><br></div><div>I've added usr/local/lib to the PATH, but still nothing. Any suggestions?</div>
<div><br></div><div>Thanks,</div><div>Sasha</div>
_______________________________________________<br>mpich-discuss mailing list<br><a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss<br></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="font-size: 12px; "><div><br class="Apple-interchange-newline">---------------------------------------------------------------------------------------</div><div>Si Hammond</div><div><br></div><div>Research Fellow &amp;&nbsp;Knowledge Transfer Associate</div><div>Performance Computing &amp; Visualisation Group</div><div>Department of Computer Science</div><div>University of Warwick, CV4 7AL, UK</div><div><a href="http://go.warwick.ac.uk/hpsg">http://go.warwick.ac.uk/hpsg</a></div><div>----------------------------------------------------------------------------------------</div><div><span class="Apple-style-span" style="font-size: medium; "><br></span></div></span></span></div></span></div></span></div></span></div></span></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></div></body></html>