Changeset 5713 in /cluster/svnroot


Ignore:
Timestamp:
May 26, 2016 9:06:37 PM (5 years ago)
Author:
skylar
Message:

this segfaults

Location:
bccd-ng/bw-institute/2016/day06/matmul
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bccd-ng/bw-institute/2016/day06/matmul/matmul.c

    r5712 r5713  
    144144            fprintf(stderr,"Calculating (%d,%d)\n",dst_row,dst_col);
    145145#endif
    146             // Assign destination coordinates based on the start row offset
     146            /* Assign destination coordinates based on the start row offset
     147             * For serial/OpenMP, this has no effect since the full destination
     148             * matrix will be used
     149             * For MPI, a smaller, local destination matrix will be used and the
     150             * indexes must start at 0 regardless of how far into the destination matrix
     151             * we are
     152            */
    147153            dst_coord = coord(dst_m,(dst_row-start_dst_row),dst_col);
    148154            // Make sure destination matrix is initialized
  • bccd-ng/bw-institute/2016/day06/matmul/mpi.c

    r5712 r5713  
    1212    unsigned int start_row,stop_row,stride;
    1313    bool print;
    14     struct matrix m1,m2,local_dst_m;
     14    struct matrix m1,m2,local_dst_m,dst_m;
    1515
    1616    MPI_Init(&argc,&argv);
     
    7474        init_matrix(&m2,random_seeds);
    7575
    76         // Declare and allocate full destination matrix
     76        // Allocate full destination matrix on first rank
    7777        // Will be populated via MPI_Gather
    78         struct matrix dst_m;
    7978        dst_m.rows = m1.rows;
    8079        dst_m.cols = m2.cols;
     
    135134#endif
    136135
     136    MPI_Gather(
     137            &local_dst_m.matrix,
     138            (local_dst_m.cols*local_dst_m.rows),
     139            MPI_INT,
     140            &dst_m.matrix,
     141            (dst_m.cols*dst_m.rows),
     142            MPI_INT,
     143            FIRST_RANK,
     144            MPI_COMM_WORLD
     145            );
     146
    137147    MPI_Finalize();
    138148
Note: See TracChangeset for help on using the changeset viewer.