Threaded one more loop and added notations about future loops to thread.
This commit is contained in:
parent
c220065050
commit
462be77963
@ -10,9 +10,6 @@
|
||||
* $Revision$
|
||||
***********************************************************************EHEADER*/
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* HYPRE_SStructGraph interface
|
||||
@ -83,10 +80,9 @@ HYPRE_SStructGraphCreate( MPI_Comm comm,
|
||||
hypre_SStructGraphObjectType(graph) = HYPRE_SSTRUCT;
|
||||
|
||||
hypre_SStructGraphEntries(graph) = NULL;
|
||||
hypre_SStructNGraphEntries(graph) =0;
|
||||
hypre_SStructAGraphEntries(graph) =0;
|
||||
hypre_SStructNGraphEntries(graph) = 0;
|
||||
hypre_SStructAGraphEntries(graph) = 0;
|
||||
|
||||
|
||||
*graph_ptr = graph;
|
||||
|
||||
return hypre_error_flag;
|
||||
@ -148,6 +144,7 @@ HYPRE_SStructGraphDestroy( HYPRE_SStructGraph graph )
|
||||
hypre_TFree(fem_sparse_i);
|
||||
hypre_TFree(fem_sparse_j);
|
||||
hypre_TFree(fem_entries);
|
||||
/* RDF: THREAD? */
|
||||
for (i = 0; i < nUventries; i++)
|
||||
{
|
||||
Uventry = Uventries[iUventries[i]];
|
||||
@ -190,8 +187,7 @@ HYPRE_SStructGraphSetStencil( HYPRE_SStructGraph graph,
|
||||
HYPRE_Int var,
|
||||
HYPRE_SStructStencil stencil )
|
||||
{
|
||||
hypre_SStructStencilRef(stencil,
|
||||
&hypre_SStructGraphStencil(graph, part, var));
|
||||
hypre_SStructStencilRef(stencil, &hypre_SStructGraphStencil(graph, part, var));
|
||||
|
||||
return hypre_error_flag;
|
||||
}
|
||||
@ -241,7 +237,6 @@ HYPRE_SStructGraphSetFEMSparsity( HYPRE_SStructGraph graph,
|
||||
/*--------------------------------------------------------------------------
|
||||
* THIS IS FOR A NON-OVERLAPPING GRID GRAPH.
|
||||
*
|
||||
*
|
||||
* Now we just keep track of calls to this function and do all the "work"
|
||||
* in the assemble.
|
||||
*--------------------------------------------------------------------------*/
|
||||
@ -255,12 +250,10 @@ HYPRE_SStructGraphAddEntries( HYPRE_SStructGraph graph,
|
||||
HYPRE_Int *to_index,
|
||||
HYPRE_Int to_var )
|
||||
{
|
||||
hypre_SStructGrid *grid = hypre_SStructGraphGrid(graph);
|
||||
HYPRE_Int ndim = hypre_SStructGridNDim(grid);
|
||||
|
||||
|
||||
hypre_SStructGrid *grid = hypre_SStructGraphGrid(graph);
|
||||
HYPRE_Int ndim = hypre_SStructGridNDim(grid);
|
||||
|
||||
hypre_SStructGraphEntry **entries = hypre_SStructGraphEntries(graph);
|
||||
hypre_SStructGraphEntry **entries = hypre_SStructGraphEntries(graph);
|
||||
hypre_SStructGraphEntry *new_entry;
|
||||
|
||||
HYPRE_Int n_entries = hypre_SStructNGraphEntries(graph);
|
||||
@ -295,7 +288,8 @@ HYPRE_SStructGraphAddEntries( HYPRE_SStructGraph graph,
|
||||
hypre_SStructGraphEntryToVar(new_entry) = to_var;
|
||||
|
||||
hypre_CopyToCleanIndex(index, ndim, hypre_SStructGraphEntryIndex(new_entry));
|
||||
hypre_CopyToCleanIndex(to_index, ndim, hypre_SStructGraphEntryToIndex(new_entry));
|
||||
hypre_CopyToCleanIndex(
|
||||
to_index, ndim, hypre_SStructGraphEntryToIndex(new_entry));
|
||||
|
||||
entries[n_entries] = new_entry;
|
||||
|
||||
@ -303,7 +297,6 @@ HYPRE_SStructGraphAddEntries( HYPRE_SStructGraph graph,
|
||||
n_entries++;
|
||||
hypre_SStructNGraphEntries(graph) = n_entries;
|
||||
|
||||
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
@ -370,7 +363,6 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
HYPRE_Int ndim = hypre_SStructGridNDim(grid);
|
||||
hypre_SStructUEntry *Uentries;
|
||||
|
||||
|
||||
#if HYPRE_NO_GLOBAL_PARTITION
|
||||
|
||||
/* may need to re-do box managers for the AP*/
|
||||
@ -390,16 +382,17 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
hypre_Box *bbox, *new_box;
|
||||
hypre_StructGrid *sgrid;
|
||||
HYPRE_Int *num_ghost;
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* If AP, then may need to redo the box managers
|
||||
*---------------------------------------------------------*/
|
||||
|
||||
new_box = hypre_BoxCreate();
|
||||
|
||||
/* if any processor has added entries, then all
|
||||
need to participate */
|
||||
/* if any processor has added entries, then all need to participate */
|
||||
|
||||
hypre_MPI_Allreduce(&n_add_entries, &global_n_add_entries, 1, HYPRE_MPI_INT, hypre_MPI_SUM, comm);
|
||||
hypre_MPI_Allreduce(&n_add_entries, &global_n_add_entries,
|
||||
1, HYPRE_MPI_INT, hypre_MPI_SUM, comm);
|
||||
|
||||
if (global_n_add_entries > 0 )
|
||||
{
|
||||
@ -426,12 +419,9 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
hypre_StructGridComm(sgrid),
|
||||
&new_managers[part][var]);
|
||||
|
||||
|
||||
/* need to set the num ghost for new manager also */
|
||||
num_ghost = hypre_StructGridNumGhost(sgrid);
|
||||
hypre_BoxManSetNumGhost(new_managers[part][var], num_ghost);
|
||||
|
||||
|
||||
}
|
||||
} /* end loop over parts */
|
||||
|
||||
@ -456,9 +446,7 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
|
||||
if (hypre_IndexInBoxP(index,bbox) != 0)
|
||||
{
|
||||
|
||||
hypre_BoxManGatherEntries( new_boxman,
|
||||
index, index);
|
||||
hypre_BoxManGatherEntries(new_boxman,index, index);
|
||||
}
|
||||
|
||||
/* now repeat the check for to_part, to_var, to_index */
|
||||
@ -472,16 +460,13 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
|
||||
if (hypre_IndexInBoxP(to_index,bbox) != 0)
|
||||
{
|
||||
hypre_BoxManGatherEntries( new_boxman,
|
||||
to_index, to_index);
|
||||
hypre_BoxManGatherEntries(new_boxman,to_index, to_index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Now go through the managers and if gather has been called (on
|
||||
any processor) then populate the new manager with the entries
|
||||
from the old manager and then assemble and delete the old
|
||||
manager. */
|
||||
/* Now go through the managers and if gather has been called (on any
|
||||
processor) then populate the new manager with the entries from the old
|
||||
manager and then assemble and delete the old manager. */
|
||||
for (part = 0; part < nparts; part++)
|
||||
{
|
||||
pgrid = hypre_SStructGridPGrid(grid, part);
|
||||
@ -490,9 +475,7 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
for (var = 0; var < nvars; var++)
|
||||
{
|
||||
new_boxman = new_managers[part][var];
|
||||
hypre_BoxManGetGlobalIsGatherCalled( new_boxman,
|
||||
comm,
|
||||
&is_gather );
|
||||
hypre_BoxManGetGlobalIsGatherCalled(new_boxman, comm, &is_gather);
|
||||
if (is_gather)
|
||||
{
|
||||
/* Gather has been called on at least 1 proc - copy
|
||||
@ -500,12 +483,10 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
|
||||
orig_boxman = managers[part][var];
|
||||
|
||||
hypre_BoxManGetAllEntries(orig_boxman ,
|
||||
&num_entries, &all_entries);
|
||||
hypre_BoxManGetAllEntries(orig_boxman, &num_entries, &all_entries);
|
||||
|
||||
for (j=0; j< num_entries; j++)
|
||||
{
|
||||
|
||||
entry = &all_entries[j];
|
||||
|
||||
hypre_BoxManEntryGetInfo(entry, &info);
|
||||
@ -516,23 +497,20 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
hypre_BoxManEntryProc(entry),
|
||||
hypre_BoxManEntryId(entry),
|
||||
info);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* call assemble for new boxmanager*/
|
||||
hypre_BoxManAssemble(new_boxman);
|
||||
|
||||
/* TEMP for testing
|
||||
if (hypre_BoxManNEntries(new_boxman) != num_entries)
|
||||
{
|
||||
if (hypre_BoxManNEntries(new_boxman) != num_entries)
|
||||
{
|
||||
hypre_MPI_Comm_rank(comm, &myproc);
|
||||
hypre_printf("myid = %d, new_entries = %d, old entries = %d\n", myproc, hypre_BoxManNEntries(new_boxman), num_entries);
|
||||
} */
|
||||
} */
|
||||
|
||||
/* destroy old manager */
|
||||
hypre_BoxManDestroy (managers[part][var]);
|
||||
hypre_BoxManDestroy (managers[part][var]);
|
||||
}
|
||||
else /* no gather called */
|
||||
{
|
||||
@ -550,20 +528,17 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
|
||||
/* assign the new ones */
|
||||
hypre_SStructGridBoxManagers(grid) = new_managers;
|
||||
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
hypre_BoxDestroy(new_box);
|
||||
hypre_BoxDestroy(new_box);
|
||||
|
||||
/* end of AP stuff */
|
||||
#endif
|
||||
|
||||
|
||||
hypre_MPI_Comm_size(comm, &nprocs);
|
||||
hypre_MPI_Comm_rank(comm, &myproc);
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* First we do the work that was previously in the AddEntries:
|
||||
* set up the UVEntry and iUventries
|
||||
@ -638,7 +613,6 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
hypre_SStructUVEntryNUEntries(Uventry) = nUentries;
|
||||
hypre_SStructUVEntryUEntries(Uventry) = Uentries;
|
||||
|
||||
|
||||
i = nUentries - 1;
|
||||
hypre_SStructUVEntryToPart(Uventry, i) = to_part;
|
||||
hypre_CopyToCleanIndex(to_index, ndim,
|
||||
@ -663,19 +637,14 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
|
||||
hypre_SStructGraphTotUEntries(graph) ++;
|
||||
|
||||
|
||||
/*free each add entry after copying */
|
||||
hypre_TFree(new_entry);
|
||||
|
||||
|
||||
|
||||
}/* end of loop through add entries */
|
||||
|
||||
|
||||
/* free the storage for the add entires */
|
||||
hypre_TFree(add_entries);
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* Set up the FEM stencil information
|
||||
*---------------------------------------------------------*/
|
||||
@ -822,8 +791,8 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
* Compute non-stencil column numbers (if possible), and
|
||||
* start building requests for needed off-process info.
|
||||
*---------------------------------------------------------*/
|
||||
|
||||
|
||||
/* RDF: THREAD? */
|
||||
for (i = 0; i < nUventries; i++)
|
||||
{
|
||||
Uventry = Uventries[iUventries[i]];
|
||||
@ -852,14 +821,13 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This should not happen (TO DO: take out print statement)*/
|
||||
hypre_printf("Error in HYPRE_SStructGraphAssemble, my id = %d\n", myproc);
|
||||
|
||||
/* This should not happen (TO DO: take out print statement) */
|
||||
hypre_printf("Error in HYPRE_SStructGraphAssemble, my id = %d\n",
|
||||
myproc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
* $Revision$
|
||||
***********************************************************************EHEADER*/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Member functions for hypre_SStructPMatrix class.
|
||||
@ -120,9 +119,8 @@ hypre_SStructPMatrixCreate( MPI_Comm comm,
|
||||
{
|
||||
if (new_sizes[vj])
|
||||
{
|
||||
sstencils[vi][vj] = hypre_StructStencilCreate(new_dim,
|
||||
new_sizes[vj],
|
||||
new_shapes[vj]);
|
||||
sstencils[vi][vj] =
|
||||
hypre_StructStencilCreate(new_dim, new_sizes[vj], new_shapes[vj]);
|
||||
}
|
||||
size = hypre_max(size, new_sizes[vj]);
|
||||
}
|
||||
@ -771,6 +769,7 @@ hypre_SStructUMatrixInitialize( hypre_SStructMatrix *matrix )
|
||||
/* GEC0902 essentially for each UVentry we figure out how many extra columns
|
||||
* we need to add to the rowsizes */
|
||||
|
||||
/* RDF: THREAD? */
|
||||
for (entry = 0; entry < nUventries; entry++)
|
||||
{
|
||||
m = iUventries[entry];
|
||||
@ -970,7 +969,7 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix,
|
||||
HYPRE_Int row_base, col_base, val_base;
|
||||
HYPRE_Int e, entry, ii, jj, i, j, k;
|
||||
|
||||
/* GEC1002 the matrix type */
|
||||
/* GEC1002 the matrix type */
|
||||
HYPRE_Int matrix_type = hypre_SStructMatrixObjectType(matrix);
|
||||
|
||||
box = hypre_BoxCreate();
|
||||
@ -988,6 +987,8 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix,
|
||||
hypre_BoxSetExtents(box, ilower, iupper);
|
||||
nrows = hypre_BoxVolume(box)*nentries;
|
||||
ncols = hypre_CTAlloc(HYPRE_Int, nrows);
|
||||
#define HYPRE_SMP_PRIVATE i
|
||||
#include "hypre_smp_forloop.h"
|
||||
for (i = 0; i < nrows; i++)
|
||||
{
|
||||
ncols[i] = 1;
|
||||
@ -1070,7 +1071,8 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix,
|
||||
val_base = e + (hypre_IndexX(index) +
|
||||
hypre_IndexY(index)*sy +
|
||||
hypre_IndexZ(index)*sz) * nentries;
|
||||
|
||||
|
||||
/* RDF: THREAD */
|
||||
for (k = 0; k < hypre_BoxSizeZ(int_box); k++)
|
||||
{
|
||||
for (j = 0; j < hypre_BoxSizeY(int_box); j++)
|
||||
@ -1125,7 +1127,7 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix,
|
||||
hypre_BoxDestroy(to_box);
|
||||
hypre_BoxDestroy(map_box);
|
||||
hypre_BoxDestroy(int_box);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------
|
||||
* non-stencil entries
|
||||
@ -1136,6 +1138,7 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix,
|
||||
hypre_CopyIndex(ilower, hypre_BoxIMin(box));
|
||||
hypre_CopyIndex(iupper, hypre_BoxIMax(box));
|
||||
|
||||
/* RDF: THREAD (Check safety on UMatrixSetValues call) */
|
||||
for (k = hypre_BoxIMinZ(box); k <= hypre_BoxIMaxZ(box); k++)
|
||||
{
|
||||
for (j = hypre_BoxIMinY(box); j <= hypre_BoxIMaxY(box); j++)
|
||||
@ -1509,6 +1512,7 @@ hypre_SStructMatrixSetInterPartValues( HYPRE_SStructMatrix matrix,
|
||||
{
|
||||
/* set or add */
|
||||
|
||||
/* RDF: THREAD */
|
||||
/* copy values into tvalues */
|
||||
tvi = 0;
|
||||
for (k = 0; k < inz; k++)
|
||||
@ -1542,6 +1546,7 @@ hypre_SStructMatrixSetInterPartValues( HYPRE_SStructMatrix matrix,
|
||||
matrix, part, hypre_BoxIMin(ibox1), hypre_BoxIMax(ibox1),
|
||||
var, 1, &entry, tvalues, action);
|
||||
|
||||
/* RDF: THREAD */
|
||||
/* copy tvalues into values */
|
||||
tvi = 0;
|
||||
for (k = 0; k < inz; k++)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user