3

I have installed MPI and GCC seperatly using yum commands, And now when I use following command:

mpic++ first.c -o first

it says:

bash: mpic++: command not found

Can somebody please help me? I will be very thankful.

Background: I am using centos 6.5, and i am new on linux, however I have good understanding of terminal.

mshahbazm
  • 611
  • 1
  • 11
  • 23

3 Answers3

5

Mpi environment is controlled by module in CentOS so you first have to load the mpi/openmpi-x86_64 module:

module load mpi/openmpi-x86_64
paugier
  • 1,838
  • 2
  • 20
  • 39
1

In my case (Centos 7.5) the module command was not available, so I just needed to add the MPI executables to my path.

I found their location by looking at the output of this command:

rpmquery -l openmpi-devel | grep cc

And then added the following to my path:

export PATH=$PATH:/usr/lib64/openmpi/bin/
Bar
  • 2,736
  • 3
  • 33
  • 41
0

See it: https://courses.cs.washington.edu/courses/csep524/13wi/mpi/mpi_setup.txt I also install mpi from yum, but it can't help me. I use:

download mpich

cd
wget http://www.mpich.org/static/tarballs/3.0.2/mpich-3.0.2.tar.gz
tar xzf mpich-3.0.2.tar.gz

build mpich and install in home (can also see mpich-3.0.2/README)

cd mpich-3.0.2
./configure --prefix=$HOME/mpich-install 2>&1 | tee c.txt
make 2>&1 | tee m.txt
make install 2>&1 | tee mi.txt

put mpi binaries (e.g. mpicc, mpirun) on your PATH add the following line to your ~/.bashrc:

export PATH=$PATH:~/mpich-install/bin
source ~/.bashrc

compile hello world:

mpicc helloworld.c -o helloworld

I get: cc: error: helloworld.c: No such file or director

Mikhail Ionkin
  • 568
  • 4
  • 20