Quantcast
Channel: Clusters and HPC Technology
Viewing all articles
Browse latest Browse all 927

Problem: Sending more than two process

$
0
0

Hi,

I have faced with a problem when my program try to send structure data more than two process. I created data structure mpi_docking_t as below 

typedef struct s_docking{
	char receptor[MAX_FILE_NAME];
	char compound[MAX_FILE_NAME];
}docking_t;

/*************  mpi_docking_t ***************************/
  const int nitems_dock=2;
  int blocklengths_dock[nitems_dock] = {MAX_PATH, MAX_PATH};
  MPI_Datatype types_dock[nitems_dock] = {MPI_CHAR, MPI_CHAR};
  MPI_Aint offsets_dock[nitems_dock];

  offsets_dock[0] = offsetof(docking_t, receptor);
  offsets_dock[1] = offsetof(docking_t, compound);

  MPI_Type_create_struct(nitems_dock, blocklengths_dock, offsets_dock, types_dock, &mpi_docking_t);
  MPI_Type_commit(&mpi_docking_t);
/*************  mpi_docking_t end ***************************/

i tried to send data based on this code:

  //Preparing buffer to be sent
  docking_t  *buff = NULL;
  int buffer_dock;
  buffer_dock = sizeof(docking_t)*number_dock*MPI_BSEND_OVERHEAD;
  buff = (docking_t *) malloc(buffer_dock);

    f_dock = open_file(argv[2], fREAD);
    //Ignoring first line of file
    fgets(line, MAX_LINE_FILE, f_dock);
    //Obtaining docking that will be executed in root
    for (num_line_ref = 0; num_line_ref < number_dock_root; num_line_ref++){
      fgets(line, MAX_LINE_FILE, f_dock);
      set_receptor_compound(docking_root[num_line_ref].receptor, docking_root[num_line_ref].compound, line);
    }
    MPI_Buffer_attach(buff, buffer_dock);
    num_line_ref = -1;
    dest = 1;
    while (fgets(line, MAX_LINE_FILE, f_dock) != NULL){
      if (num_line_ref < number_dock){
        num_line_ref = num_line_ref + 1;
      }else{
        MPI_Isend(v_docking, number_dock, mpi_docking_t, dest, tag_docking, MPI_COMM_WORLD, &request_dock);
        dest = dest + 1;
        num_line_ref = 0;
      }
      set_receptor_compound(v_docking[num_line_ref].receptor, v_docking[num_line_ref].compound, line);
    }
    //Sending to last rank because MPI_Send inside while command is not executed for the last rank
    MPI_Isend(v_docking, number_dock, mpi_docking_t, dest, tag_docking, MPI_COMM_WORLD, &request_dock);
    fclose(f_dock);

My receid code is:

    MPI_Irecv(v_docking, number_dock, mpi_docking_t, root,tag_docking, MPI_COMM_WORLD, &request_dock);
    MPI_Wait(&request_dock, &status);

When I execute my program using line below, it works fine. 

faccioli@faccioli:~/Execute/MPI$ mpirun -np 2 /home/faccioli/workspace/drugdesign/virtualscreening/build/./vs_main config.conf overall_docking_list.txt
faccioli@faccioli:~/Execute/MPI$ 

However, when I increase the process number (-np > 2) I receive a memory error. I looked at internet and the book Using MPI by William Gropp, but no success to indentify a solution. I understood that I have to create a MPI derived data type. I couldn't understand how I do it.

My project is [1]. My main file is virtual_screening/src/vs_main.c.

I appreciate any help.

Thanks in advance.

[1] https://github.com/rodrigofaccioli/drugdesign

Fichier attachéTaille
Téléchargervs_main.c6.48 Ko

Viewing all articles
Browse latest Browse all 927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>