Hello.

I'm using OpenMPI 3.1.3 on x64 CPU  and two ARMv8( Raspberry pi 3).

But i'm having some issues with data types that are architecture dependent, 
like 'long'.

For example, if you send data in one process to other on this way:

if (my_rank != 0) {
   long size;
   char* array_data;

   array_data = malloc(size);
   //Initialize data...

   /* Send size first*/
   MPI_Ssend(&size, 1, MPI_LONG,  0, 0, MPI_COMM_WORLD);

   /* Send data*/
   MPI_Ssend(array_data, size, MPI_BYTE,  0, 0, MPI_COMM_WORLD);

}else{
   char* data_of_procs[num_procs-1];
   long size_data_procs[num_procs-1];
   int i;
   for(i=0;i<num_procs-1;i++){
      /* Receive size*/
     MPI_Recv(&size_data_procs[i], 1, MPI_LONG, i+1, 0, MPI_COMM_WORLD, 
&status);
     data_of_procs[i] = malloc(size_data_procs[i]);
     if (data_of_procs[i] == NULL) perror("Error on malloc");
     MPI_Recv(data_of_procs[i], size_data_procs[i], MPI_BYTE, i+1, 0, 
MPI_COMM_WORLD, &status);
   }
}

Probably you get an error of malloc saying to you: "can't allocate this 
memory". This fail because long in x86 are 8bytes and in arm compiler is 
4bytes. For solve, instead of use long, you need to use int that have the same 
size in both architectures. Other option could be serialize long.

So my question is: there any way to pass data that don't depend of architecture?



_______________________________________________
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

Reply via email to