Hi Jaroslav,
I have built correctly this cc file
#include <mpi.h>
#include <octave/oct.h>

class octave_comm : public octave_base_value
{
public:

  octave_comm (const std::string _name = "", MPI_Comm _comm = MPI_COMM_WORLD )
    : octave_base_value (), name (_name)
    {
     MPI_Comm_set_name(_comm, const_cast<char*>(name.c_str())); 
    }

  void print (std::ostream& os, bool pr_as_read_syntax = false) const
    {
      os << name << std::endl;
    }
  bool is_defined (void) const { return true; }
  

private:
  const std::string name;
  DECLARE_OCTAVE_ALLOCATOR
  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
};

DEFINE_OCTAVE_ALLOCATOR (octave_comm);
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_comm, "octave_comm", "octave_comm");

static bool octave_comm_type_loaded = false;

DEFUN_DLD(octave_comm, args, ,"")
{
  if (!octave_comm_type_loaded)
    {
      octave_comm::register_type ();
      octave_comm_type_loaded = true;
      mlock ();
    }

  octave_value retval;
  if (args.length () != 1 || !args (0).is_string ())
    {
      error ("octave_comm: first argument must be a string");
      return retval;
    }
   
  const std::string name = args (0).string_value ();
// For Default MPI_COMM_WORLD
  MPI_Comm CW;
  octave_comm *b=new octave_comm("",CW);
// For Custom Comunicator
  MPI_Comm CCom;
  octave_comm *c = new octave_comm("customcom",CCom);
  return retval;
}

Now I would like to access the public property _comm .. of the octave_comm 
class, just from C++ code.
Could you please give me a hint?
Thanks a lot
Riccardo

--- Mar 24/11/09, Michael Creel <michael.cr...@uab.es> ha scritto:

Da: Michael Creel <michael.cr...@uab.es>
Oggetto: Re: Monte Carlo example for new MPI bindings
A: "Jaroslav Hajek" <high...@gmail.com>
Cc: "Riccardo Corradini" <riccardocorrad...@yahoo.it>, "octave-forge list" 
<octave-dev@lists.sourceforge.net>
Data: Martedì 24 novembre 2009, 10:36



On Mon, Nov 23, 2009 at 2:31 PM, Jaroslav Hajek <high...@gmail.com> wrote:



Hi Riccardo and Michael,

I have already implemented basic support for the communicators in the SVN tree.
The relevant functions now accept comm as their last argument, defaulting to 
MPI_COMM_WORLD if not provided.



MPI_COMM_WORLD is a new function.

Note 1: The implementation imposes the requirement that MPI_Comm is a typedef 
for signed 32-bit or 64-bit integer (int, long, or long long) which is true in 
all major MPI implementations with the notable exception of OpenMPI. OpenMPI 
uses raw pointers, which make things a bit difficult. One option is to simply 
typecast the pointers to integers; but I feel a bit uneasy about working with 
raw pointers in Octave, so I'm thinking about a solution providing some 
validation as well.


I would, however, like to avoid creating a user type for each of MPI's types.

Note 2: 
There are no functions for creating new communicators yet.



Hi all,
A check out this morning is not compiling for me:


mich...@yosemite:~/Desktop/openmpi_ext/src$ make all
mkoctfile -c -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi 
comm-util.cc
comm-util.cc: In function ‘ompi_communicator_t* do_get(const octave_value&) 
[with T = int]’:

comm-util.cc:39: error: invalid conversion from ‘int’ to ‘ompi_communicator_t*’
comm-util.cc: At global scope:
comm-util.cc:34: error: explicit template specialization cannot have a storage 
class
comm-util.cc: In function ‘ompi_communicator_t* do_get(const octave_value&) 
[with T = long int]’:

comm-util.cc:51: error: invalid conversion from ‘long int’ to 
‘ompi_communicator_t*’
comm-util.cc: At global scope:
comm-util.cc:46: error: explicit template specialization cannot have a storage 
class
comm-util.cc:72: error: explicit template specialization cannot have a storage 
class

comm-util.cc:78: error: explicit template specialization cannot have a storage 
class
make: *** [comm-util.o] Error 1
mich...@yosemite:~/Desktop/openmpi_ext/src$

Is that expected at the moment?

Cheers, Michael






      
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to