ultiplicación de matriz @MPI con asignación dinámica: Seg. Culp

Estoy haciendo un programa de multiplicación de matriz en OpenMPI, y recibí este mensaje de error:

[Mecha Liberta:12337] *** Process received signal ***
[Mecha Liberta:12337] Signal: Segmentation fault (11)
[Mecha Liberta:12337] Signal code: Address not mapped (1)
[Mecha Liberta:12337] Failing at address: 0xbfe4f000
--------------------------------------------------------------------------
mpirun noticed that process rank 1 with PID 12337 on node Mecha Liberta exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------

Así es como yo defino las matrices:

  int **a, **b, **r;

  a = (int **)calloc(l,sizeof(int));

  b = (int **)calloc(l,sizeof(int));

  r = (int **)calloc(l,sizeof(int));

  for (i = 0; i < l; i++)
      a[i] = (int *)calloc(c,sizeof(int));

  for (i = 0; i < l; i++)
      b[i] = (int *)calloc(c,sizeof(int));      

   for (i = 0; i < l; i++)
      r[i] = (int *)calloc(c,sizeof(int)); 

Y aquí está mi Enviar / Recv (estoy bastante seguro de que mi problema debería estar aquí):

  MPI_Send(&sent, 1, MPI_INT, dest, tag, MPI_COMM_WORLD); 
  MPI_Send(&lines, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);   
  MPI_Send(&(a[sent][0]), lines*NCA, MPI_INT, dest, tag, MPI_COMM_WORLD); 
  MPI_Send(&b, NCA*NCB, MPI_INT, dest, tag, MPI_COMM_WORLD);

y

MPI_Recv(&sent, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);  
MPI_Recv(&lines, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
MPI_Recv(&a, lines*NCA, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
MPI_Recv(&b, NCA*NCB, MPI_INT, 0, tag, MPI_COMM_WORLD, &status); 

¿Alguien puede ver dónde está el problema?

Respuestas a la pregunta(1)

Su respuesta a la pregunta