mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
parallel fixes
This commit is contained in:
parent
368da4c996
commit
27f8e452fd
@ -170,8 +170,15 @@ namespace netgen
|
||||
public:
|
||||
|
||||
/// Generate array of logical and physical size asize
|
||||
explicit Array(int asize = 0)
|
||||
: FlatArray<T, BASE> (asize, asize ? new T[asize] : 0)
|
||||
explicit Array()
|
||||
: FlatArray<T, BASE> (0, NULL)
|
||||
{
|
||||
allocsize = 0;
|
||||
ownmem = 1;
|
||||
}
|
||||
|
||||
explicit Array(int asize)
|
||||
: FlatArray<T, BASE> (asize, new T[asize])
|
||||
{
|
||||
allocsize = asize;
|
||||
ownmem = 1;
|
||||
|
@ -272,59 +272,15 @@ extern "C" {
|
||||
double * p3d, double * jacobian);
|
||||
|
||||
#ifdef PARALLEL
|
||||
// Is Element ei an element of this processor ??
|
||||
bool Ng_IsGhostEl (int ei);
|
||||
|
||||
void Ng_SetGhostEl(const int ei, const bool aisghost );
|
||||
|
||||
bool Ng_IsGhostSEl (int ei);
|
||||
|
||||
void Ng_SetGhostSEl(const int ei, const bool aisghost );
|
||||
|
||||
bool Ng_IsGhostVert ( int pnum );
|
||||
bool Ng_IsGhostEdge ( int ednum );
|
||||
bool Ng_IsGhostFace ( int fanum );
|
||||
|
||||
bool Ng_IsExchangeEl ( int elnum );
|
||||
bool Ng_IsExchangeSEl ( int selnr );
|
||||
|
||||
void Ng_UpdateOverlap ();
|
||||
int Ng_Overlap();
|
||||
/* void Ng_SetGhostVert ( const int pnum, const bool aisghost ); */
|
||||
/* void Ng_SetGhostEdge ( const int ednum, const bool aisghost ); */
|
||||
/* void Ng_SetGhostFace ( const int fanum, const bool aisghost ); */
|
||||
|
||||
|
||||
|
||||
|
||||
// the folling functions are 0-base !!
|
||||
int NgPar_GetLoc2Glob_VolEl ( int locnum );
|
||||
|
||||
// int NgPar_GetDistantNodeNums ( int nt, int locnum, int * procs, int * distnum);
|
||||
|
||||
// number on distant processor
|
||||
|
||||
// gibt anzahl an distant pnums zurueck
|
||||
// * pnums entspricht ARRAY<int[2] >
|
||||
// returns pairs (dist_proc, num_on_dist_proc)
|
||||
int NgPar_GetDistantNodeNums ( int nodetype, int locnum, int * pnums );
|
||||
int NgPar_GetNDistantNodeNums ( int nodetype, int locnum );
|
||||
|
||||
int NgPar_GetDistantPNum ( int proc, int locnum ) ;
|
||||
int NgPar_GetDistantEdgeNum ( int proc, int locnum ) ;
|
||||
int NgPar_GetDistantFaceNum ( int proc, int locnum ) ;
|
||||
int NgPar_GetDistantElNum ( int proc, int locnum );
|
||||
|
||||
bool NgPar_IsExchangeFace ( int fnr ) ;
|
||||
bool NgPar_IsExchangeVert ( int vnum );
|
||||
bool NgPar_IsExchangeEdge ( int ednum );
|
||||
bool NgPar_IsExchangeElement ( int elnum );
|
||||
|
||||
void NgPar_PrintParallelMeshTopology ();
|
||||
bool NgPar_IsElementInPartition ( int elnum, int dest );
|
||||
|
||||
bool NgPar_IsGhostFace ( int facenum );
|
||||
bool NgPar_IsGhostEdge ( int edgenum );
|
||||
|
||||
|
||||
int NgPar_GetGlobalNodeNum (int nodetype, int locnum);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -24,42 +24,42 @@
|
||||
|
||||
// #include <pthread.h>
|
||||
|
||||
static pthread_t meshingthread;
|
||||
void RunParallel ( void * (*fun)(void *), void * in)
|
||||
{
|
||||
if (netgen::mparam.parthread) // && (ntasks == 1) )
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init (&attr);
|
||||
// the following call can be removed if not available:
|
||||
pthread_attr_setstacksize(&attr, 1000000);
|
||||
//pthread_create (&meshingthread, &attr, fun, NULL);
|
||||
pthread_create (&meshingthread, &attr, fun, in);
|
||||
}
|
||||
else
|
||||
fun (in);
|
||||
}
|
||||
static pthread_t meshingthread;
|
||||
void RunParallel ( void * (*fun)(void *), void * in)
|
||||
{
|
||||
if (netgen::mparam.parthread) // && (ntasks == 1) )
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init (&attr);
|
||||
// the following call can be removed if not available:
|
||||
pthread_attr_setstacksize(&attr, 1000000);
|
||||
//pthread_create (&meshingthread, &attr, fun, NULL);
|
||||
pthread_create (&meshingthread, &attr, fun, in);
|
||||
}
|
||||
else
|
||||
fun (in);
|
||||
}
|
||||
|
||||
#else // Using MS VC++ Standard / Enterprise / Professional edition
|
||||
|
||||
// Afx - Threads need different return - value:
|
||||
// Afx - Threads need different return - value:
|
||||
|
||||
static void* (*sfun)(void *);
|
||||
unsigned int fun2 (void * val)
|
||||
{
|
||||
sfun (val);
|
||||
return 0;
|
||||
}
|
||||
static void* (*sfun)(void *);
|
||||
unsigned int fun2 (void * val)
|
||||
{
|
||||
sfun (val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RunParallel ( void* (*fun)(void *), void * in)
|
||||
{
|
||||
sfun = fun;
|
||||
if (netgen::mparam.parthread)
|
||||
AfxBeginThread (fun2, in);
|
||||
//AfxBeginThread (fun2, NULL);
|
||||
else
|
||||
fun (in);
|
||||
}
|
||||
void RunParallel ( void* (*fun)(void *), void * in)
|
||||
{
|
||||
sfun = fun;
|
||||
if (netgen::mparam.parthread)
|
||||
AfxBeginThread (fun2, in);
|
||||
//AfxBeginThread (fun2, NULL);
|
||||
else
|
||||
fun (in);
|
||||
}
|
||||
|
||||
#endif // #ifdef MSVC_EXPRESS
|
||||
|
||||
@ -67,31 +67,31 @@
|
||||
|
||||
// #include <pthread.h>
|
||||
|
||||
static pthread_t meshingthread;
|
||||
void RunParallel ( void * (*fun)(void *), void * in)
|
||||
{
|
||||
bool parthread = netgen::mparam.parthread;
|
||||
static pthread_t meshingthread;
|
||||
void RunParallel ( void * (*fun)(void *), void * in)
|
||||
{
|
||||
bool parthread = netgen::mparam.parthread;
|
||||
|
||||
#ifdef PARALLEL
|
||||
int provided;
|
||||
MPI_Query_thread(&provided);
|
||||
if (provided < 3)
|
||||
if (netgen::ntasks > 1) parthread = false;
|
||||
// cout << "runparallel = " << parthread << endl;
|
||||
int provided;
|
||||
MPI_Query_thread(&provided);
|
||||
if (provided < 3)
|
||||
if (netgen::ntasks > 1) parthread = false;
|
||||
// cout << "runparallel = " << parthread << endl;
|
||||
#endif
|
||||
|
||||
if (parthread)
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init (&attr);
|
||||
// the following call can be removed if not available:
|
||||
pthread_attr_setstacksize(&attr, 1000000);
|
||||
//pthread_create (&meshingthread, &attr, fun, NULL);
|
||||
pthread_create (&meshingthread, &attr, fun, in);
|
||||
}
|
||||
else
|
||||
fun (in);
|
||||
}
|
||||
if (parthread)
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init (&attr);
|
||||
// the following call can be removed if not available:
|
||||
pthread_attr_setstacksize(&attr, 1000000);
|
||||
//pthread_create (&meshingthread, &attr, fun, NULL);
|
||||
pthread_create (&meshingthread, &attr, fun, in);
|
||||
}
|
||||
else
|
||||
fun (in);
|
||||
}
|
||||
|
||||
#endif // #ifdef _MSC_VER
|
||||
|
||||
@ -937,9 +937,9 @@ bool Ng_IsGhostEl (int ei)
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
if ( mesh->GetDimension() == 3 )
|
||||
if ( mesh->GetDimension() == 3 )
|
||||
return mesh->VolumeElement(ei).IsGhost();
|
||||
else
|
||||
else
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
@ -948,7 +948,7 @@ void Ng_SetGhostEl(const int ei, const bool aisghost )
|
||||
{
|
||||
;
|
||||
/*
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
mesh -> VolumeElement(ei).SetGhost (aisghost);
|
||||
*/
|
||||
}
|
||||
@ -957,9 +957,9 @@ bool Ng_IsGhostSEl (int ei)
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
return mesh->SurfaceElement(ei).IsGhost();
|
||||
else
|
||||
else
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
@ -968,7 +968,7 @@ void Ng_SetGhostSEl(const int ei, const bool aisghost )
|
||||
{
|
||||
;
|
||||
/*
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
mesh -> SurfaceElement(ei).SetGhost (aisghost);
|
||||
*/
|
||||
}
|
||||
@ -1015,106 +1015,120 @@ int Ng_Overlap ()
|
||||
|
||||
|
||||
|
||||
int NgPar_GetLoc2Glob_VolEl ( int locnum )
|
||||
{
|
||||
return mesh -> GetParallelTopology().GetLoc2Glob_VolEl ( locnum+1) -1;
|
||||
}
|
||||
int NgPar_GetLoc2Glob_VolEl ( int locnum )
|
||||
{
|
||||
return mesh -> GetParallelTopology().GetLoc2Glob_VolEl ( locnum+1) -1;
|
||||
}
|
||||
|
||||
// gibt anzahl an distant pnums zurueck
|
||||
// * pnums entspricht ARRAY<int[2] >
|
||||
int NgPar_GetDistantNodeNums ( int nodetype, int locnum, int * distnums )
|
||||
{
|
||||
int size;
|
||||
switch ( nodetype )
|
||||
{
|
||||
case 0:
|
||||
size = mesh->GetParallelTopology().GetDistantPNums( locnum+1, distnums );
|
||||
break;
|
||||
case 1:
|
||||
size = mesh->GetParallelTopology().GetDistantEdgeNums( locnum+1, distnums );
|
||||
break;
|
||||
case 2:
|
||||
size = mesh->GetParallelTopology().GetDistantFaceNums( locnum+1, distnums );
|
||||
break;
|
||||
case 3:
|
||||
size = mesh->GetParallelTopology().GetDistantElNums( locnum+1, distnums );
|
||||
break;
|
||||
default:
|
||||
cerr << "NgPar_GetDistantNodeNums() Unknown nodetype " << nodetype << endl;
|
||||
size = -1;
|
||||
}
|
||||
// 0 - based
|
||||
for ( int i = 0; i < size; i++ )
|
||||
distnums[2*i+1]--;
|
||||
// gibt anzahl an distant pnums zurueck
|
||||
// * pnums entspricht ARRAY<int[2] >
|
||||
int NgPar_GetDistantNodeNums ( int nodetype, int locnum, int * distnums )
|
||||
{
|
||||
int size;
|
||||
switch ( nodetype )
|
||||
{
|
||||
case 0:
|
||||
size = mesh->GetParallelTopology().GetDistantPNums( locnum+1, distnums );
|
||||
break;
|
||||
case 1:
|
||||
size = mesh->GetParallelTopology().GetDistantEdgeNums( locnum+1, distnums );
|
||||
break;
|
||||
case 2:
|
||||
size = mesh->GetParallelTopology().GetDistantFaceNums( locnum+1, distnums );
|
||||
break;
|
||||
case 3:
|
||||
size = mesh->GetParallelTopology().GetDistantElNums( locnum+1, distnums );
|
||||
break;
|
||||
default:
|
||||
cerr << "NgPar_GetDistantNodeNums() Unknown nodetype " << nodetype << endl;
|
||||
size = -1;
|
||||
}
|
||||
// 0 - based
|
||||
for ( int i = 0; i < size; i++ )
|
||||
distnums[2*i+1]--;
|
||||
|
||||
return size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
int NgPar_GetNDistantNodeNums ( int nodetype, int locnum )
|
||||
{
|
||||
switch ( nodetype )
|
||||
{
|
||||
case 0:
|
||||
return mesh->GetParallelTopology().GetNDistantPNums( locnum+1 );
|
||||
case 1:
|
||||
return mesh->GetParallelTopology().GetNDistantEdgeNums( locnum+1 );
|
||||
case 2:
|
||||
return mesh->GetParallelTopology().GetNDistantFaceNums( locnum+1 );
|
||||
case 3:
|
||||
return mesh->GetParallelTopology().GetNDistantElNums( locnum+1 );
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int NgPar_GetNDistantNodeNums ( int nodetype, int locnum )
|
||||
{
|
||||
switch ( nodetype )
|
||||
{
|
||||
case 0:
|
||||
return mesh->GetParallelTopology().GetNDistantPNums( locnum+1 );
|
||||
case 1:
|
||||
return mesh->GetParallelTopology().GetNDistantEdgeNums( locnum+1 );
|
||||
case 2:
|
||||
return mesh->GetParallelTopology().GetNDistantFaceNums( locnum+1 );
|
||||
case 3:
|
||||
return mesh->GetParallelTopology().GetNDistantElNums( locnum+1 );
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int NgPar_GetDistantPNum ( int proc, int locpnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantPNum( proc, locpnum+1) - 1;
|
||||
}
|
||||
|
||||
int NgPar_GetDistantEdgeNum ( int proc, int locpnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantEdgeNum( proc, locpnum+1) - 1;
|
||||
}
|
||||
|
||||
int NgPar_GetDistantFaceNum ( int proc, int locpnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantFaceNum (proc, locpnum+1 ) - 1;
|
||||
}
|
||||
|
||||
int NgPar_GetDistantElNum ( int proc, int locelnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantElNum (proc, locelnum+1 ) - 1;
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeFace ( int fnr )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantFaceNums( fnr+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeFace ( fnr+1 );
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeVert ( int vnum )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantPNums( vnum+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeVert ( vnum+1 );
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeEdge ( int ednum )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantEdgeNums( ednum+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeEdge ( ednum+1 );
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeElement ( int elnum )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantElNums( elnum+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeElement ( elnum+1 );
|
||||
}
|
||||
int NgPar_GetGlobalNodeNum (int nodetype, int locnum)
|
||||
{
|
||||
switch (nodetype)
|
||||
{
|
||||
case 0: return mesh->GetParallelTopology().GetDistantPNum (0, locnum+1)-1;
|
||||
case 1: return mesh->GetParallelTopology().GetDistantEdgeNum (0, locnum+1)-1;
|
||||
case 2: return mesh->GetParallelTopology().GetDistantFaceNum (0, locnum+1)-1;
|
||||
case 3: return mesh->GetParallelTopology().GetDistantElNum (0, locnum+1)-1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void NgPar_PrintParallelMeshTopology ()
|
||||
{
|
||||
mesh -> GetParallelTopology().Print ();
|
||||
}
|
||||
|
||||
int NgPar_GetDistantPNum ( int proc, int locpnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantPNum( proc, locpnum+1) - 1;
|
||||
}
|
||||
|
||||
int NgPar_GetDistantEdgeNum ( int proc, int locpnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantEdgeNum( proc, locpnum+1) - 1;
|
||||
}
|
||||
|
||||
int NgPar_GetDistantFaceNum ( int proc, int locpnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantFaceNum (proc, locpnum+1 ) - 1;
|
||||
}
|
||||
|
||||
int NgPar_GetDistantElNum ( int proc, int locelnum )
|
||||
{
|
||||
return mesh->GetParallelTopology().GetDistantElNum (proc, locelnum+1 ) - 1;
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeFace ( int fnr )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantFaceNums( fnr+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeFace ( fnr+1 );
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeVert ( int vnum )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantPNums( vnum+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeVert ( vnum+1 );
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeEdge ( int ednum )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantEdgeNums( ednum+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeEdge ( ednum+1 );
|
||||
}
|
||||
|
||||
bool NgPar_IsExchangeElement ( int elnum )
|
||||
{
|
||||
return (mesh->GetParallelTopology().GetNDistantElNums( elnum+1 ) > 0);
|
||||
// return mesh->GetParallelTopology().IsExchangeElement ( elnum+1 );
|
||||
}
|
||||
|
||||
|
||||
void NgPar_PrintParallelMeshTopology ()
|
||||
{
|
||||
mesh -> GetParallelTopology().Print ();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -343,8 +343,8 @@ namespace netgen
|
||||
// boundary layer list
|
||||
if(!surfid.Contains(mesh.LineSegment(j).si))
|
||||
{
|
||||
int pnt_commelem = 0;
|
||||
int pnum_commelem = 0;
|
||||
int pnt_commelem = 0;
|
||||
int pnum_commelem = 0;
|
||||
Array<int> pnt1_elems;
|
||||
Array<int> pnt2_elems;
|
||||
|
||||
|
@ -1446,7 +1446,7 @@ namespace netgen
|
||||
{
|
||||
for(ElementIndex i=0;i<mesh.GetNE(); i++)
|
||||
{
|
||||
Element el = mesh[i] ;
|
||||
// Element el = mesh[i] ;
|
||||
HPRefElement & hpel = hpelements[mesh[i].hp_elnr];
|
||||
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (mesh[i].GetType());
|
||||
double dist[3] = {0,0,0};
|
||||
|
@ -748,9 +748,6 @@ namespace netgen
|
||||
/// loads a mesh sent from master processor
|
||||
void ReceiveParallelMesh ();
|
||||
|
||||
|
||||
void UpdateOverlap ();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -249,7 +249,6 @@ namespace netgen
|
||||
for (int dest = 1; dest < ntasks; dest++)
|
||||
{
|
||||
FlatArray<PointIndex> verts = verts_of_proc[dest];
|
||||
|
||||
sendrequests.Append (MyMPI_ISend (verts, dest, MPI_TAG_MESH+1));
|
||||
|
||||
MPI_Datatype mptype = MeshPoint::MyGetMPIType();
|
||||
@ -257,7 +256,7 @@ namespace netgen
|
||||
int numv = verts.Size();
|
||||
|
||||
MPI_Datatype newtype;
|
||||
Array<int> blocklen (numv);
|
||||
Array<int> blocklen (numv);
|
||||
blocklen = 1;
|
||||
|
||||
MPI_Type_indexed (numv, &blocklen[0],
|
||||
@ -270,7 +269,6 @@ namespace netgen
|
||||
sendrequests.Append (request);
|
||||
}
|
||||
|
||||
|
||||
Array<int> num_distpnums(ntasks);
|
||||
num_distpnums = 0;
|
||||
|
||||
@ -481,10 +479,10 @@ namespace netgen
|
||||
|
||||
// receive vertices
|
||||
NgProfiler::StartTimer (timer_pts);
|
||||
|
||||
|
||||
Array<int> verts;
|
||||
MyMPI_Recv (verts, 0, MPI_TAG_MESH+1);
|
||||
|
||||
|
||||
int numvert = verts.Size();
|
||||
paralleltop -> SetNV (numvert);
|
||||
|
||||
@ -542,7 +540,8 @@ namespace netgen
|
||||
MyMPI_Recv (fddata, 0, MPI_TAG_MESH+3);
|
||||
for (int i = 0; i < fddata.Size(); i += 6)
|
||||
{
|
||||
int faceind = AddFaceDescriptor (FaceDescriptor(int(fddata[i]), int(fddata[i+1]), int(fddata[i+2]), 0));
|
||||
int faceind = AddFaceDescriptor
|
||||
(FaceDescriptor(int(fddata[i]), int(fddata[i+1]), int(fddata[i+2]), 0));
|
||||
GetFaceDescriptor(faceind).SetBCProperty (int(fddata[i+3]));
|
||||
GetFaceDescriptor(faceind).domin_singular = fddata[i+4];
|
||||
GetFaceDescriptor(faceind).domout_singular = fddata[i+5];
|
||||
@ -1150,22 +1149,6 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Mesh :: UpdateOverlap()
|
||||
{
|
||||
cout << "UpdateOverlap depreciated" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,8 +11,9 @@ namespace netgen
|
||||
static MPI_Group MPI_HIGHORDER_WORLD;
|
||||
static MPI_Comm MPI_HIGHORDER_COMM;
|
||||
|
||||
void MyMPI_ExchangeTable (TABLE<int> & send_verts,
|
||||
TABLE<int> & recv_verts, int tag,
|
||||
template <typename T>
|
||||
void MyMPI_ExchangeTable (TABLE<T> & send_verts,
|
||||
TABLE<T> & recv_verts, int tag,
|
||||
MPI_Comm comm = MPI_COMM_WORLD)
|
||||
{
|
||||
int ntasks, rank;
|
||||
|
@ -76,8 +76,6 @@ namespace netgen
|
||||
ParallelMeshTopology & paralleltop = mesh.GetParallelTopology();
|
||||
#endif
|
||||
|
||||
bool isparallel = 0;
|
||||
|
||||
|
||||
if (timestamp > mesh.GetTimeStamp()) return;
|
||||
|
||||
@ -1151,23 +1149,12 @@ namespace netgen
|
||||
|
||||
if (cnt_err && ntasks == 1)
|
||||
cout << cnt_err << " elements are not matching !!!" << endl;
|
||||
|
||||
if (cnt_err && ntasks > 1)
|
||||
isparallel = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef PARALLEL
|
||||
if (mesh.GetDimension() == 3)
|
||||
if (isparallel != (id != 0))
|
||||
{
|
||||
cerr << " ****************************** " << endl;
|
||||
cerr << " **** wrong isparallel ****** " << endl;
|
||||
cerr << " ****************************** " << endl;
|
||||
}
|
||||
|
||||
if (id != 0) // if (isparallel)
|
||||
if (id != 0)
|
||||
{
|
||||
paralleltop.Update();
|
||||
if ( paralleltop.DoCoarseUpdate() )
|
||||
|
@ -746,14 +746,14 @@ namespace netgen
|
||||
{
|
||||
string displname;
|
||||
|
||||
Display * dpy = glXGetCurrentDisplay();
|
||||
// Display * dpy = glXGetCurrentDisplay();
|
||||
GLXDrawable drawable = glXGetCurrentDrawable();
|
||||
GLXContext ctx = glXGetCurrentContext();
|
||||
GLXContextID xid = glXGetContextIDEXT (ctx);
|
||||
|
||||
displname = XDisplayName (0);
|
||||
/*
|
||||
|
||||
/*
|
||||
cout << "Init Parallel GL" << endl;
|
||||
cout << "DisplayName = " << displname << endl;
|
||||
cout << "current display = " << dpy << endl;
|
||||
|
@ -2223,28 +2223,27 @@ namespace netgen
|
||||
MyMPI_Bcast (comp);
|
||||
#endif
|
||||
|
||||
const SolData * sol;
|
||||
double val;
|
||||
bool considerElem;
|
||||
// bool considerElem;
|
||||
|
||||
bool hasit = false;
|
||||
minv = 0; maxv = 1;
|
||||
if (funcnr != -1)
|
||||
|
||||
if ((ntasks == 1) || (id > 0))
|
||||
if (funcnr != -1)
|
||||
{
|
||||
sol = soldata[funcnr];
|
||||
const SolData * sol = soldata[funcnr];
|
||||
|
||||
if (sol->draw_volume)
|
||||
{
|
||||
int ne = mesh->GetNE();
|
||||
for (int i = 0; i < ne; i++)
|
||||
{
|
||||
considerElem = GetValue (sol, i, 0.333, 0.333, 0.333, comp, val);
|
||||
bool considerElem = GetValue (sol, i, 0.333, 0.333, 0.333, comp, val);
|
||||
if (considerElem)
|
||||
{
|
||||
if (val > maxv || !hasit)
|
||||
maxv = val;
|
||||
if (val < minv || !hasit)
|
||||
minv = val;
|
||||
if (val > maxv || !hasit) maxv = val;
|
||||
if (val < minv || !hasit) minv = val;
|
||||
hasit = true;
|
||||
}
|
||||
}
|
||||
@ -2255,16 +2254,14 @@ namespace netgen
|
||||
for (int i = 0; i < nse; i++)
|
||||
{
|
||||
ELEMENT_TYPE type = mesh->SurfaceElement(i+1).GetType();
|
||||
if (type == QUAD)
|
||||
considerElem = GetSurfValue (sol, i, -1, 0.5, 0.5, comp, val);
|
||||
else
|
||||
considerElem = GetSurfValue (sol, i, -1, 0.3333333, 0.3333333, comp, val);
|
||||
bool considerElem = (type == QUAD)
|
||||
? GetSurfValue (sol, i, -1, 0.5, 0.5, comp, val)
|
||||
: GetSurfValue (sol, i, -1, 0.3333333, 0.3333333, comp, val);
|
||||
|
||||
if (considerElem)
|
||||
{
|
||||
if (val > maxv || !hasit)
|
||||
maxv = val;
|
||||
if (val < minv || !hasit)
|
||||
minv = val;
|
||||
if (val > maxv || !hasit) maxv = val;
|
||||
if (val < minv || !hasit) minv = val;
|
||||
hasit = true;
|
||||
}
|
||||
}
|
||||
|
@ -68,18 +68,12 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
|
||||
#ifdef PARALLEL
|
||||
// MPI_Init(&argc, &argv);
|
||||
|
||||
int required = MPI_THREAD_MULTIPLE;
|
||||
// int required = 0;
|
||||
int provided;
|
||||
MPI_Init_thread(&argc, &argv, required, &provided);
|
||||
int mpi_required = MPI_THREAD_MULTIPLE, mpi_provided;
|
||||
MPI_Init_thread(&argc, &argv, mpi_required, &mpi_provided);
|
||||
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &netgen::ntasks);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &netgen::id);
|
||||
|
||||
if (netgen::id == 0 && provided == MPI_THREAD_MULTIPLE)
|
||||
cout << "multithreaded mpi is supported" << endl;
|
||||
|
||||
MPI_Comm_dup ( MPI_COMM_WORLD, &netgen::mesh_comm);
|
||||
#endif
|
||||
@ -114,9 +108,21 @@ int main(int argc, char ** argv)
|
||||
|
||||
|
||||
#ifdef PARALLEL
|
||||
cout << "Running MPI - parallel using "
|
||||
<< netgen::ntasks << " processor"
|
||||
<< ((netgen::ntasks > 1) ? "s " : " ") << endl;
|
||||
if (netgen::ntasks == 1)
|
||||
{
|
||||
cout << "Run parallel Netgen with 'mpirun -np xy netgen'" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Running MPI - parallel using "
|
||||
<< netgen::ntasks << " processor"
|
||||
<< ((netgen::ntasks > 1) ? "s " : " ") << endl;
|
||||
|
||||
cout << "MPI-version = " << MPI_VERSION << '.' << MPI_SUBVERSION << endl;
|
||||
|
||||
if (mpi_provided == MPI_THREAD_MULTIPLE)
|
||||
cout << "multithreaded MPI is supported" << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -148,12 +148,6 @@ void ParallelRun()
|
||||
VT_USER_END ("Mesh::ReceiveParallelMesh");
|
||||
}
|
||||
|
||||
else if ( message == "overlap++" )
|
||||
{
|
||||
PrintMessage (1, "overlap++++++");
|
||||
mesh -> UpdateOverlap();
|
||||
}
|
||||
|
||||
else if ( message == "visualize" )
|
||||
{
|
||||
cout << "parallel message visualize depreciated" << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user