Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Because Open MPI's wrapper compilers don't automatically -rpath the location of where libmpi.so is located when compiling / linking myprogram (we take a minimalist approach in the flags that are passed in the OMPI wrapper compilers -- if they're not <em>needed</em>, we don't put them there).</p> <p>Specifically, when you run an executable in Linux, the run-time linker will look to find all the libraries that are needed for that executable (run "ldd myprogram" and you'll see a list of the libraries that are needed for myprogram). It'll look in all the system default locations (which are, themselves, configurable by the sysadmins). It'll also look in all the directories specified by LD_LIBRARY_PATH -- LD_LIBRARY_PATH is effectively a per-user method of extending the list of directories for the linker to search to find shared libraries.</p> <p>I'm guessing that libmpi.so is not in any of the system default locations, and therefore you need to specify its directory in LD_LIBRARY_PATH.</p> <p>Alternatively, you could add an -rpath clause when you link myprogram. For example:</p> <pre><code>mpicc myprogram.c -o myprogram -Wl,-rpath /opt/openmpi/lib </code></pre> <p>This would embed the location /opt/openmpi/lib to the myprogram binary itself, and the linker will also look in that location for libmpi.so (and any other libraries that need to be resolved). For example:</p> <pre><code># Without an rpath clause: [8:45] svbu-mpi:~/mpi % mpicc hello.c -o hello [8:45] svbu-mpi:~/mpi % ldd hello linux-vdso.so.1 =&gt; (0x00007ffff7ffe000) libmpi.so.0 =&gt; not found libdl.so.2 =&gt; /lib64/libdl.so.2 (0x0000003d58c00000) libm.so.6 =&gt; /lib64/libm.so.6 (0x0000003d59c00000) libnuma.so.1 =&gt; /usr/lib64/libnuma.so.1 (0x00007ffff7ddf000) libpci.so.3 =&gt; /lib64/libpci.so.3 (0x00007ffff7bd2000) librt.so.1 =&gt; /lib64/librt.so.1 (0x0000003d5a000000) libnsl.so.1 =&gt; /lib64/libnsl.so.1 (0x0000003d5c000000) libutil.so.1 =&gt; /lib64/libutil.so.1 (0x0000003d5a800000) libpthread.so.0 =&gt; /lib64/libpthread.so.0 (0x0000003d59400000) libc.so.6 =&gt; /lib64/libc.so.6 (0x0000003d59000000) /lib64/ld-linux-x86-64.so.2 (0x0000003d58800000) libresolv.so.2 =&gt; /lib64/libresolv.so.2 (0x0000003d5b000000) </code></pre> <p>Notice the "not found" in the libmpi.so entry.</p> <p>You could set LD_LIBRARY_PATH and have it found:</p> <pre><code>[8:45] svbu-mpi:~/mpi % setenv LD_LIBRARY_PATH /home/jsquyres/bogus/lib [8:45] svbu-mpi:~/mpi % ldd hello linux-vdso.so.1 =&gt; (0x00007ffff7ffe000) libmpi.so.0 =&gt; /home/jsquyres/bogus/lib/libmpi.so.0 (0x00007ffff7b06000) libdl.so.2 =&gt; /lib64/libdl.so.2 (0x0000003d58c00000) libm.so.6 =&gt; /lib64/libm.so.6 (0x0000003d59c00000) libnuma.so.1 =&gt; /usr/lib64/libnuma.so.1 (0x00007ffff78e8000) libpci.so.3 =&gt; /lib64/libpci.so.3 (0x00007ffff76db000) librt.so.1 =&gt; /lib64/librt.so.1 (0x0000003d5a000000) libnsl.so.1 =&gt; /lib64/libnsl.so.1 (0x0000003d5c000000) libutil.so.1 =&gt; /lib64/libutil.so.1 (0x0000003d5a800000) libpthread.so.0 =&gt; /lib64/libpthread.so.0 (0x0000003d59400000) libc.so.6 =&gt; /lib64/libc.so.6 (0x0000003d59000000) /lib64/ld-linux-x86-64.so.2 (0x0000003d58800000) libresolv.so.2 =&gt; /lib64/libresolv.so.2 (0x0000003d5b000000) </code></pre> <p>Or you could use an -rpath clause (and then the setting in LD_LIBRARY_PATH becomes irrelevant):</p> <pre><code>[8:45] svbu-mpi:~/mpi % mpicc hello.c -o hello -Wl,-rpath /home/jsquyres/bogus/lib [8:45] svbu-mpi:~/mpi % ldd hello linux-vdso.so.1 =&gt; (0x00007ffff7ffe000) libmpi.so.0 =&gt; /home/jsquyres/bogus/lib/libmpi.so.0 (0x00007ffff7b06000) libdl.so.2 =&gt; /lib64/libdl.so.2 (0x0000003d58c00000) libm.so.6 =&gt; /lib64/libm.so.6 (0x0000003d59c00000) libnuma.so.1 =&gt; /usr/lib64/libnuma.so.1 (0x00007ffff78e8000) libpci.so.3 =&gt; /lib64/libpci.so.3 (0x00007ffff76db000) librt.so.1 =&gt; /lib64/librt.so.1 (0x0000003d5a000000) libnsl.so.1 =&gt; /lib64/libnsl.so.1 (0x0000003d5c000000) libutil.so.1 =&gt; /lib64/libutil.so.1 (0x0000003d5a800000) libpthread.so.0 =&gt; /lib64/libpthread.so.0 (0x0000003d59400000) libc.so.6 =&gt; /lib64/libc.so.6 (0x0000003d59000000) /lib64/ld-linux-x86-64.so.2 (0x0000003d58800000) libresolv.so.2 =&gt; /lib64/libresolv.so.2 (0x0000003d5b000000) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload