In this post you will see that, how to compile and run your mpi program in gedit with one shortcut key.
If you not installed MPI, look at here for installation on ubuntu. You will see compile and run your mpi program in Geany.
If you are using Gedit and you want to control number of process simple, use the gedit external script below written by me.
After you wrote your code, press ALT+R for compiling and running its.
You will see that : your program will be compiling (mpicc) and running (mpirun) with you specified number of processes in .c program file. You can see it below.
// mpirun with np=4
Watch the video.
installation on ubuntu :
# install openmpi
sudo apt-get install libopenmpi-dev openmpi-bin openmpi-doc
# install gedit plugins.
sudo apt-get install gedit-plugins
# enable external tools.
# compile mpi program
mpicc test.c -o testprog
# run compiled mpi program
mpirun -np 5 testprog
External tools script:
#!/bin/sh cat - > /tmp/a.c np=`eval grep "mpirun\ with\ np=" /tmp/a.c | awk -F "=" {'print $2'}` mpicc /tmp/a.c -o /tmp/a.out mpirun -np $np /tmp/a.out
Don't forget
add this line to your mpi program for number of processor.
// mpirun with np=4
Have a good time.
0 comments:
Post a Comment