diff --git a/libsrc/general/mpi_interface.cpp b/libsrc/general/mpi_interface.cpp index 36df5542..8ea6a3c5 100644 --- a/libsrc/general/mpi_interface.cpp +++ b/libsrc/general/mpi_interface.cpp @@ -16,35 +16,29 @@ namespace netgen void MyMPI_SendCmd (const char * cmd) { - char buf[10000]; - strcpy (buf, cmd); - // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); + int ntasks; + MPI_Comm_size(MPI_COMM_WORLD, &ntasks); + if(ntasks==1) + return; + for (int dest = 1; dest < ntasks; dest++) - MPI_Send( &buf, 10000, MPI_CHAR, dest, MPI_TAG_CMD, MPI_COMM_WORLD); + MPI_Send( cmd, (strlen(cmd)+1), MPI_CHAR, dest, MPI_TAG_CMD, MPI_COMM_WORLD); } string MyMPI_RecvCmd () { - char buf[10000]; - // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); - - // VT_OFF(); MPI_Status status; int flag; - do - { - MPI_Iprobe (0, MPI_TAG_CMD, MPI_COMM_WORLD, &flag, &status); - if (!flag) - { - VT_TRACER ("sleep"); - usleep (1000); - } - } - while (!flag); - // VT_ON(); + int size_of_msg = -1; - MPI_Recv( &buf, 10000, MPI_CHAR, 0, MPI_TAG_CMD, MPI_COMM_WORLD, &status); + MPI_Probe(0, MPI_TAG_CMD, MPI_COMM_WORLD, &status); + MPI_Get_count(&status, MPI_CHAR, &size_of_msg); + + //char* buf = (char*)malloc(size_of_msg*sizeof(char)); + char buf[100000]; //1MB should be enough... + + MPI_Recv( &buf, size_of_msg, MPI_CHAR, 0, MPI_TAG_CMD, MPI_COMM_WORLD, &status); return string(buf); } diff --git a/libsrc/visualization/vssolution.hpp b/libsrc/visualization/vssolution.hpp index 80cf1c5b..d8193d56 100644 --- a/libsrc/visualization/vssolution.hpp +++ b/libsrc/visualization/vssolution.hpp @@ -43,7 +43,7 @@ class DLL_HEADER VisualSceneSolution : public VisualScene Point<3> p; }; -#define USE_BUFFERS + // #define USE_BUFFERS #ifdef USE_BUFFERS bool has_surfel_vbo = false; GLuint surfel_vbo[4]; //