[opensuse-packaging] How to set mpi as dependency?
I am packaging a package whcih need mpi environment, but default installation of OpenMPI will set nothing. So I don't have mpicc, mpirun .. etc. commands. I could export PATH= .... but I think this adhoc solution is not right. Could anyone told me how to the standard way to set mpi as dependency? -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thursday 20 March 2014, Pengfei Hao wrote:
I am packaging a package whcih need mpi environment, but default installation of OpenMPI will set nothing. So I don't have mpicc, mpirun .. etc. commands. I could export PATH= .... but I think this adhoc solution is not right.
Could anyone told me how to the standard way to set mpi as dependency?
You could do like in package devel:libraries:c_c++:hdf5 %if 0%{?sles_version} %define _mvapich2 1 %endif %if 0%{?suse_version} %define _openmpi 1 %endif %define _mpi %{?_openmpi:openmpi} %{?_mvapich2:mvapich2} ... %if 0%{?_openmpi} BuildRequires: openmpi-devel %endif %if 0%{?_mvapich2} BuildRequires: mvapich2-devel %endif cu, Rudi -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Maybe I didn't make it clear. What I want is to have mpicc and mpirun command to compile MPI written code, it is kind like a compiler(But only script point to gcc). Even added the BuildRequires of openmpi and openmpi-devel , the mpicc and mpirun command is not ready. Usually , people need to use mpi-selector or 'module load modulefile' to set the environment variable to enable the PATH and INCLUDE_PATH etc. to let it work. But mpi-selector cannot have effect on current shell , and 'module load ' neither, but in the obs environment , I cannot control the shell of packaging. The only way I do this now based on my knowledge is to manually extract information from like openmpi's module file and export PATH=... and export WHATEVER=... but this is the adhoc way and I think I should not parse the module file by myself. Below is an example of module file, it indicate the PATH, INCLUDE, LD_LIBRARY_PATH necessary to run 'mpicc' and 'mpirun'. A package installation won't set them automatically, so I need some way to setup it in the spec file %prep or %build stage. $ cat /usr/share/modules/gnu-openmpi/1.6 #%Module proc ModulesHelp { } { global dotversion puts stderr "\tLoads the gnu - openmpi 1.6 Environment" } module-whatis "Loads the gnu openmpi 1.6 Environment." conflict gnu-openmpi prepend-path PATH /usr/lib64/mpi/gcc/openmpi/bin prepend-path INCLUDE /usr/lib64/mpi/gcc/openmpi/include prepend-path INCLUDE /usr/lib64/mpi/gcc/openmpi/lib64 prepend-path MANPATH /usr/lib64/mpi/gcc/openmpi/share/man prepend-path LD_LIBRARY_PATH /usr/lib64/mpi/gcc/openmpi/lib64 2014-03-20 3:29 GMT-05:00 Ruediger Meier <sweet_f_a@gmx.de>:
On Thursday 20 March 2014, Pengfei Hao wrote:
I am packaging a package whcih need mpi environment, but default installation of OpenMPI will set nothing. So I don't have mpicc, mpirun .. etc. commands. I could export PATH= .... but I think this adhoc solution is not right.
Could anyone told me how to the standard way to set mpi as dependency?
You could do like in package devel:libraries:c_c++:hdf5
%if 0%{?sles_version} %define _mvapich2 1 %endif %if 0%{?suse_version} %define _openmpi 1 %endif
%define _mpi %{?_openmpi:openmpi} %{?_mvapich2:mvapich2}
...
%if 0%{?_openmpi} BuildRequires: openmpi-devel %endif %if 0%{?_mvapich2} BuildRequires: mvapich2-devel %endif
cu, Rudi -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thursday 20 March 2014, Pengfei Hao wrote:
Maybe I didn't make it clear. What I want is to have mpicc and mpirun command to compile MPI written code, it is kind like a compiler(But only script point to gcc). Even added the BuildRequires of openmpi and openmpi-devel , the mpicc and mpirun command is not ready.
Thats why I've mentioned to look into the hdf5 package. Of course they do something with the %_mpi define from my first email: for mpi in %_mpi; do mkdir $mpi ln -s ../configure $mpi cd $mpi export CC="%{_libdir}/mpi/gcc/$mpi/bin/mpicc" export FC="%{_libdir}/mpi/gcc/$mpi/bin/mpif90" export F77="%{_libdir}/mpi/gcc/$mpi/bin/mpif77" export LD_LIBRARY_PATH="%{_libdir}/mpi/gcc/$mpi/%_lib" %configure \ --docdir=%{_docdir}/%{name} \ --prefix=%{_libdir}/mpi/gcc/$mpi \ --exec-prefix=%{_libdir}/mpi/gcc/$mpi \ --bindir=%{_libdir}/mpi/gcc/$mpi/bin \ --libdir=%{_libdir}/mpi/gcc/$mpi/%_lib \ --datadir=%{_libdir}/mpi/gcc/$mpi/share \ --includedir=%{_libdir}/mpi/gcc/$mpi/include \ --disable-dependency-tracking \ %if 0%{?suse_version} > 1140 --enable-fortran \ %endif --enable-hl \ --enable-shared \ --enable-parallel \ --with-pthread make %{?_smp_mflags} cd .. done But better look at the original hdf5.spec. cu, Rudi -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
have a loot at the usage of mpi-selector... intalling openmpi or mpich will not automatically set you the correct mpi.. as you expected... by the way mpirun shall not be of any concern in the compile/link process. regards, Alin On Thu 20 Mar 2014 15:51:29 Ruediger Meier wrote:
On Thursday 20 March 2014, Pengfei Hao wrote:
Maybe I didn't make it clear. What I want is to have mpicc and mpirun command to compile MPI written code, it is kind like a compiler(But only script point to gcc). Even added the BuildRequires of openmpi and openmpi-devel , the mpicc and mpirun command is not ready.
Thats why I've mentioned to look into the hdf5 package. Of course they do something with the %_mpi define from my first email:
for mpi in %_mpi; do mkdir $mpi ln -s ../configure $mpi cd $mpi export CC="%{_libdir}/mpi/gcc/$mpi/bin/mpicc" export FC="%{_libdir}/mpi/gcc/$mpi/bin/mpif90" export F77="%{_libdir}/mpi/gcc/$mpi/bin/mpif77" export LD_LIBRARY_PATH="%{_libdir}/mpi/gcc/$mpi/%_lib" %configure \ --docdir=%{_docdir}/%{name} \ --prefix=%{_libdir}/mpi/gcc/$mpi \ --exec-prefix=%{_libdir}/mpi/gcc/$mpi \ --bindir=%{_libdir}/mpi/gcc/$mpi/bin \ --libdir=%{_libdir}/mpi/gcc/$mpi/%_lib \ --datadir=%{_libdir}/mpi/gcc/$mpi/share \ --includedir=%{_libdir}/mpi/gcc/$mpi/include \ --disable-dependency-tracking \ %if 0%{?suse_version} > 1140 --enable-fortran \ %endif --enable-hl \ --enable-shared \ --enable-parallel \ --with-pthread
make %{?_smp_mflags} cd .. done
But better look at the original hdf5.spec.
cu, Rudi
-- Without Questions there are no Answers! ______________________________________________________________________ Dr. Alin Marin ELENA http://alin.elenaworld.net/ ______________________________________________________________________ -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (3)
-
Alin Marin Elena
-
Pengfei Hao
-
Ruediger Meier