Merge branch 'par_fixes' into 'master'

Par fixes

- Increased buffer size in send/recv command (needed for sending python files, see ngsolve merge request)
- Fixed mpi-parallel visualization
- Added warning if using direct rendering + mpi (which probably breaks in most cases)

See merge request !10
This commit is contained in:
Joachim Schöberl 2016-11-10 11:55:03 +01:00
commit c6196dcb91
3 changed files with 56 additions and 33 deletions

View File

@ -16,17 +16,17 @@ namespace netgen
void MyMPI_SendCmd (const char * cmd) void MyMPI_SendCmd (const char * cmd)
{ {
char buf[100]; char buf[10000];
strcpy (buf, cmd); strcpy (buf, cmd);
// MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD);
for (int dest = 1; dest < ntasks; dest++) for (int dest = 1; dest < ntasks; dest++)
MPI_Bsend( &buf, 100, MPI_CHAR, dest, MPI_TAG_CMD, MPI_COMM_WORLD); MPI_Send( &buf, 10000, MPI_CHAR, dest, MPI_TAG_CMD, MPI_COMM_WORLD);
} }
string MyMPI_RecvCmd () string MyMPI_RecvCmd ()
{ {
char buf[100]; char buf[10000];
// MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD);
// VT_OFF(); // VT_OFF();
@ -44,7 +44,7 @@ namespace netgen
while (!flag); while (!flag);
// VT_ON(); // VT_ON();
MPI_Recv( &buf, 100, MPI_CHAR, 0, MPI_TAG_CMD, MPI_COMM_WORLD, &status); MPI_Recv( &buf, 10000, MPI_CHAR, 0, MPI_TAG_CMD, MPI_COMM_WORLD, &status);
return string(buf); return string(buf);
} }

View File

@ -776,13 +776,16 @@ namespace netgen
{ {
string displname; string displname;
// Display * dpy = glXGetCurrentDisplay(); Display * dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable(); GLXDrawable drawable = glXGetCurrentDrawable();
GLXContext ctx = glXGetCurrentContext(); GLXContext ctx = glXGetCurrentContext();
GLXContextID xid = glXGetContextIDEXT (ctx); GLXContextID xid = glXGetContextIDEXT (ctx);
displname = XDisplayName (0); displname = XDisplayName (0);
if( glXIsDirect ( dpy, ctx ) )
cout << "WARNING: direct rendering enabled; this might break mpi-parallel netgen (especially if X-forwarding is used! (to disable, change -indirect to true in ng/drawing.tcl)" << endl;
/* /*
cout << "Init Parallel GL" << endl; cout << "Init Parallel GL" << endl;
cout << "DisplayName = " << displname << endl; cout << "DisplayName = " << displname << endl;

View File

@ -166,16 +166,18 @@ void ParallelRun()
" , h = ", XDisplayHeight (display, 0)); " , h = ", XDisplayHeight (display, 0));
*/ */
/*
Window win; Window win;
int wx, wy; int wx, wy;
unsigned int ww, wh, bw, depth; unsigned int ww, wh, bw, depth;
// cout << "got drawable: " << curDrawable << endl; cout << "got drawable: " << curDrawable << ", contextid: " << contextid << endl;
cout << "get geometriy..." << endl;
XGetGeometry(display, curDrawable, &win, XGetGeometry(display, curDrawable, &win,
&wx, &wy, &ww, &wh, &wx, &wy, &ww, &wh,
&bw, &depth); &bw, &depth);
cout << "have!" << endl;
/*
cout << "P" << id << ": window-props: x = " << wx << ", y = " << wy cout << "P" << id << ": window-props: x = " << wx << ", y = " << wy
<< ", w = " << ww << ", h = " << wh << ", depth = " << depth << endl; << ", w = " << ww << ", h = " << wh << ", depth = " << depth << endl;
*/ */
@ -183,6 +185,8 @@ void ParallelRun()
#define VISUAL #define VISUAL
#ifdef VISUAL #ifdef VISUAL
#ifdef VISINFO_OLD
//this does not seem to work anymore (but might still be with togl1.7?)
// make a new GLXContext // make a new GLXContext
// first, generate a visual (copied from togl) // first, generate a visual (copied from togl)
@ -224,9 +228,12 @@ void ParallelRun()
visinfo = glXChooseVisual(display, 0, visinfo = glXChooseVisual(display, 0,
attrib_list); attrib_list);
cout << "have vis?" << endl;
if (visinfo) { if (visinfo) {
/* found a GLX visual! */ /* found a GLX visual! */
// cout << "found VISINFO !!!" << endl; // cout << "found VISINFO !!!" << endl;
cout << "found VISINFO !!!" << endl;
/* /*
int hi = 0; int hi = 0;
@ -242,10 +249,26 @@ void ParallelRun()
if (!visinfo) if (!visinfo)
cerr << "no VISINFO found" << endl; cerr << "no VISINFO found" << endl;
#else
//get all possible confs
int nconfs;
auto cptr = glXGetFBConfigs (display,0, &nconfs);
Array<int> conf_ids(nconfs);
for(int k=0;k<nconfs;k++)
glXGetFBConfigAttrib(display, cptr[k], GLX_FBCONFIG_ID, &(conf_ids[k]));
//get drawable->FBConfig->visual
unsigned int d_fbc_id;
glXQueryDrawable( display, curDrawable, GLX_FBCONFIG_ID, &d_fbc_id);
GLXFBConfig d_fbc;
for(int k=0;k<nconfs;k++)
if(d_fbc_id==conf_ids[k])
d_fbc = cptr[k];
visinfo = glXGetVisualFromFBConfig(display,d_fbc);
#endif
// context = glXCreateContext( display, visinfo, 0, /* curContext, */ False ); // context = glXCreateContext( display, visinfo, 0, /* curContext, */ False );
context = glXCreateContext( display, visinfo, glXImportContextEXT ( display, contextid ), False); context = glXCreateContext( display, visinfo, glXImportContextEXT ( display, contextid ), False);
// cout << "context = " << context << endl;
glXMakeCurrent (display, curDrawable, context); glXMakeCurrent (display, curDrawable, context);
@ -255,11 +278,9 @@ void ParallelRun()
context = glXImportContextEXT ( display, contextid ); context = glXImportContextEXT ( display, contextid );
PrintMessage (1, "GLX-contextid = " , contextid, PrintMessage (1, "GLX-contextid = " , contextid,
" imported context ", context); " imported context ", context);
glXMakeCurrent (display, curDrawable, context); glXMakeCurrent (display, curDrawable, context);
#endif #endif
@ -283,7 +304,6 @@ void ParallelRun()
vsmesh.BuildFilledList (false); vsmesh.BuildFilledList (false);
} }
if (redraw_cmd == "solsurfellist") if (redraw_cmd == "solsurfellist")
{ {
vssolution.DrawSurfaceElements(); vssolution.DrawSurfaceElements();