Permalink
Browse files

add MPI::Comm.Barrier method

  • Loading branch information...
1 parent a8199c9 commit 1e14cad8ef4fbfc270ff7aca0b2e2e016581b7e3 @seiya committed Apr 21, 2011
Showing with 12 additions and 1 deletion.
  1. +8 −0 ext/mpi/mpi.c
  2. +4 −1 spec/ruby-mpi_spec.rb
View
@@ -522,6 +522,13 @@ rb_comm_set_Errhandler(VALUE self, VALUE rb_errhandler)
MPI_Comm_set_errhandler(comm->comm, errhandler->errhandler);
return self;
}
+static VALUE
+rb_comm_barrier(VALUE self)
+{
+ struct _Comm *comm;
+ Data_Get_Struct(self, struct _Comm, comm);
+ check_error(MPI_Barrier(comm->comm));
+}
// MPI::Request
static VALUE
@@ -603,6 +610,7 @@ void Init_mpi()
rb_define_method(cComm, "Allreduce", rb_comm_allreduce, 3);
rb_define_method(cComm, "Errhandler", rb_comm_get_Errhandler, 0);
rb_define_method(cComm, "Errhandler=", rb_comm_set_Errhandler, 1);
+ rb_define_method(cComm, "Barrier", rb_comm_barrier, 0);
// MPI::Request
cRequest = rb_define_class_under(mMPI, "Request", rb_cObject);
@@ -200,7 +200,10 @@
recvbuf.should == ary
end
-
+ it "should not raise exception in calling barrier" do
+ world = MPI::Comm::WORLD
+ world.Barrier
+ end
it "shoud raise exeption" do

0 comments on commit 1e14cad

Please sign in to comment.