Re: [OMPI users] Can't compile C++ program with extern "C" { #include mpi.h }

2008-01-01 Thread Adam C Powell IV
On Mon, 2007-12-31 at 20:01 -0700, Brian Barrett wrote:
> On Dec 31, 2007, at 7:26 PM, Adam C Powell IV wrote:
> 
> > Okay, fair enough for this test example.
> >
> > But the Salomé case is more complicated:
> > extern "C"
> > {
> > #include 
> > }
> > What to do here?  The hdf5 prototypes must be in an extern "C" block,
> > but hdf5.h #includes a file which #includes mpi.h...
> >
> > Thanks for the quick reply!
> 
> Yeah, this is a complicated example, mostly because HDF5 should  
> really be covering this problem for you.  I think your only option at  
> that point would be to use the #define to not include the C++ code.
> 
> The problem is that the MPI standard *requires* mpi.h to include both  
> the C and C++ interface declarations if you're using C++.  There's no  
> way for the preprocessor to determine whether there's a currently  
> active extern "C" block, so there's really not much we can do.  Best  
> hope would be to get the HDF5 guys to properly protect their code  
> from C++...

Okay.  So in HDF5, since they call MPI from C, they're just using the C
interface, right?  So should they define OMPI_SKIP_MPICXX just in case
they're #included by C++ and using OpenMPI, or is there a more MPI
implementation-agnostic way to do it?

Thanks again and happy new year!

-Adam
-- 
GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6

Engineering consulting with open source tools
http://www.opennovation.com/



[OMPI users] Tracing the library using gdb and xterm

2008-01-01 Thread Krishna Chaitanya
Hi,
   I have been tracing the interactions between the PERUSE and
MPI library,on one machine. I have been using gdb along with xterm to have
two windows open at the same time as I step through the code. I wish to get
a better glimpse of the working of the point to point calls, by launching
the job on two machines and by tracing the flow in a similar manner. This is
where I stand as of now :

mpirun --prefix /usr/local -hostfile machines  -np 2 xterm -e gdb peruse_ex1
xterm Xt error: Can't open display:
xterm:  DISPLAY is not set

   I tried using the display option for xterm and setting the
value as 0.0, that was not of much help.
   If someone can guide me as to where the DISPLAY parameter has
to be set to allow the remote machine to open the xterm window, it will be
of great help.

Thanks,
Krishna



-- 
In the middle of difficulty, lies opportunity


Re: [OMPI users] Tracing the library using gdb and xterm

2008-01-01 Thread Jeff Pummill

Krishna,

When you log in to the remote system, use ssh -X or ssh -Y which will 
export the xterm back thru the ssh connection.


Jeff Pummill
University of Arkansas


Krishna Chaitanya wrote:

Hi,
   I have been tracing the interactions between the PERUSE 
and MPI library,on one machine. I have been using gdb along with xterm 
to have two windows open at the same time as I step through the code. 
I wish to get a better glimpse of the working of the point to point 
calls, by launching the job on two machines and by tracing the flow in 
a similar manner. This is where I stand as of now :


mpirun --prefix /usr/local -hostfile machines  -np 2 xterm -e gdb 
peruse_ex1

xterm Xt error: Can't open display:
xterm:  DISPLAY is not set

   I tried using the display option for xterm and setting 
the value as 0.0, that was not of much help.
   If someone can guide me as to where the DISPLAY 
parameter has to be set to allow the remote machine to open the xterm 
window, it will be of great help.


Thanks,
Krishna
  



--
In the middle of difficulty, lies opportunity


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


Re: [OMPI users] Can't compile C++ program with extern "C" { #include mpi.h }

2008-01-01 Thread Brian Barrett

On Jan 1, 2008, at 12:47 AM, Adam C Powell IV wrote:


On Mon, 2007-12-31 at 20:01 -0700, Brian Barrett wrote:



Yeah, this is a complicated example, mostly because HDF5 should
really be covering this problem for you.  I think your only option at
that point would be to use the #define to not include the C++ code.

The problem is that the MPI standard *requires* mpi.h to include both
the C and C++ interface declarations if you're using C++.  There's no
way for the preprocessor to determine whether there's a currently
active extern "C" block, so there's really not much we can do.  Best
hope would be to get the HDF5 guys to properly protect their code
from C++...


Okay.  So in HDF5, since they call MPI from C, they're just using  
the C

interface, right?  So should they define OMPI_SKIP_MPICXX just in case
they're #included by C++ and using OpenMPI, or is there a more MPI
implementation-agnostic way to do it?



No, they should definitely not be disabling the C++bindings inside  
HDF5 -- that would be a situation worse than the current one.   
Consider the case where an application uses both HDF5 and the C++ MPI  
bindings.  It includes hdf5.h before mpi.h.  The hdf5.h includes  
mpi.h, without the C++ bindings.  The application then includes mpi.h,  
wanting the C++ bindings.  But the multiple inclusion protection in  
mpi.h means nothing happens, so no C++ bindings.


My comment about HDF5 was that it would be easiest if it protected its  
declarations with extern "C" when using C++.  This is what most  
packages that might be used with C++ do, and it works pretty well.   
I'd actually be surprised if modern versions of HDF5 didn't already do  
that.


Now that it's not New Years eve, I thought of what's probably the  
easiest solution for you.  Just include mpi.h (outside your extern "C"  
block) before hdf5.h.  The multiple inclusion protection in mpi.h will  
mean that the preprocessor removes everything from the mpi.h that's  
included from hdf5.h.  So the extern "C" around the hdf5.h shouldn't  
be too much of a problem.


Hope this helps,

Brian

--
  Brian Barrett
  Open MPI developer
  http://www.open-mpi.org/




Re: [OMPI users] Tracing the library using gdb and xterm

2008-01-01 Thread Doug Reeder

Krishna,

If you are using ssh to connect to the second machine you need to be  
sure that ssh X11 forwarding is enabled and you may need to have mpi  
use ssh -X or ssh -Y to connect to the second machine. That is how  
the DISPLAY gets set using ssh.


Doug Reeder

On Jan 1, 2008, at 8:11 AM, Krishna Chaitanya wrote:


Hi,
   I have been tracing the interactions between the  
PERUSE and MPI library,on one machine. I have been using gdb along  
with xterm to have two windows open at the same time as I step  
through the code. I wish to get a better glimpse of the working of  
the point to point calls, by launching the job on two machines and  
by tracing the flow in a similar manner. This is where I stand as  
of now :


mpirun --prefix /usr/local -hostfile machines  -np 2 xterm -e gdb  
peruse_ex1

xterm Xt error: Can't open display:
xterm:  DISPLAY is not set

   I tried using the display option for xterm and  
setting the value as 0.0, that was not of much help.
   If someone can guide me as to where the DISPLAY  
parameter has to be set to allow the remote machine to open the  
xterm window, it will be of great help.


Thanks,
Krishna



--
In the middle of difficulty, lies opportunity
___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users