Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-11-03 Thread Jeff Squyres

Can you replicate the scenario in smaller / different cases?

- write a sample plugin in C instead of C++
- write a non-MPI Fortran application that loads your C++ application
- ...?

In short, *MPI* shouldn't be interfering with Fortran/C++ common  
blocks.  Try taking MPI out of the picture and see if that makes the  
problem go away.


Those are pretty much shots in the dark, but I don't know where to go,  
either -- try random things until you find what you want.



On Nov 3, 2008, at 3:51 AM, Rajesh Ramaya wrote:


Helllo Jeff, Gustavo, Mi
   Thank for the advice. I am familiar with the difference in the  
compiler code generation for C, C++ & FORTRAN. I even tried to look  
at some of the common block symbols. The name of the symbol remains  
the same. The only difference that I observe is in FORTRAN compiled  
*.o  00515bc0 B aux7loc_  and the C++ compiled code  U  
aux7loc_  the memory is not allocated as it has been declared as  
extern in C++. When the executable loads the shared library it finds  
all the undefined symbols. Atleast if it did not manage to find a  
single symbol it prints undefined symbol error.

I am completely stuck up and do not know how to continue further.

Thanks,
Rajesh

From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org]  
On Behalf Of Mi Yan

Sent: samedi 1 novembre 2008 23:26
To: Open MPI Users
Cc: 'Open MPI Users'; users-boun...@open-mpi.org
Subject: Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

So your tests show:
1. "Shared library in FORTRAN + MPI executable in FORTRAN" works.
2. "Shared library in C++ + MPI executable in FORTRAN " does not work.

It seems to me that the symbols in C library are not really  
recognized by FORTRAN executable as you thought. What compilers did  
yo use to built OpenMPI?


Different compiler has different convention to handle symbols. E.g.  
if there is a variable "var_foo" in your FORTRAN code, some FORTRN  
compiler will save "var_foo_" in the object file by default; if you  
want to access "var_foo" in C code, you actually need to refer  
"var_foo_" in C code. If you define "var_foo" in a module in the  
FORTAN compiler, some FORTRAN compiler may append the module name to  
"var_foo".
So I suggest to check the symbols in the object files generated by  
your FORTAN and C compiler to see the difference.


Mi
"Rajesh Ramaya" <rajesh.ram...@e-xstream.com>


"Rajesh Ramaya" <rajesh.ram...@e-xstream.com>
Sent by: users-boun...@open-mpi.org
10/31/2008 03:07 PM

Please respond to
Open MPI Users <us...@open-mpi.org>

To

"'Open MPI Users'" <us...@open-mpi.org>, "'Jeff Squyres'" <jsquy...@cisco.com 
>


cc


Subject

Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)




Hello Jeff Squyres,
  Thank you very much for the immediate reply. I am able to  
successfully

access the data from the common block but the values are zero. In my
algorithm I even update a common block but the update made by the  
shared
library is not taken in to account by the executable. Can you please  
be very
specific how to make the parallel algorithm aware of the data?  
Actually I am
not writing any MPI code inside? It's the executable (third party  
software)
who does that part. All that I am doing is to compile my code with  
MPI c

compiler and add it in the LD_LIBIRARY_PATH.
In fact I did a simple test by creating a shared library using a  
FORTRAN
code and the update made to the common block is taken in to account  
by the
executable. Is there any flag or pragma that need to be activated  
for mixed

language MPI?
Thank you once again for the reply.

Rajesh

-Original Message-
From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org]  
On

Behalf Of Jeff Squyres
Sent: vendredi 31 octobre 2008 18:53
To: Open MPI Users
Subject: Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

On Oct 31, 2008, at 11:57 AM, Rajesh Ramaya wrote:

> I am completely new to MPI. I have a basic question concerning
> MPI and mixed language coding. I hope any of you could help me out.
> Is it possible to access FORTRAN common blocks in C++ in a MPI
> compiled code. It works without MPI but as soon I switch to MPI the
> access of common block does not work anymore.
> I have a Linux MPI executable which loads a shared library at
> runtime and resolves all undefined symbols etc  The shared library
> is written in C++ and the MPI executable in written in FORTRAN. Some
> of the input that the shared library looking for are in the Fortran
> common blocks. As I access those common blocks during runtime the
> values are not  initialized.  I would like to know if what I am
> doing is possible ?I hope that my problem is clear..


