My program gives signal 11 at some odd place.
Here is my code.
if(myself.MC!=1)
{
fitness[ic]=servant(Templ,rbuf,nfgs,
Arr_subs,pid, &myself,outputfile,
Ran_seed,fit_nrg);
ic++;
for(j=0;j<4;j++,ic++)
fitness[ic]=Ran_seed[j];
MPI_Gather(fitness,myself.ntmpl_sub+5, MPI_FLOAT,fitness_arr,
myself.ntmpl_sub+5,MPI_FLOAT,0,MPI_COMM_WORLD);
}
MPI_Barrier(MPI_COMM_WORLD);
if((pid==0)&&(igen <myself.ngen))
{
int curr_chrom;
k=igen*myself.nchrom;
cout<<"K: "<<k <<endl;
for(i=0;i<myself.nchrom*(myself.ntmpl_sub+1);i++)
{
cout<<"Chrom: ";
----------------------
}
}
My program prints "K: somevalue" then dies giving signal 11. My
question is there is no function or no arrays in between these two
print statements. Is it possible to have segmentation fault even
before the first print statement and the signal appears after the
first print statement. I am so confused. I am stuck with this for more
than a week. Can anyone help me in this.
Any help in this regard will be highly appreciated.
Thanks in advance.
|