[mpich-discuss] help me rectify this mpi error please

Pavan Balaji balaji at mcs.anl.gov
Sun Oct 30 10:18:57 CDT 2011


It looks like your application exited with a segmentation fault. Trying 
running it using a debugger such as "ddd" or "gdb".

% mpiexec -np 2 ddd ./application

or

% mpiexec -np 2 xterm -e gdb ./application

  -- Pavan

On 10/30/2011 03:22 AM, Mohammad Zulqurnain wrote:
> i am unable to detect an error in this code can someone please help me
> with this:
> Following error is encountered when i execute this code:
> =====================================================================================
> = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
> = EXIT CODE: 11
> = CLEANING UP REMAINING PROCESSES
> = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
> ====================================================
> =================================
> APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11)
>
>
> code:
> long fitness(
> /* The chromosome to be judged */
> chromosome_t* c,
> /* Historic prices */
> unsigned int* h
> )
> {
> int rank = MPI::COMM_WORLD.Get_rank();
> int size = MPI::COMM_WORLD.Get_size();
> long total_price = 0;
> long avg_price;
> long price;
> long shares = 0;
> long cash = 0;
> unsigned int t;
> MPI_Status status;
> /*we apply parallelism here*/
> if(rank!=0)
> {
> for(int t=((rank-1)*(HISTORY_LENGTH/size)); t<((rank)*(
> HISTORY_LENGTH/size)); t++)
> {
> price = h[t];
> total_price += price;
> avg_price = total_price / (t + 1);
>
> /* Make price relative to average */
> price -= avg_price;
>
> /* Convert price to percentage value */
> price = price * 100 / avg_price;
>
> if(-price >= (long)Gray_to_bin(c->buy_price))
> {
> /* Buy another share */
> ++shares;
> cash -= (long)h[t];
> }
> else if(price >= (long)Gray_to_bin(c->sell_price))
> {
> /* Sell another share */
> --shares;
> < font class="Apple-style-span" face="Tahoma" size="2"> cash += (long)h[t];
> }
> }
> /* Cash out of holdings at the end for comparisons */
> cash += shares * (long)h[t-1];
> printf("processor %d gave cash= %d .\n",rank,cash);
> //sendCash(0, 0,0,cash);
> MPI_Send(&cash,1,MPI_LONG,0,0, MPI_COMM_WORLD);
>
> }
> //MPI_Barrier(MPI_COMM_WORLD);
> if(rank==0)
> {
>
> long recieved_cash;
> for(int i=1; i<size; i++)
> {
>
> long cas h_recieved;
> //cash+=recieveCash(i, 0,0,recieved_cash);
> MPI_Recv(&cash_recieved,1, MPI_LONG,i, 0, MPI_COMM_WORLD, &status);
> cash+=cash_recieved;
> printf("master processor is taking cash from the slave processor %d ",i);
>
> }
> MPI_Barrier(MPI_COMM_WORLD);
> }
>
>
>
> // MPI_Barrier(MPI_COMM_WORLD);
> return cash;
> }
>
>
> _______________________________________________
> mpich-discuss mailing list     mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss

-- 
Pavan Balaji
http://www.mcs.anl.gov/~balaji


More information about the mpich-discuss mailing list