Changed MyMPI_RecvCmd and MyMPI_SendCmd. Disabled USE_BUFFERS for now.

This commit is contained in:
lkogler 2017-03-06 14:32:20 +01:00
parent dc1fb0a947
commit 383ced496b
2 changed files with 15 additions and 21 deletions

View File

@ -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);
}

View File

@ -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]; //