#include "private.h"
#include "xbt.h"
-
//TODO : remove all this.
static xbt_dict_t comm_lookup = nullptr;
static xbt_dict_t group_lookup = nullptr;
return smpi_f2c<type>(id, name##_lookup);\
}
+extern "C" { // This should really use the C linkage to be usable from Fortran
+
SMPI_F2C_C2F(MPI_Comm, comm)
SMPI_F2C_C2F(MPI_Group, group)
SMPI_F2C_C2F(MPI_Request, request)
*ierr= MPI_File_write(reinterpret_cast<MPI_File>(*fh), buf, *count, smpi_type_f2c(*datatype), status);
}
+} // extern "C"
/* MPI User level calls */
+extern "C" { // Obviously, the C MPI interface should use the C linkage
WRAPPED_PMPI_CALL(double, MPI_Wtick,(void),())
WRAPPED_PMPI_CALL(double, MPI_Wtime,(void),())
UNIMPLEMENTED_WRAPPED_PMPI_CALL(MPI_Errhandler, MPI_Errhandler_f2c,(MPI_Fint errhandler),(errhandler))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(MPI_Fint, MPI_Errhandler_c2f,(MPI_Errhandler errhandler),(errhandler))
+} // extern "C"
}
/* PMPI User level calls */
+extern "C" { // Obviously, the C MPI interface should use the C linkage
int PMPI_Init(int *argc, char ***argv)
{
return MPI_SUCCESS;
}
+} // extern "C"
#define SIZE 4
int main(int argc, char **argv) {
- int rank, i, j;
+ int rank;
double a[SIZE][SIZE] = {{0}};
MPI_Datatype columntype;
MPI_Type_commit(&columntype);
if (rank == 0) {
- for(i=0; i <SIZE;i++)
- for(j=0; j <SIZE;j++)
+ for (int i = 0; i < SIZE; i++)
+ for (int j = 0; j < SIZE; j++)
a[i][j] = i*SIZE+j;
}
/* only one column is send this is an exemple for non-contignous data*/
MPI_Bcast(a, 1, columntype, 0, MPI_COMM_WORLD);
- for(i=0; i<SIZE; i++){
- for (j=0; j < SIZE; j++) {
+ for (int i = 0; i < SIZE; i++) {
+ for (int j = 0; j < SIZE; j++) {
printf("rank= %d, a[%d][%d]=%f\n", rank, i, j, a[i][j]);
}
printf("\n");