Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add MPI::Comm.Barrier method

  • Loading branch information...
commit 1e14cad8ef4fbfc270ff7aca0b2e2e016581b7e3 1 parent a8199c9
@seiya authored
Showing with 12 additions and 1 deletion.
  1. +8 −0 ext/mpi/mpi.c
  2. +4 −1 spec/ruby-mpi_spec.rb
View
8 ext/mpi/mpi.c
@@ -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);
View
5 spec/ruby-mpi_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.