parallel visualization

This commit is contained in:
Joachim Schoeberl 2011-02-15 16:22:05 +00:00
parent 894df4cb84
commit 2261c36684
7 changed files with 954 additions and 801 deletions

View File

@ -87,8 +87,8 @@ AC_ARG_ENABLE([nglib],
AC_ARG_ENABLE([parallel],
[AC_HELP_STRING([--enable-parallel],[enable mpi parallelization])],
[AC_SUBST([MPI_INCLUDES], "-I/usr/lib64/mpi/gcc/openmpi/include -DPARALLEL -I/usr/include/metis -DMETIS")
AC_SUBST([MPI_LIBS], "-L/usr/lib64/mpi/gcc/openmpi/lib64 -lmpi_cxx -lmetis")
[AC_SUBST([MPI_INCLUDES], "-I/usr/lib64/mpi/gcc/openmpi/include -DPARALLEL -I/usr/include/metis -DMETIS -DVTRACE -I/usr/local/include/vampirtrace")
AC_SUBST([MPI_LIBS], "-L/usr/lib64/mpi/gcc/openmpi/lib64 -lmpi_cxx -lmetis -lvt-hyb")
]
)

View File

@ -52,15 +52,15 @@ namespace netgen
int nelglob, nelloc, nvglob, nedglob, nfaglob;
// receive global values
MPI_Bcast( &nelglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nvglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nedglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nfaglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &dimension, 1, MPI_INT, 0, MPI_COMM_WORLD );
MyMPI_Recv ( nelloc, 0 );
MPI_Bcast (&nelglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&nvglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&nedglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&nfaglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&dimension, 1, MPI_INT, 0, MPI_COMM_WORLD);
MyMPI_Recv (nelloc, 0);
paralleltop -> SetNVGlob ( nvglob );
paralleltop -> SetNEGlob ( nelglob );
paralleltop -> SetNVGlob (nvglob);
paralleltop -> SetNEGlob (nelglob);
INDEX_CLOSED_HASHTABLE<int> glob2loc_vert_ht (1);
@ -69,7 +69,7 @@ namespace netgen
// int ve = 0;
while (!endmesh)
{
MyMPI_Recv ( st, 0 );
MyMPI_Recv (st, 0);
// receive vertices
if (st == "vertex")
@ -77,14 +77,14 @@ namespace netgen
NgProfiler::RegionTimer reg(timer_pts);
Array<double> pointarray;
MyMPI_Recv ( pointarray, 0 );
MyMPI_Recv (pointarray, 0);
int numvert = pointarray.Size() / 5;
paralleltop -> SetNV (numvert);
glob2loc_vert_ht.SetSize (3*numvert+1);
for ( int vert=0; vert<numvert; vert++ )
for (int vert = 0; vert < numvert; vert++)
{
int globvert = int (pointarray[ vert*5 ]);
paralleltop->SetLoc2Glob_Vert ( vert+1, globvert );
@ -99,16 +99,14 @@ namespace netgen
}
Array<int> dist_pnums;
MyMPI_Recv ( dist_pnums, 0);
MyMPI_Recv (dist_pnums, 0);
for (int hi = 0; hi < dist_pnums.Size(); hi += 3)
{
paralleltop ->
SetDistantPNum ( dist_pnums[hi+1], dist_pnums[hi], dist_pnums[hi+2]);
}
paralleltop ->
SetDistantPNum (dist_pnums[hi+1], dist_pnums[hi], dist_pnums[hi+2]);
}
if ( strcmp (st.c_str(), "volumeelements" ) == 0 )
if (strcmp (st.c_str(), "volumeelements" ) == 0 )
{
NgProfiler::RegionTimer reg(timer_els);
@ -117,7 +115,7 @@ namespace netgen
Element el;
Array<int> elarray;
MyMPI_Recv ( elarray, 0);
MyMPI_Recv (elarray, 0);
int ind = 0;
int elnum = 1;
@ -125,7 +123,7 @@ namespace netgen
paralleltop -> SetNE (nelloc);
while ( ind < elarray.Size() )
while (ind < elarray.Size())
{
paralleltop->SetLoc2Glob_VolEl ( elnum, elarray[ind++]);
@ -290,20 +288,20 @@ namespace netgen
NgProfiler::StartTimer (timerloc2);
CalcSurfacesOfNode ();
CalcSurfacesOfNode ();
NgProfiler::StopTimer (timerloc2);
// BuildConnectedNodes ();
// BuildConnectedNodes ();
topology -> Update();
topology -> Update();
// UpdateOverlap();
clusters -> Update();
clusters -> Update();
SetNextMajorTimeStamp();
SetNextMajorTimeStamp();
// paralleltop->Print();
// paralleltop->Print();
#ifdef SCALASCA
#pragma pomp inst end(loadmesh)
@ -816,7 +814,7 @@ namespace netgen
MPI_Request sendrequest[ntasks];
for ( int dest = 1; dest < ntasks; dest++)
for (int dest = 1; dest < ntasks; dest++)
MyMPI_Send ("mesh", dest);
// MPI_Barrier (MPI_COMM_WORLD);
@ -832,12 +830,12 @@ namespace netgen
int nedges = (GetTopology().GetNEdges());
int nfaces = GetTopology().GetNFaces();
int dim = dimension;
MPI_Bcast( &nel, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nv, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nedges, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nfaces, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &dim, 1, MPI_INT, 0, MPI_COMM_WORLD );
for ( int dest = 1; dest < ntasks; dest++ )
MPI_Bcast(&nel, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&nv, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&nedges, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&nfaces, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&dim, 1, MPI_INT, 0, MPI_COMM_WORLD );
for (int dest = 1; dest < ntasks; dest++)
MyMPI_Send (num_els_on_proc[dest], dest);

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,8 @@ namespace netgen
{
surfellist = 0;
linelist = 0;
clipplanelist = 0;
clipplanelist_scal = 0;
clipplanelist_vec = 0;
isolinelist = 0;
clipplane_isolinelist = 0;
surface_vector_list = 0;
@ -417,7 +418,12 @@ namespace netgen
}
if (showclipsolution)
glCallList (clipplanelist);
{
if (clipsolution == 1)
glCallList (clipplanelist_scal);
if (clipsolution == 2)
glCallList (clipplanelist_vec);
}
if (draw_fieldlines)
@ -696,31 +702,16 @@ namespace netgen
// lock->Lock();
}
if (clipplanelist)
glDeleteLists (clipplanelist, 1);
clipplanelist = glGenLists (1);
glNewList (clipplanelist, GL_COMPILE);
if (vispar.clipenable && clipsolution == 1 && sol)
{
glDisable(GL_CLIP_PLANE0);
DrawClipPlaneTrigs (); // sol, scalcomp);
Array<ClipPlaneTrig> cpt;
Array<ClipPlanePoint> pts;
GetClippingPlaneTrigs (cpt, pts);
glNormal3d (-clipplane[0], -clipplane[1], -clipplane[2]);
glColor3d (1.0, 1.0, 1.0);
SetTextureMode (usetexture);
DrawClipPlaneTrigs (sol, scalcomp, cpt, pts);
glEnable(GL_CLIP_PLANE0);
}
if (clipplanelist_vec)
glDeleteLists (clipplanelist_vec, 1);
clipplanelist_vec = glGenLists (1);
glNewList (clipplanelist_vec, GL_COMPILE);
if (vispar.clipenable && clipsolution == 2 && vsol)
{
@ -3719,10 +3710,65 @@ namespace netgen
void VisualSceneSolution ::
DrawClipPlaneTrigs (const SolData * sol, int comp,
const Array<ClipPlaneTrig> & trigs,
const Array<ClipPlanePoint> & points)
DrawClipPlaneTrigs () // const SolData * sol, int comp)
{
#ifdef PARALLELGL
if (id == 0 && ntasks > 1)
{
InitParallelGL();
Array<int> parlists (ntasks);
for ( int dest = 1; dest < ntasks; dest++ )
{
MyMPI_Send ("redraw", dest);
MyMPI_Send ("clipplanetrigs", dest);
}
for ( int dest = 1; dest < ntasks; dest++ )
MyMPI_Recv (parlists[dest], dest);
if (clipplanelist_scal)
glDeleteLists (clipplanelist_scal, 1);
clipplanelist_scal = glGenLists (1);
glNewList (clipplanelist_scal, GL_COMPILE);
for ( int dest = 1; dest < ntasks; dest++ )
glCallList (parlists[dest]);
glEndList();
return;
}
#endif
if (clipplanelist_scal)
glDeleteLists (clipplanelist_scal, 1);
clipplanelist_scal = glGenLists (1);
glNewList (clipplanelist_scal, GL_COMPILE);
Array<ClipPlaneTrig> trigs;
Array<ClipPlanePoint> points;
GetClippingPlaneTrigs (trigs, points);
glNormal3d (-clipplane[0], -clipplane[1], -clipplane[2]);
glColor3d (1.0, 1.0, 1.0);
SetTextureMode (usetexture);
SolData * sol = NULL;
if (scalfunction != -1)
sol = soldata[scalfunction];
glBegin (GL_TRIANGLES);
int maxlpnr = 0;
@ -3817,6 +3863,15 @@ namespace netgen
}
glEnd();
glEndList ();
#ifdef PARALLELGL
glFinish();
if (id > 0)
MyMPI_Send (clipplanelist_scal, 0);
#endif
}
@ -4058,6 +4113,11 @@ namespace netgen
MyMPI_Bcast (maxval);
MyMPI_Bcast (numisolines);
MyMPI_Bcast (subdivisions);
MyMPI_Bcast (clipplane[0]);
MyMPI_Bcast (clipplane[1]);
MyMPI_Bcast (clipplane[2]);
MyMPI_Bcast (clipplane[3]);
}
#endif
@ -4321,6 +4381,11 @@ namespace netgen
}
vsmesh.SetClippingPlane (); // for computing parameters
vssolution.SetClippingPlane (); // for computing parameters
glDisable(GL_CLIP_PLANE0);
#ifdef PARALLELGL
vsmesh.Broadcast ();
#endif

View File

@ -43,7 +43,8 @@ class VisualSceneSolution : public VisualScene
int surfellist;
int linelist;
int clipplanelist;
int clipplanelist_scal;
int clipplanelist_vec;
int isolinelist;
int clipplane_isolinelist;
int surface_vector_list;
@ -299,9 +300,7 @@ public:
double val1, double val2, double val3, double val4);
void DrawClipPlaneTrigs (const SolData * sol, int comp,
const Array<ClipPlaneTrig> & trigs,
const Array<ClipPlanePoint> & points);
void DrawClipPlaneTrigs (); // const SolData * sol, int comp);
void SetOpenGlColor(double val);