Generally, MPI should not get in the way of sharing common blocks
between Fortran an

Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-11-03 Thread Rajesh Ramaya
Helllo Jeff, Gustavo, Mi

   Thank for the advice. I am familiar with the difference in the compiler
code generation for C, C++ & FORTRAN. I even tried to look at some of the
common block symbols. The name of the symbol remains the same. The only
difference that I observe is in FORTRAN compiled *.o  00515bc0 B
aux7loc_  and the C++ compiled code  U aux7loc_  the memory is not allocated
as it has been declared as extern in C++. When the executable loads the
shared library it finds all the undefined symbols. Atleast if it did not
manage to find a single symbol it prints undefined symbol error. 

I am completely stuck up and do not know how to continue further.



Thanks,

Rajesh



From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org] On
Behalf Of Mi Yan
Sent: samedi 1 novembre 2008 23:26
To: Open MPI Users
Cc: 'Open MPI Users'; users-boun...@open-mpi.org
Subject: Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)



So your tests show:
1. "Shared library in FORTRAN + MPI executable in FORTRAN" works.
2. "Shared library in C++ + MPI executable in FORTRAN " does not work.

It seems to me that the symbols in C library are not really recognized by
FORTRAN executable as you thought. What compilers did yo use to built
OpenMPI?

Different compiler has different convention to handle symbols. E.g. if there
is a variable "var_foo" in your FORTRAN code, some FORTRN compiler will save
"var_foo_" in the object file by default; if you want to access "var_foo" in
C code, you actually need to refer "var_foo_" in C code. If you define
"var_foo" in a module in the FORTAN compiler, some FORTRAN compiler may
append the module name to "var_foo". 
So I suggest to check the symbols in the object files generated by your
FORTAN and C compiler to see the difference.

Mi
Inactive hide details for "Rajesh Ramaya"
<rajesh.ram...@e-xstream.com>"Rajesh Ramaya" <rajesh.ram...@e-xstream.com>




"Rajesh Ramaya" <rajesh.ram...@e-xstream.com> 
Sent by: users-boun...@open-mpi.org 

10/31/2008 03:07 PM 


Please respond to
Open MPI Users <us...@open-mpi.org>




To


"'Open MPI Users'" <us...@open-mpi.org>, "'Jeff Squyres'"
<jsquy...@cisco.com>




cc






Subject


Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)









Hello Jeff Squyres,
  Thank you very much for the immediate reply. I am able to successfully
access the data from the common block but the values are zero. In my
algorithm I even update a common block but the update made by the shared
library is not taken in to account by the executable. Can you please be very
specific how to make the parallel algorithm aware of the data? Actually I am
not writing any MPI code inside? It's the executable (third party software)
who does that part. All that I am doing is to compile my code with MPI c
compiler and add it in the LD_LIBIRARY_PATH. 
In fact I did a simple test by creating a shared library using a FORTRAN
code and the update made to the common block is taken in to account by the
executable. Is there any flag or pragma that need to be activated for mixed
language MPI?
Thank you once again for the reply.

Rajesh   

-Original Message-
From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org] On
Behalf Of Jeff Squyres
Sent: vendredi 31 octobre 2008 18:53
To: Open MPI Users
Subject: Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

On Oct 31, 2008, at 11:57 AM, Rajesh Ramaya wrote:

> I am completely new to MPI. I have a basic question concerning  
> MPI and mixed language coding. I hope any of you could help me out.  
> Is it possible to access FORTRAN common blocks in C++ in a MPI  
> compiled code. It works without MPI but as soon I switch to MPI the  
> access of common block does not work anymore.
> I have a Linux MPI executable which loads a shared library at  
> runtime and resolves all undefined symbols etc  The shared library  
> is written in C++ and the MPI executable in written in FORTRAN. Some  
> of the input that the shared library looking for are in the Fortran  
> common blocks. As I access those common blocks during runtime the  
> values are not  initialized.  I would like to know if what I am  
> doing is possible ?I hope that my problem is clear..


