



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Edgar Gabriel
Debugging MPI applications
COSC 6374 โ Parallel ComputationEdgar Gabriel
/* Method 1 to allocate a 2D matrix */ A = ( double *) malloc ( NROWS * sizeof ( double )); for ( i=0; i<NROWS; i++ ) { A[i] = (double) malloc (NCOLUMNSsizeof(double )); }
/* How to free a 2D matrix allocated with Method 1 */ for ( i=0; i<NROWS; i++ ) { free ( A[i] ); } free (A);
COSC 6374 โ Parallel ComputationEdgar Gabriel
/* Method 2 to allocate a 2D matrix / A = ( double ) malloc ( NROWS * sizeof ( double )); A[0] = (double) malloc (NROWSNCOLUMNSsizeof(double)); for ( i=1; i<NROWS; i++ ) { A[i] = &(A[0]+iNCOLUMNS); }
/* How to free a 2D matrix allocated with Method 2 */ free (A[0]); free (A);
COSC 6374 โ Parallel ComputationEdgar Gabriel
Method 1 A= 0x602010 A[0]= 0x &(A[0][0]) = 0x &(A[1][0]) = 0x &(A[2][0]) = 0x602a &(A[3][0]) = 0x602f Matrix A has been freed Method 2 A = 0x602010 A[0] = 0x &(A[0][0]) = 0x &(A[1][0]) = 0x &(A[2][0]) = 0x602a &(A[3][0]) = 0x602f Matrix A has freed Static matrix B = 0x7fff8ade7b00 B[0] = 0x7fff8ade7b &(B[0][0]) = 0x7fff8ade7b &(B[1][0]) = 0x7fff8ade &(B[2][0]) = 0x7fff8ade &(B[3][0]) = 0x7fff8ade8a
COSC 6374 โ Parallel ComputationEdgar Gabriel
COSC 6374 โ Parallel ComputationEdgar Gabriel
Start
Load application into the debugger
Debugger points to the problem
Show the value of a variable when the problem occurred
Show source code of app.
COSC 6374 โ Parallel ComputationEdgar Gabriel
(gdb) next (skips subroutines/functions) (gdb) step (enters subroutines/functions)
(gdb) cont
COSC 6374 โ Parallel ComputationEdgar Gabriel
COSC 6374 โ Parallel ComputationEdgar Gabriel
COSC 6374 โ Parallel ComputationEdgar Gabriel
mpirun โnp 2 ddd ./colltest