Parallel programming using OpenMPI : Program not running -


so pretty new paradigm of parallel programming. trying send across indexed matrix root process (rank = 0) slave process (rank = 1). using following commands run :

  • mpicc q_9.c -o q_9
  • mpirun -np 2 ./q_9

the program compiles successfully, doesn't run whatsoever. have feeling mpi_send() , mpi_recv() routines aren't correctly synchronized. kind of go long way. below code :

#include <stdio.h> #include <stdlib.h> #include "mpi.h"  int main(int argc, char *argv[]) {     int curr_rank;     int num_process;     int i;     int j;        int in_matrix[4][4];     int out_matrix[4][4];     int num_rows = 4;     int num_cols = 4;     int displacement_array[4];     int block_length[4];      mpi_datatype new_index_t;     mpi_status status;      mpi_init(&argc, &argv);     mpi_comm_size(mpi_comm_world, &num_process);     mpi_comm_rank(mpi_comm_world, &curr_rank);       if(num_process == 2){         if(curr_rank == 0){ /*root process populates matrix*/             /*initialize matrix*/             for(i = 0 ; < num_rows ; i++){                 for(j = 0 ; j < num_cols ; j++){                 in_matrix[i][j] = + j;                 }             }         }          for(i = 0 ; < num_rows ; i++){             displacement_array[i] = (num_rows * i) + num_rows;             block_length[i] = (num_rows - i);         }          mpi_type_indexed(num_rows, block_length, displacement_array, mpi_int, &new_index_t);         mpi_type_commit(&new_index_t);          if(curr_rank == 0){             mpi_send(in_matrix, 1, new_index_t, 1, 0, mpi_comm_world);         }         else{             for(i = 0 ; < num_rows ; i++){                 for(j = 0 ; j < num_cols ; j++){                     out_matrix[i][j] = 0;                 }             }              mpi_recv(out_matrix, 1, new_index_t, 0, 0, mpi_comm_world, &status);              /*indexed output matrix*/             for(i = 0 ; < num_rows ; i++){                 for(j = 0 ; j < num_cols ; j++){                     printf("%d ", out_matrix[i][j]);                 }                 printf("\n");             }          }     }    mpi_finalize(); } 

edits:

i run on different system , message : mpirun has exited due process rank 0 pid 10449 on node abhijeet-mohanty-2 exiting improperly. there 3 reasons occur:

  1. this process did not call "init" before exiting, others in job did. can cause job hang indefinitely while waits processes call "init". rule, if 1 process calls "init", processes must call "init" prior termination.

  2. this process called "init", exited without calling "finalize". rule, processes call "init" must call "finalize" prior exiting or considered "abnormal termination"

  3. this process called "mpi_abort" or "orte_abort" , mca parameter orte_create_session_dirs set false. in case, run-time cannot detect abort call abnormal termination. hence, error message receive one.

this may have caused other processes in application terminated signals sent mpirun (as reported here).


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -