58 #define __FUNC__ "ExternalRows_dhCreate"
70 SET_V_ERROR (
"MAX_MPI_TASKS is too small; change, then recompile!");
97 #define __FUNC__ "ExternalRows_dhDestroy"
170 #define __FUNC__ "ExternalRows_dhInit"
183 #define __FUNC__ "ExternalRows_dhGetRow"
186 int *len,
int **cval,
int **fill,
REAL_DH ** aval)
225 #define __FUNC__ "ExternalRows_dhRecvRows"
273 #define __FUNC__ "rcv_ext_storage_private"
288 for (i = 0; i < loCount; ++i)
290 int nabor = loNabors[i];
302 "\nEXR rcv_ext_storage_private:: <nabor,rowCount,nzCount>\nEXR ");
303 for (i = 0; i < loCount; ++i)
305 fprintf (
logFile,
"<%i,%i,%i> ", loNabors[i], rcv_row_counts[i],
311 for (i = 0; i < loCount; ++i)
313 int nz = rcv_nz_counts[i];
314 int nabor = loNabors[i];
315 lengths[i] = (
int *)
MALLOC_DH (nz *
sizeof (
int));
317 numbers[i] = (
int *)
MALLOC_DH (nz *
sizeof (
int));
330 for (i = 0; i < loCount; ++i)
333 "\nEXR rows <number,length> to be received from P_%i\nEXR ",
335 nz = rcv_row_counts[i];
336 for (j = 0; j < nz; ++j)
337 fprintf (
logFile,
"<%i,%i> ", numbers[i][j], lengths[i][j]);
346 #define __FUNC__ "allocate_ext_row_storage_private"
355 for (i = 0; i < loCount; ++i)
356 nz += rcv_nz_counts[i];
368 #define __FUNC__ "build_hash_table_private"
373 int i, j, offset, rowCt = 0;
383 for (i = 0; i < loCount; ++i)
384 rowCt += rcv_row_counts[i];
393 for (i = 0; i < loCount; ++i)
397 int rowCount = rcv_row_counts[i];
400 for (j = 0; j < rowCount; ++j)
404 int row = rcv_row_numbers[i][j];
405 int rowLength = rcv_row_lengths[i][j];
406 record.
iData = rowLength;
407 record.
iDataPtr = extRowCval + offset;
409 record.
fDataPtr = extRowAval + offset;
418 #define __FUNC__ "rcv_external_rows_private"
424 int nabor, nz = 0, offset = 0;
426 double *extRowAval = er->
avalExt;
430 for (i = 0; i < loCount; ++i)
433 nz = rcv_nz_counts[i];
438 MPI_Irecv (extRowAval + offset, nz, MPI_DOUBLE, nabor,
AVAL_TAG,
451 #define __FUNC__ "print_received_rows_private"
456 int i, j, k, rwCt, idx = 0, nabor;
461 "\nEXR ================= received rows, printed from buffers ==============\n");
464 for (i = 0; i < loCount; ++i)
468 fprintf (
logFile,
"\nEXR Rows received from P_%i:\n", nabor);
471 for (j = 0; j < rwCt; ++j)
475 fprintf (
logFile,
"EXR %i :: ", 1 + rowNum);
476 for (k = 0; k < rowLen; ++k)
495 "\nEXR =============== received rows, printed from hash table =============\n");
496 for (i = 0; i < n; ++i)
498 int len, *cval, *fill;
504 fprintf (
logFile,
"EXR %i :: ", i + 1);
505 for (j = 0; j < len; ++j)
509 fprintf (
logFile,
"%i,%i ; ", cval[j], fill[j]);
513 fprintf (
logFile,
"%i,%i,%g ; ", cval[j], fill[j], aval[j]);
531 #define __FUNC__ "ExternalRows_dhSendRows"
554 #define __FUNC__ "send_ext_storage_private"
559 int *nzCounts, *nzNumbers;
561 int *rp = er->
F->
rp, *diag = er->
F->
diag;
575 (
int *)
MALLOC_DH (rowCount *
sizeof (
int));
580 for (i = first_bdry, j = 0; i < m; ++i, ++j)
582 int tmp = (rp[i + 1] - diag[i]);
590 fprintf (
logFile,
"EXR send_ext_storage_private:: rowCount = %i\n",
592 fprintf (
logFile,
"EXR send_ext_storage_private:: nz Count = %i\n", nz);
596 for (i = 0; i < hiCount; ++i)
598 int nabor = hiNabors[i];
605 for (i = 0, j = first_bdry; j < m; ++i, ++j)
607 nzNumbers[i] = j + beg_row;
615 for (i = 0; i < hiCount; ++i)
617 int nabor = hiNabors[i];
628 #define __FUNC__ "send_external_rows_private"
634 int offset, nz = er->
nzSend;
639 int *rp = er->
F->
rp, *diag = er->
F->
diag;
657 for (i = first_bdry, j = 0; i < m; ++i, ++j)
659 int tmp = (rp[i + 1] - diag[i]);
661 memcpy (cvalSend + offset, cval + diag[i], tmp *
sizeof (
int));
662 memcpy (fillSend + offset, fill + diag[i], tmp *
sizeof (
int));
663 memcpy (avalSend + offset, aval + diag[i], tmp *
sizeof (
double));
674 "\nEXR ======================= send buffers ======================\n");
676 for (i = first_bdry, j = 0; i < m; ++i, ++j)
678 int tmp = (rp[i + 1] - diag[i]);
679 fprintf (
logFile,
"EXR %i :: ", i + beg_row);
681 for (j = 0; j < tmp; ++j)
685 fprintf (
logFile,
"%i,%i ; ", cvalSend[idx], fillSend[idx]);
689 fprintf (
logFile,
"%i,%i,%g ; ", cvalSend[idx],
690 fillSend[idx], avalSend[idx]);
699 for (i = 0; i < hiCount; ++i)
701 int nabor = hiNabors[i];
713 #define __FUNC__ "waitfor_sends_private"
722 MPI_Waitall (hiCount, er->
req1, status);
723 MPI_Waitall (hiCount, er->
req2, status);
724 MPI_Waitall (hiCount, er->
req3, status);
725 MPI_Waitall (hiCount, er->
req4, status);
726 MPI_Waitall (hiCount, er->
cval_req, status);
727 MPI_Waitall (hiCount, er->
fill_req, status);
728 MPI_Waitall (hiCount, er->
aval_req, status);
HashData * Hash_dhLookup(Hash_dh h, int key)
void Hash_dhDestroy(Hash_dh h)
static void allocate_ext_row_storage_private(ExternalRows_dh er)
void ExternalRows_dhSendRows(ExternalRows_dh er)
MPI_Request aval_req[MAX_MPI_TASKS]
static void build_hash_table_private(ExternalRows_dh er)
static void waitfor_sends_private(ExternalRows_dh er)
int rcv_nz_counts[MAX_MPI_TASKS]
int rcv_row_counts[MAX_MPI_TASKS]
bool Parser_dhHasSwitch(Parser_dh p, char *s)
void ExternalRows_dhRecvRows(ExternalRows_dh er)
void ExternalRows_dhGetRow(ExternalRows_dh er, int globalRow, int *len, int **cval, int **fill, REAL_DH **aval)
static void rcv_ext_storage_private(ExternalRows_dh extRows)
int * rcv_row_lengths[MAX_MPI_TASKS]
static void rcv_external_rows_private(ExternalRows_dh er)
MPI_Status status[MAX_MPI_TASKS]
MPI_Request req3[MAX_MPI_TASKS]
MPI_Request cval_req[MAX_MPI_TASKS]
static void send_external_rows_private(ExternalRows_dh er)
void Hash_dhInsert(Hash_dh h, int key, HashData *dataIN)
MPI_Request req2[MAX_MPI_TASKS]
int * rcv_row_numbers[MAX_MPI_TASKS]
void ExternalRows_dhInit(ExternalRows_dh er, Euclid_dh ctx)
void ExternalRows_dhDestroy(ExternalRows_dh er)
void Hash_dhCreate(Hash_dh *h, int size)
void ExternalRows_dhCreate(ExternalRows_dh *er)
MPI_Request req1[MAX_MPI_TASKS]
MPI_Request req4[MAX_MPI_TASKS]
static void print_received_rows_private(ExternalRows_dh er)
static void send_ext_storage_private(ExternalRows_dh er)
MPI_Request fill_req[MAX_MPI_TASKS]