Generally, MPI should not get in the way of sharing common blocks  
between Fortran and C/C++.  Indeed, in Open MPI itself, we share a few  
common blocks between Fortran and the main C Open MPI implementation.

What is the exact symptom that you are seeing?  Is the application  
failing to resolve symbols at run-time, possibly indicating that  
something hasn't instantiated a common block?  Or are you able to  
successfully access the data from the common block, but it doesn't  
have the values you expect (e.g., perhaps you're se

Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-11-02 Thread Terry Frankcombe
On Sat, 2008-11-01 at 07:52 -0400, Jeff Squyres wrote:
> On Oct 31, 2008, at 3:07 PM, Rajesh Ramaya wrote:
> 
> >   Thank you very much for the immediate reply. I am able to  
> > successfully
> > access the data from the common block but the values are zero. In my
> > algorithm I even update a common block but the update made by the  
> > shared
> > library is not taken in to account by the executable.
> 
> Can you reduce this to a small example that you can share, perchance?

Is it all the MPI processes getting zeros, or only a subset?  Does what
you see change if you run your app without mpirun, or with mpirun -n 1?




Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-11-01 Thread Mi Yan

So your tests show:
1.  "Shared library in FORTRAN   +   MPI executable in FORTRAN" works.
2. "Shared library in C++   + MPI executable in FORTRAN " does not work.

It seems to me that the symbols in  C library are not really recognized by
FORTRAN executable as you thought.What compilers  did yo use to built
OpenMPI?

 Different compiler has different convention to handle symbols.   E.g.  if
there is a variable "var_foo"  in your FORTRAN code,  some FORTRN compiler
will save "var_foo_"  in the object file by default;  if you want to access
"var_foo"  in C code, you actually need to refer "var_foo_"  in C code.
If you define "var_foo" in a module in the FORTAN compiler,  some FORTRAN
compiler may append the module name to "var_foo".
So I suggest to check the symbols in the object files generated by your
FORTAN and C compiler to see the difference.

Mi


   
 "Rajesh Ramaya"   
 <rajesh.ramaya@e- 
 xstream.com>   To
 Sent by:  "'Open MPI Users'"  
 users-bounces@ope <us...@open-mpi.org>, "'Jeff
 n-mpi.org Squyres'" <jsquy...@cisco.com>  
cc
       
         10/31/2008 03:07  Subject
     PMRe: [OMPI users] MPI + Mixed
   language coding(Fortran90 + C++)
   
 Please respond to 
  Open MPI Users   
 <users@open-mpi.o 
rg>
   
   




Hello Jeff Squyres,
   Thank you very much for the immediate reply. I am able to successfully
access the data from the common block but the values are zero. In my
algorithm I even update a common block but the update made by the shared
library is not taken in to account by the executable. Can you please be
very
specific how to make the parallel algorithm aware of the data? Actually I
am
not writing any MPI code inside? It's the executable (third party software)
who does that part. All that I am doing is to compile my code with MPI c
compiler and add it in the LD_LIBIRARY_PATH.
In fact I did a simple test by creating a shared library using a FORTRAN
code and the update made to the common block is taken in to account by the
executable. Is there any flag or pragma that need to be activated for mixed
language MPI?
Thank you once again for the reply.

Rajesh

-Original Message-
From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org] On
Behalf Of Jeff Squyres
Sent: vendredi 31 octobre 2008 18:53
To: Open MPI Users
Subject: Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

On Oct 31, 2008, at 11:57 AM, Rajesh Ramaya wrote:

