Difference between revisions of "Setting Up MPI on Aurora at Smith"
(→Testing) |
(→Setting up Bash as Default and Adding MPI to Path) |
||
Line 10: | Line 10: | ||
</bluebox> | </bluebox> | ||
<br /> | <br /> | ||
− | =Setting up Bash as Default | + | =Setting up Bash as Default Shell & Adding MPI to Path= |
<br /> | <br /> | ||
* Login to your 352 account | * Login to your 352 account | ||
Line 40: | Line 40: | ||
<br /> | <br /> | ||
+ | |||
=Testing= | =Testing= | ||
<br /> | <br /> |
Latest revision as of 22:23, 4 March 2017
--D. Thiebaut (talk) 21:18, 4 March 2017 (EST)
This page presents the few steps required to setup MPI on a student account on Aurora.
Setting up Bash as Default Shell & Adding MPI to Path
- Login to your 352 account
- Using emacs, add these three lines at the end of your .login file:
if (-x /bin/bash) then exec /bin/bash -l endif
- Using emacs, add the following lines at the end of your .bash_profile file:
PATH=/Users/classes/352b/bin/mpi/bin:$PATH:$HOME/bin
- When done, logout and log back in.
- Verify that MPI is now in the path and ready to run:
mpicc -v
- You should get a long output of information Using built-in specs.
COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.1' ... --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
Testing
- Using emacs, create this simple C program:
/* C Example */ #include <stdio.h> #include <mpi.h> int main (argc, argv) int argc; char *argv[]; { int rank, size; MPI_Init (&argc, &argv); /* starts MPI */ MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */ MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */ printf( "Hello world from process %d of %d\n", rank, size ); MPI_Finalize(); return 0; }
- Compile and run the program for 2 Processors:
mpicc helloWorld.c -o hello mpirun -np 2 ./hello
- You should get this output:
Hello world from process 0 of 2 Hello world from process 1 of 2
- If you get this output, you're all set!