[OMPI users] Cannot compile code with gfortran + OpenMPI when OpenMPI was built with latest intl compilers

2012-05-19 Thread Sergiy Bubin

Hi,I reinstalled/upgraded the operating system on my desktop (now it is Kubuntu 
12.04 64 bit) and installed the newest set of intel compilers (ver. 12.1.3 ). 
Then I built OpenMPI with that set of intel compilers. Everything seems to be 
fine and I can compile my fortran+MPI code with no problem when I invoke ifort. 
I should say that I do not actually invoke the "wrapper" mpi compiler. I 
normally just add flags as MPICOMPFLAGS=$(shell mpif90 --showme:compile) and 
MPILINKFLAGS=$(shell mpif90 --showme:link) in my makefile. I know it is not the 
recommended way of doing things but the reason I do that is that I absolutely 
need to be able to use different fortran compilers to build my fortran code. So 
far I never had problems using gfortran even though my OpenMPI build is always 
done with intel compilers. There seemed to be compatibility. However, after the 
last upgrade of the OS and compilers I can no longer do that. When I use 
gfortran (ver. 4.6.3) I get messages such as:
debug/main.o: In function 
`MAIN__':/home/bubin/fp/pectus_prototype/./src/main.f90:6: undefined reference 
to `mpi_init_'/home/bubin/fp/pectus_prototype/./src/main.f90:7: undefined 
reference to `mpi_comm_rank_'/home/bubin/fp/pectus_prototype/./src/main.f90:8: 
undefined reference to 
`mpi_comm_size_'/home/bubin/fp/pectus_prototype/./src/main.f90:12: undefined 
reference to 
`omp_get_max_threads_'/home/bubin/fp/pectus_prototype/./src/main.f90:13: 
undefined reference to 
`omp_get_num_procs_'/home/bubin/fp/pectus_prototype/./src/main.f90:19: 
undefined reference to `mpi_finalize_'
I also tried to use the fortran compiler (f95) from the latest Solaris Studio 
(ver 12.3) together with OpenMPI (which was again built with intel) and I do 
not have that problem there. The version of OpenMPI source that I have is 1.4.3 
(I also tried 1.4.5 - same result) 
Thus, I can compile my code with ifort or solaris studio f95, but not gfortran. 
As I said I never had this problem before (have used ubuntu + ifort + gfortran 
+ sun/solaris studio for several years on my desktop computers). I wonder if 
there is an easy solution here, such as some compiler flags for gfortran that 
force compatibility. Or, perhaps, I need to rebuild OpenMPI with some other 
flags. I tried to google something useful but did not find anything that would 
help me.
One potential solution to my problem, I imagine, would be to build OpenMPI 
separately with intel compilers and gnu compilers (in fact it is already 
prebuilt with gnu compilers by the ubuntu team) and then use one of those 
builds depending on the fortran compiler for my code. However, that will create 
inconvenience because I normally use Netbeans or Solaris Studio and switch 
configurations while working in there (each configuration has its own set of 
parameters for the makefile; one of the parameter accepted by the makefile is 
the compiler type -- intel, gnu, or solaris).
Any help would be appreciated.Sergiy
  

Re: [OMPI users] Cannot compile code with gfortran + OpenMPI when OpenMPI was built with latest intl compilers

2012-05-19 Thread Tim Prince

On 5/19/2012 2:20 AM, Sergiy Bubin wrote:
I built OpenMPI with that set of intel compilers. Everything seems to 
be fine and I can compile my fortran+MPI code with no problem when I 
invoke ifort. I should say that I do not actually invoke the "wrapper" 
mpi compiler. I normally just add flags as MPICOMPFLAGS=$(shell mpif90 
--showme:compile) and MPILINKFLAGS=$(shell mpif90 --showme:link) in my 
makefile. I know it is not the recommended way of doing things but the 
reason I do that is that I absolutely need to be able to use different 
fortran compilers to build my fortran code.
Avoiding the use of mpif90 accomplishes nothing for changing between 
incompatible Fortran compilers.   Run-time libraries are incompatible 
among ifort, gfortran, and Oracle Fortran, so you can't link a mixture 
of objects compiled by incompatible Fortran compilers except in limited 
circumstances.  This includes the MPI Fortran library.
I don't see how it is too great an inconvenience for your Makefile to 
set PATH and LD_LIBRARY_PATH to include the mpif90 corresponding to the 
chosen Fortran compiler.  You may need to build your own mpif90 for 
gfortran as well as the other compilers, so as to configure it to keep 
it off the default PATHs (e.g. --prefix=/opt/ompi1.4gf/), if you can't 
move the Ubuntu ompi.

Surely most of this is implied in the OpenMPI instructions.

--
Tim Prince



Re: [OMPI users] MPI_SCAN

2012-05-19 Thread Rohan Deshpande
Hi jeffy,

Thanks for your reply.

I am not understanding how MPI_Reduce would be useful.

Say I have 3 processes and each process has array [1,2,3,4]

When each process calculates the prefix sum using cuda each process will
have array as [1,3,6,10]

so if I use MPI_Reduce to gather results it returns me sum as 30.

but the original array is [1,2,3,4,1,2,3,4,1,2,3,4] and the prefix sum of
this array should be

[1,3,6,10,11,13,16,20,21,23,26,30]

Is my understanding wrong somewhere?

On Fri, May 18, 2012 at 7:05 AM, Jeff Squyres  wrote:

> You probably want MPI_Reduce, instead.
>
>http://www.open-mpi.org/doc/v1.6/man3/MPI_Reduce.3.php
>
>
> On May 15, 2012, at 11:27 PM, Rohan Deshpande wrote:
>
> > I am performing Prefix scan operation on cluster
> >
> > I have 3 MPI tasks and master task is responsible for distributing the
> data
> >
> > Now, each task calculates sum of its own part of array using GPUs and
> returns the results to master task.
> >
> > Master task also calculates its own part of array using GPU.
> >
> > When each task returns its result (which would be array) master task
> needs to combine all the results to get the final result.
> >
> > Can I use MPI_SCAN to combine the results?
> >
> >
> >
> >
> >
> > ___
> > users mailing list
> > us...@open-mpi.org
> > http://www.open-mpi.org/mailman/listinfo.cgi/users
>
>
> --
> Jeff Squyres
> jsquy...@cisco.com
> For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/
>
>
> ___
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>



-- 

Best Regards,

ROHAN DESHPANDE