Hi,<br> I am using MPI_Comm_spawn_multiple for dynamic process creation and passing different arguments to each process through this function, but the code runs perfectly fine for some inputs and throws SEGFAULT for some other inputs the code sample is <br>
<br><br>/*Arguments generation starts*/<br>char ***procs_argv = procs_argv = (char ***) malloc(sizeof(char **) * no_processes_to_launch);<br><br> for(i=0; i < no_processes_to_launch; i++)<br> {<br> procs_argv[i] = ( char **)malloc(sizeof(char *) * 2);<br>
procs_argv[i][0] = ( char *) malloc(sizeof(char)*4);<br> procs_argv[i][1] = ( char *) malloc(sizeof(char)*10);<br> sprintf(procs_argv[i][0], "%d", ppstat_ptr[i].no_of_pivots); //Total no. of pivot variables<br>
sprintf(procs_argv[i][1], "%d", all_sizes_elems_fep[i+1]);//Total bytes of all sizes data.<br> }<br><br>/*Arguments generation finish*/<br> and process is launched as -- MPI_Comm_spawn_multiple(no_processes_to_launch, cmds, procs_argv, nprocs, infos, 0, MPI_COMM_WORLD, &worker_comm, errcodes);<br>
<br>Error given when debugged through gdb :<br><br>in _IO_vfprintf_internal (s=<value optimized out>, format=<value optimized out>, ap=<value optimized out>) at vfprintf.c : 1603 , process_string_arg(((struct printf_spec *)NULL));<br>
<br><br><br><br clear="all"><br>-- <br><br>Regards,<br>-- Mahesh Doijade<br><br><br>
<br>