> I am completely new to MPI. I have a basic question concerning
> MPI and mixed language coding. I hope any of you could help me out.
> Is it possible to access FORTRAN common blocks in C++ in a MPI
> compiled code. It works without MPI but as soon I switch to MPI the
> access of common block does not work anymore.
> I have a Linux MPI executable which loads a shared library at
> runtime and resolves all undefined symbols etc  The shared library
> is written in C++ and the MPI executable in written in FORTRAN. Some
> of the input that the shared library looking for are in the Fortran
> common blocks. As I access those common blocks during runtime the
> values are not  initialized.  I would like to know if what I am
> doing is possible ?I hope that my problem is clear..


Generally, MPI should not get in the way of sharing common blocks
between Fortran and C/C++.  Indeed, in Open MPI itself, we share a few
common blocks between Fortran and the main C Open MPI implementation.

What is the exact symptom that you are seeing?  Is the application
failing to resolve symbols at run-time, possibly indicating that
something hasn't instantiated a common block?  Or are you able to
successfully access the data from the common block, but it doesn't
have the values you expect (e.g., perhaps you're seeing all zeros)?

If the former, you might want to check your build procedure.  You
*should

Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-11-01 Thread Jeff Squyres

On Oct 31, 2008, at 3:07 PM, Rajesh Ramaya wrote:

  Thank you very much for the immediate reply. I am able to  
successfully

access the data from the common block but the values are zero. In my
algorithm I even update a common block but the update made by the  
shared

library is not taken in to account by the executable.


Can you reduce this to a small example that you can share, perchance?

It might be worth stepping through one of your MPI processes with a  
debugger and see what the run-time-resolved addresses for your common  
block are, as viewed from each of the different entities in your  
application (to see if the linker is somehow mismatching them...  
that's a pretty wild guess, though).



Can you please be very
specific how to make the parallel algorithm aware of the data?


All I was trying to [poorly] say is that based on whatever parallel  
algorithm is being used, all the data may now not be available in all  
MPI processes -- it may only be partially available in each MPI  
process.  So it may not be that the entire common block is empty, but  
perhaps only part of it (because this MPI process is not responsible  
for that part of the data).  This is entirely problem/application- 
specific, of course, and may or may not apply to your situation.



Actually I am
not writing any MPI code inside? It's the executable (third party  
software)
who does that part. All that I am doing is to compile my code with  
MPI c

compiler and add it in the LD_LIBIRARY_PATH.
In fact I did a simple test by creating a shared library using a  
FORTRAN
code and the update made to the common block is taken in to account  
by the
executable. Is there any flag or pragma that need to be activated  
for mixed

language MPI?


No, there shouldn't be.

--
Jeff Squyres
Cisco Systems



Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-10-31 Thread Gustavo Seabra
On Fri, Oct 31, 2008 at 3:07 PM, Rajesh Ramaya wrote:

> Actually I am
> not writing any MPI code inside? It's the executable (third party software)
> who does that part.

What are you using for this? We too use Fortran and C routines
combined with no problem at all. I would think that whatever
"third-party" software you are using here is not doing its job right.

-- 
Gustavo Seabra
Postdoctoral Associate
Quantum Theory Project - University of Florida
Gainesville - Florida - USA


Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-10-31 Thread Rajesh Ramaya
Hello Jeff Squyres,
   Thank you very much for the immediate reply. I am able to successfully
access the data from the common block but the values are zero. In my
algorithm I even update a common block but the update made by the shared
library is not taken in to account by the executable. Can you please be very
specific how to make the parallel algorithm aware of the data? Actually I am
not writing any MPI code inside? It's the executable (third party software)
who does that part. All that I am doing is to compile my code with MPI c
compiler and add it in the LD_LIBIRARY_PATH. 
In fact I did a simple test by creating a shared library using a FORTRAN
code and the update made to the common block is taken in to account by the
executable. Is there any flag or pragma that need to be activated for mixed
language MPI?
Thank you once again for the reply.

Rajesh   

-Original Message-
From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org] On
Behalf Of Jeff Squyres
Sent: vendredi 31 octobre 2008 18:53
To: Open MPI Users
Subject: Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

On Oct 31, 2008, at 11:57 AM, Rajesh Ramaya wrote:

