diff --git a/libsrc/general/mpi_interface.cpp b/libsrc/general/mpi_interface.cpp index 57d69ab9..36df5542 100644 --- a/libsrc/general/mpi_interface.cpp +++ b/libsrc/general/mpi_interface.cpp @@ -16,17 +16,17 @@ namespace netgen void MyMPI_SendCmd (const char * cmd) { - char buf[100]; + char buf[10000]; strcpy (buf, cmd); // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); 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 () { - char buf[100]; + char buf[10000]; // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); // VT_OFF(); @@ -44,7 +44,7 @@ namespace netgen while (!flag); // 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); } diff --git a/libsrc/visualization/mvdraw.cpp b/libsrc/visualization/mvdraw.cpp index 06e8b7e8..04d98e6c 100644 --- a/libsrc/visualization/mvdraw.cpp +++ b/libsrc/visualization/mvdraw.cpp @@ -776,13 +776,16 @@ namespace netgen { string displname; - // Display * dpy = glXGetCurrentDisplay(); + Display * dpy = glXGetCurrentDisplay(); GLXDrawable drawable = glXGetCurrentDrawable(); GLXContext ctx = glXGetCurrentContext(); GLXContextID xid = glXGetContextIDEXT (ctx); 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 << "DisplayName = " << displname << endl; diff --git a/ng/parallelfunc.cpp b/ng/parallelfunc.cpp index 2efb0259..d3e6d7d7 100644 --- a/ng/parallelfunc.cpp +++ b/ng/parallelfunc.cpp @@ -138,7 +138,7 @@ void ParallelRun() string redraw_cmd; // MyMPI_Recv (redraw_cmd, 0, MPI_TAG_VIS); redraw_cmd = MyMPI_RecvCmd(); - + // PrintMessage (1, "Redraw - ", redraw_cmd); static string displname; @@ -147,17 +147,17 @@ void ParallelRun() static Display * display = NULL; static GLXContext context; static XVisualInfo * visinfo = 0; - + // if (!display) if (redraw_cmd == "init") { MyMPI_Recv (displname, 0, MPI_TAG_VIS); MyMPI_Recv (curDrawable, 0, MPI_TAG_VIS); MyMPI_Recv (contextid, 0, MPI_TAG_VIS); - + display = XOpenDisplay (displname.c_str()); - + /* PrintMessage (3, "displ - name = ", displname); PrintMessage (3, "display = ", display, @@ -166,23 +166,27 @@ void ParallelRun() " , h = ", XDisplayHeight (display, 0)); */ - Window win; - int wx, wy; - unsigned int ww, wh, bw, depth; - // cout << "got drawable: " << curDrawable << endl; - - XGetGeometry(display, curDrawable, &win, - &wx, &wy, &ww, &wh, - &bw, &depth); - /* + Window win; + int wx, wy; + unsigned int ww, wh, bw, depth; + cout << "got drawable: " << curDrawable << ", contextid: " << contextid << endl; + + cout << "get geometriy..." << endl; + XGetGeometry(display, curDrawable, &win, + &wx, &wy, &ww, &wh, + &bw, &depth); + cout << "have!" << endl; + cout << "P" << id << ": window-props: x = " << wx << ", y = " << wy << ", w = " << ww << ", h = " << wh << ", depth = " << depth << endl; */ - + #define VISUAL #ifdef VISUAL - + +#ifdef VISINFO_OLD + //this does not seem to work anymore (but might still be with togl1.7?) // make a new GLXContext // first, generate a visual (copied from togl) @@ -221,51 +225,68 @@ void ParallelRun() attrib_list[attrib_count++] = GLX_DOUBLEBUFFER; attrib_list[attrib_count++] = None; - + visinfo = glXChooseVisual(display, 0, attrib_list); + cout << "have vis?" << endl; + if (visinfo) { /* found a GLX visual! */ // cout << "found VISINFO !!!" << endl; + cout << "found VISINFO !!!" << endl; /* - int hi = 0; - std::cout << "attribs = "; - while (attrib_list[hi] != None) + int hi = 0; + std::cout << "attribs = "; + while (attrib_list[hi] != None) std::cout << attrib_list[hi++] << " "; - std::cout << std::endl; + std::cout << std::endl; */ - + break; } } if (!visinfo) cerr << "no VISINFO found" << endl; +#else + //get all possible confs + int nconfs; + auto cptr = glXGetFBConfigs (display,0, &nconfs); + Array conf_ids(nconfs); + for(int k=0;kFBConfig->visual + unsigned int d_fbc_id; + glXQueryDrawable( display, curDrawable, GLX_FBCONFIG_ID, &d_fbc_id); + GLXFBConfig d_fbc; + for(int k=0;k