Remove all previous version MPI and reinstall correctly it - linux

First of all: I'm on linux mint 17.3 x64
What I've done so far:
Guide to install Open MPI 1.8
Guide to install MPI
Attemp to remove MPI executing: sudo apt-get install libcr-dev mpich2 mpich2-doc (Actually the should be not installed)
What I can see from terminal:
output of: echo $PATH
/path/to/mpj//bin:/home/timmy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/timmy/.openmpi/bin
(I immagine that I've to remove /path/to/mpj/ (not exists) and /home/timmy/.openmpi/bin (I want to remove previous version of ompi))
output of: echo $LD_LIBRARY_PATH
(nothing)
Really, doesn't appear anything!
output of mpirun
--------------------------------------------------------------------------
mpirun could not find anything to do.
It is possible that you forgot to specify how many processes to run
via the "-np" argument.
--------------------------------------------------------------------------
Why I want to remove Open MPI and reinstall it
I've a project to do using both MPI and OpenMP and with the actual installation of MPI I cannot compile using the following command: mpicc -openmp "test_omp.c" -o "test_omp". It gives me the following error: Not defined function omp_get_thread_num(); and moreover, it ignore my #pragma commands.

Your problem is that you are giving the compiler the wrong option to enable the OpenMP support. -openmp is only understood by the (commercial) Intel compiler, which is probably the tool-set installed on the site you've referred to in your other question. Most Linux distributions come with GCC and one is to assume that mpicc will use GCC (check with mpicc -showme).
The option to enable OpenMP support in GCC is -fopenmp (notice the f).

Related

How to install Open MPI with Cuda-Aware MPI in Linux Debian

I am installing Open MPI v1.8.8 with CUDA v7.5 on my Linux Debian.
I have tested CUDA and it works, tested OpenMPI and it works too. But when i try to combine them into a program, i meet an error: cannot find cuda.h file . This is my scenario:
My program source code include these .h file
include "cuda.h"
include "mpi.h"
I run command:
mpicc <filePath> -o test
And error appear:cuda.h: No such file or directory
#include "cuda.h"`
omp_info give me : mca:mpi:base:param:mpi_built_with_cuda_support:value:false
I have googled , and i followed some methods i found:
./configure --with-cuda
./configure --with-cuda=/usr/local/cuda-7.5
( source link : http://mirror.its.dal.ca/openmpi/faq/?category=buildcuda)
After that, i remake all , remake install Open Mpi. I run: mpicc or mpirun, the compiler give me error : mpirun error mca: base: component find: unable to open /usr/local/lib/openmpi/mca_mpool_sm
I set up soft link : ln -s /usr/local/cuda/include /usr/include ( describe in link : Building CUDA-aware openMPI on Ubuntu 12.04 cannot find cuda.h).
But it cannot fix my issue.
Does anyone successfully install it? Please help me or share your experience.
Thanks.
I think you are confusing installation problems with incorrect compiler options. It will be necessary to explicity specify the include paths, library paths, and libraries for CUDA when compiling and linking host code with your mpi wrapped host compiler.
Something like:
mpicc -I/usr/local/cuda-7.5/include -L/usr/local/cuda-7.5/lib -o test <filePath> -lcuda
would be the normal way to build a simple MPI program which call the cuda driver APIs. You will need to add nvcc compilation for device code and host code which uses the runtime API.
The apparent lack of CUDA support in your MPI flavour is a separate question and one you should probably take up in another forum (like the user mailing list of the MPI flavour you use).

add path when installing mpich in ubuntu

I know there are many tips online about installing mpich2 in linux/ubuntu, but I just do not know how to add path so that each .c/.f90 file can see the 'mpif.h'.
I think I have successfully installed mpich2 on my machine. Because when I run
mpiexec -np 3 ./cpi
It works. cpi is a application in the 'example' file. But when I tried to run gcc -o mpitest hellow.c. It always said undefined reference to MPI_INIT and some similar errors.
The mpiexec mpirun are in /usr/local/bin and mpif.h mpi.hare in /usr/local/include. So how to add path?
Thanks in advance!
You don't need to add a anything to your PATH. What you need to do is to link your application with the MPI libraries.
MPI installations provide a useful wrapper for this. Simply replace gcc by mpicc:
mpicc -o mpitest hellow.c

How to make GCC detect standard C library?

my problem is the following :
In order to build some specific library I have to install GCC on a red hat without access to Internet and no way to use yum.
For now I did :
1)I installed gcc-x86_64-linux-gnu (and it's dependencies)
2) I created symbolic links in /usr/bin for the following installed executables : /usr/bin/x86_64-linux-gnu-cpp, /usr/bin/x86_64-linux-gnu-gcc, /usr/bin/x86_64-linux-gnu-gcov
using sudo ln -s /usr/bin/x86_64-linux-gnu-<end> <end>
So I have functional gcc cpp and gcov command.
3) I tested a ./configure on my library to build and get GCC saying that the C compiler isn't able to create C executable. I so tested to create a simple hello world C program.
#include<stdio.h>
int main(void){
printf("hello world!\n");
return 0;
}
when running gcc ./hello.c -o helloI got the this error : "fatal error : stdio.h : no such file or directory".
4) I did a ls /usr/include | grep .h but found nothing. Conclusion : standard C libs aren't installed.
5) I so installed glibc-devel to import the standard C library, and now the same command show numerous C files, including the stdio.h file.
But my GCC still raising the same fatal error.
Any idea about what should I do make to make it work ?
I don't think the problem here is related to x86 / x64 problem as it is suggested in this question
From your post i assume that this is related to improper installation, before installing a package make sure you use the proper package to the proper distribution as compatibility issues may arise with 32 Bit or 64 Bit OS package. You could try the below method by using a Red Hat Boot CD.
Install rpm from CDROM/DVD
Mount your RHEL Linux CD/DVD and install the following packages using rpm command:
$rpm -ivh gcc*