> I am completely new to MPI. I have a basic question concerning  
> MPI and mixed language coding. I hope any of you could help me out.  
> Is it possible to access FORTRAN common blocks in C++ in a MPI  
> compiled code. It works without MPI but as soon I switch to MPI the  
> access of common block does not work anymore.
> I have a Linux MPI executable which loads a shared library at  
> runtime and resolves all undefined symbols etc  The shared library  
> is written in C++ and the MPI executable in written in FORTRAN. Some  
> of the input that the shared library looking for are in the Fortran  
> common blocks. As I access those common blocks during runtime the  
> values are not  initialized.  I would like to know if what I am  
> doing is possible ?I hope that my problem is clear..


Generally, MPI should not get in the way of sharing common blocks  
between Fortran and C/C++.  Indeed, in Open MPI itself, we share a few  
common blocks between Fortran and the main C Open MPI implementation.

What is the exact symptom that you are seeing?  Is the application  
failing to resolve symbols at run-time, possibly indicating that  
something hasn't instantiated a common block?  Or are you able to  
successfully access the data from the common block, but it doesn't  
have the values you expect (e.g., perhaps you're seeing all zeros)?

If the former, you might want to check your build procedure.  You  
*should* be able to simply replace your C++ / F90 compilers with  
mpicxx and mpif90, respectively, and be able to build an MPI version  
of your app.  If the latter, you might need to make your parallel  
algorithm aware of what data is available in which MPI process --  
perhaps not all the data is filled in on each MPI process...?

-- 
Jeff Squyres
Cisco Systems


___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users



Re: [OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-10-31 Thread Jeff Squyres

On Oct 31, 2008, at 11:57 AM, Rajesh Ramaya wrote:

I am completely new to MPI. I have a basic question concerning  
MPI and mixed language coding. I hope any of you could help me out.  
Is it possible to access FORTRAN common blocks in C++ in a MPI  
compiled code. It works without MPI but as soon I switch to MPI the  
access of common block does not work anymore.
I have a Linux MPI executable which loads a shared library at  
runtime and resolves all undefined symbols etc  The shared library  
is written in C++ and the MPI executable in written in FORTRAN. Some  
of the input that the shared library looking for are in the Fortran  
common blocks. As I access those common blocks during runtime the  
values are not  initialized.  I would like to know if what I am  
doing is possible ?I hope that my problem is clear..



Generally, MPI should not get in the way of sharing common blocks  
between Fortran and C/C++.  Indeed, in Open MPI itself, we share a few  
common blocks between Fortran and the main C Open MPI implementation.


What is the exact symptom that you are seeing?  Is the application  
failing to resolve symbols at run-time, possibly indicating that  
something hasn't instantiated a common block?  Or are you able to  
successfully access the data from the common block, but it doesn't  
have the values you expect (e.g., perhaps you're seeing all zeros)?


If the former, you might want to check your build procedure.  You  
*should* be able to simply replace your C++ / F90 compilers with  
mpicxx and mpif90, respectively, and be able to build an MPI version  
of your app.  If the latter, you might need to make your parallel  
algorithm aware of what data is available in which MPI process --  
perhaps not all the data is filled in on each MPI process...?


--
Jeff Squyres
Cisco Systems




[OMPI users] MPI + Mixed language coding(Fortran90 + C++)

2008-10-31 Thread Rajesh Ramaya
Hello MPI Users,

I am completely new to MPI. I have a basic question concerning MPI and
mixed language coding. I hope any of you could help me out. Is it possible
to access FORTRAN common blocks in C++ in a MPI compiled code. It works
without MPI but as soon I switch to MPI the access of common block does not
work anymore. 

I have a Linux MPI executable which loads a shared library at runtime and
resolves all undefined symbols etc  The shared library is written in C++ and
the MPI executable in written in FORTRAN. Some of the input that the shared
library looking for are in the Fortran common blocks. As I access those
common blocks during runtime the values are not  initialized.  I would like
to know if what I am doing is possible ?I hope that my problem is
clear..

  Your valuable suggestions are welcome !!!



Thank you,

Rajesh