#include "private.hpp"
#include "smpi_comm.hpp"
#include "smpi_datatype.hpp"
+#include "smpi_errhandler.hpp"
#include "smpi_op.hpp"
#include "smpi_request.hpp"
#include "smpi_win.hpp"
MPI_REAL4->add_f();//MPI_REAL4
MPI_REAL8->add_f();//MPI_REAL8
MPI_DOUBLE->add_f();//MPI_DOUBLE_PRECISION
- MPI_C_FLOAT_COMPLEX->add_f();//MPI_COMPLEX
- MPI_C_DOUBLE_COMPLEX->add_f();//MPI_DOUBLE_COMPLEX
+ MPI_COMPLEX8->add_f();//MPI_COMPLEX
+ MPI_COMPLEX16->add_f();//MPI_DOUBLE_COMPLEX
#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
MPI_2INT->add_f();//MPI_2INTEGER
#else
MPI_AINT->add_f();//MPI_COUNT
MPI_REAL16->add_f();//MPI_REAL16
MPI_PACKED->add_f();//MPI_PACKED
+ MPI_COMPLEX8->add_f();//MPI_COMPLEX8
+ MPI_COMPLEX16->add_f();//MPI_COMPLEX16
+ MPI_COMPLEX32->add_f();//MPI_COMPLEX32
MPI_MAX->add_f();
MPI_MIN->add_f();
MPI_BAND->add_f();
MPI_BOR->add_f();
MPI_BXOR->add_f();
+
+ MPI_ERRORS_RETURN->add_f();
+ MPI_ERRORS_ARE_FATAL->add_f();
}
}
*ierr = MPI_Group_incl(simgrid::smpi::Group::f2c(*group), *n, ranks, &tmp);
if(*ierr == MPI_SUCCESS) {
- *group_out = tmp->add_f();
+ *group_out = tmp->c2f();
}
}
}
void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){
+ //fortran does not handle string endings cleanly, so initialize everything before
+ memset(name, 0, MPI_MAX_PROCESSOR_NAME);
*ierr = MPI_Get_processor_name(name, resultlen);
}
*ierr = MPI_Win_flush_local_all(simgrid::smpi::Win::f2c(*win));
}
-void mpi_win_null_copy_fn_( int* win, int* keyval, int* extrastate, MPI_Aint* valin, MPI_Aint* valout,
- int* flag, int* ierr ){
+void mpi_win_null_copy_fn_(int* /*win*/, int* /*keyval*/, int* /*extrastate*/, MPI_Aint* /*valin*/,
+ MPI_Aint* /*valout*/, int* flag, int* ierr)
+{
*flag=0;
*ierr=MPI_SUCCESS;
}
-void mpi_win_dup_fn_( int* win, int* keyval, int* extrastate, MPI_Aint* valin, MPI_Aint* valout,
- int* flag, int* ierr ){
+void mpi_win_dup_fn_(int* /*win*/, int* /*keyval*/, int* /*extrastate*/, MPI_Aint* valin, MPI_Aint* valout, int* flag,
+ int* ierr)
+{
*flag=1;
*valout=*valin;
*ierr=MPI_SUCCESS;
}
void mpi_group_free_ (int* group, int* ierr){
- MPI_Group tmp = simgrid::smpi::Group::f2c(*group);
- *ierr = MPI_Group_free(&tmp);
- if(*ierr == MPI_SUCCESS) {
- simgrid::smpi::F2C::free_f(*group);
- }
+ MPI_Group tmp = simgrid::smpi::Group::f2c(*group);
+ if(tmp != MPI_COMM_WORLD->group() && tmp != MPI_GROUP_EMPTY){
+ simgrid::smpi::Group::unref(tmp);
+ simgrid::smpi::F2C::free_f(*group);
+ }
+ *ierr = MPI_SUCCESS;
}
void mpi_group_size_ (int* group, int *size, int* ierr){
*ierr = MPI_Error_class(*errorcode, errorclass);
}
-void mpi_errhandler_create_ (void* function, void* errhandler, int* ierr) {
- *ierr = MPI_Errhandler_create(reinterpret_cast<MPI_Handler_function*>(function), static_cast<MPI_Errhandler*>(errhandler));
+void mpi_errhandler_create_ (void* function, int* errhandler, int* ierr) {
+ MPI_Errhandler tmp;
+ *ierr = MPI_Errhandler_create( reinterpret_cast<MPI_Handler_function*>(function), &tmp);
+ if(*ierr==MPI_SUCCESS){
+ *errhandler = tmp->c2f();
+ }
}
-void mpi_errhandler_free_ (void* errhandler, int* ierr) {
- *ierr = MPI_Errhandler_free(static_cast<MPI_Errhandler*>(errhandler));
+void mpi_errhandler_free_ (int* errhandler, int* ierr) {
+ MPI_Errhandler tmp = simgrid::smpi::Errhandler::f2c(*errhandler);
+ *ierr = MPI_Errhandler_free(&tmp);
+ if(*ierr == MPI_SUCCESS) {
+ simgrid::smpi::F2C::free_f(*errhandler);
+ }
}
-void mpi_errhandler_get_ (int* comm, void* errhandler, int* ierr) {
- *ierr = MPI_Errhandler_get(simgrid::smpi::Comm::f2c(*comm), static_cast<MPI_Errhandler*>(errhandler));
+void mpi_errhandler_get_ (int* comm, int* errhandler, int* ierr) {
+ MPI_Errhandler tmp;
+ *ierr = MPI_Errhandler_get(simgrid::smpi::Comm::f2c(*comm), &tmp);
+ if(*ierr == MPI_SUCCESS) {
+ *errhandler = tmp->c2f();
+ }
}
-void mpi_errhandler_set_ (int* comm, void* errhandler, int* ierr) {
- *ierr = MPI_Errhandler_set(simgrid::smpi::Comm::f2c(*comm), *static_cast<MPI_Errhandler*>(errhandler));
+void mpi_errhandler_set_ (int* comm, int* errhandler, int* ierr) {
+ *ierr = MPI_Errhandler_set(simgrid::smpi::Comm::f2c(*comm), simgrid::smpi::Errhandler::f2c(*errhandler));
}
void mpi_cancel_ (int* request, int* ierr) {
}
void mpi_publish_name_ ( char *service_name, int* info, char *port_name, int* ierr){
- *ierr = MPI_Publish_name( service_name, *reinterpret_cast<MPI_Info*>(info), port_name);
+ *ierr = MPI_Publish_name( service_name, simgrid::smpi::Info::f2c(*info), port_name);
}
void mpi_unpublish_name_ ( char *service_name, int* info, char *port_name, int* ierr){
- *ierr = MPI_Unpublish_name( service_name, *reinterpret_cast<MPI_Info*>(info), port_name);
+ *ierr = MPI_Unpublish_name( service_name, simgrid::smpi::Info::f2c(*info), port_name);
}
void mpi_lookup_name_ ( char *service_name, int* info, char *port_name, int* ierr){
- *ierr = MPI_Lookup_name( service_name, *reinterpret_cast<MPI_Info*>(info), port_name);
+ *ierr = MPI_Lookup_name( service_name, simgrid::smpi::Info::f2c(*info), port_name);
}
void mpi_open_port_ ( int* info, char *port_name, int* ierr){
- *ierr = MPI_Open_port( *reinterpret_cast<MPI_Info*>(info),port_name);
+ *ierr = MPI_Open_port( simgrid::smpi::Info::f2c(*info),port_name);
}
void mpi_close_port_ ( char *port_name, int* ierr){