When installing gcc4.7 on 12.04, GCC doesn't switch from 4.6 to 4.7

I currently have the gcc4.7 and the gcc4.7-base, etc., packages installed but GCC seems to still be using 4.6 when I call
gcc --version
I could compile the source code if I really needed it now, but I plan on converting some old code to have fun with C++11. If anyone has any suggestions on how to switch from 4.6 to 4.7 do tell.
I followed the guide from here :
https://askubuntu.com/questions/113291/installing-gcc-4-7
Edit: Fixed the issue, updated link to /usr/bin/gcc-4.7
Try running the following to see where gcc is located:
ls -l `which gcc`
I'd say that odds are all you may need to do is update the link (but then again I can't check as I'm not booted into Linux at the moment)
You can just set your CC environment variable to /usr/bin/gcc-4.7 or whatever it is. Or maybe your build system has a different way to choose which compiler to use.
Chances are that many programs compiled for gcc 4.6 may not work for gcc 4.7. Hence you must keep both and at the same time make the link to gcc4.7 vary according to the situation. You can edit your gcc file to be a shell script :
#!/bin/sh
if [ -n "$GCC_SIX" ];
then
exec /usr/bin/gcc-4.6 "$#"
else
exec /usr/bin/gcc-4.7 "$#"
fi
Now, whenever you find a program not working on gcc4.7 just add a new environment variable and you have switched to gcc4.6 for the current execution. Notice that for a multi-user system, this can prove to be a life saver.

Setting up G++ or ICC for mpi.h on Ubuntu

I have never done any major programing outside of VS08.
I am trying to compile a program called LAMMPS with either of the two relevant make files. One calls g++ and the other calls icc (Intel's compiler).
icc produces this error:
icc -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M write_restart.cpp > write_restart.d
write_restart.cpp(15): catastrophic error: cannot open source file "mpi.h"
#include "mpi.h"
and g++ throws this error
g++ -g -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M verlet.cpp > verlet.d
pointers.h:25: fatal error: mpi.h: No such file or directory
compilation terminated.
The mpi.h file is located in /usr/lib/openmpi/include
It is my understanding that I need to set that $PATH variable which reads
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/intel/bin:/usr/lib/openmpi/include:
and $LD_LIBRARY_PATH which currently reads
/usr/lib/openmpi/lib:
SO, how does one include the mpi.h file? So that either icc or g++ find it?
mpi.h is a header for MPI library. That would be included if you use mpic++ MPI compiler wrapper instead of g++ in your makefile. mpic++ will call the appropriate compiler. From what you describe you have openmpi package installed on your ubuntu machine.
For more info, you need to consult the manual, e.g.
http://lammps.sandia.gov/doc/Section_start.html#2_2 (for LAMMPS)
and perhaps you need to see openmpi manual as to how to set up additional compiler. Not sure if this can be done after openmpi itself has been built. By default I think in Ubuntu openmpi compiler wrappers would only call g++. CMIIW.
Okay, so I got it to work with g++ when setting up cc as "mpic++.mpich2" instead of "mpic++"
you can try compile using openmpi make file in /src/MAKE
make openmpi
in my case, this option was successful

Resources