View File

@ -72,6 +72,7 @@ proc popupcheckredraw2 { vari boolvar { x 0 } } {
set varname 0
} {
Ng_SetVisParameters
Ng_Vis_Set parameters
if { $boolvar == 1 } { redraw }
Ng_SetVisParameters
}

View File

@ -249,11 +249,13 @@ void ParallelRun()
display = XOpenDisplay (displname.c_str());
/*
PrintMessage (3, "displ - name = ", displname);
PrintMessage (3, "display = ", display,
" display props: ",
" screen w = ", XDisplayWidth (display, 0),
" , h = ", XDisplayHeight (display, 0));
*/
Window win;
int wx, wy;
@ -328,7 +330,6 @@ void ParallelRun()
break;
}
}
if (!visinfo)
cerr << "no VISINFO found" << endl;
@ -365,26 +366,26 @@ void ParallelRun()
if (redraw_cmd == "linelist")
{
glXMakeCurrent (display, curDrawable, context);
// glXMakeCurrent (display, curDrawable, context);
vsmesh.BuildLineList();
glXMakeCurrent (display, None, NULL);
// glXMakeCurrent (display, None, NULL);
}
if (redraw_cmd == "filledlist")
{
glXMakeCurrent (display, curDrawable, context);
vsmesh.BuildFilledList (false);
glXMakeCurrent (display, None, NULL);
}
if (redraw_cmd == "solsurfellist")
{
glXMakeCurrent (display, curDrawable, context);
vssolution.DrawSurfaceElements();
glXMakeCurrent (display, None, NULL);
}
if (redraw_cmd == "clipplanetrigs")
{
vssolution.DrawClipPlaneTrigs();
}
}
#endif