Exemplo n.º 1
0
void
SimEngineManager::ReadDataObjectString(avtDataObjectReader_p rdr, 
    SimEngineManager::DOString &dos)
{
#if defined(PARALLEL) && defined(TEMPORARILY_FORCE_SAME_DATA_IN_VIEWER)
    BroadcastInt(dos.size);
    if(!PAR_UIProcess())
        dos.buffer = new char[dos.size];
    MPI_Bcast(dos.buffer, dos.size, MPI_CHAR, 0, VISIT_MPI_COMM);
#endif

    rdr->Read(dos.size, dos.buffer);
}
Exemplo n.º 2
0
void
MPIXfer::Update(Subject *TheChangedSubject)
{
    // We only do this until we know how to merge replies....
    if (!PAR_UIProcess())
        return;

    if (output == NULL)
        return;

    AttributeSubject *subject = (AttributeSubject *)TheChangedSubject;

    // Write out the subject's guido and message size.
    output->WriteInt(subject->GetGuido());
    output->WriteInt(subject->CalculateMessageSize(*output));

    // Write the things about the subject that have changed onto the
    // output connection and flush it out to make sure it's sent.
    subject->Write(*output);
    output->Flush();
}
Exemplo n.º 3
0
void
MPIXfer::SendInterruption(int mpiInterruptTag)
{
    if (PAR_UIProcess())
    {
        // Do a nonblocking send to all processes to do it quickly
        int size = PAR_Size();
        unsigned char buf[1] = {255};
        MPI_Request *request = new MPI_Request[size-1];
        for (int i=1; i<size; i++)
        {
            MPI_Isend(buf, 1, MPI_CHAR, i, mpiInterruptTag, VISIT_MPI_COMM, &request[i-1]);
        }

        // Then wait for them all to read the command
        MPI_Status *status = new MPI_Status[size-1];
        MPI_Waitall(size-1, request, status);

        delete [] request;
        delete [] status;
    }
}
Exemplo n.º 4
0
void
MPIXfer::Process()
{
    ReadPendingMessages();

    // While there are complete messages, read and process them.
    while(bufferedInput.Size() > 0)
    {
        int curOpcode;
        int curLength;
        bufferedInput.ReadInt(&curOpcode);
        bufferedInput.ReadInt(&curLength);

        if(subjectList[curOpcode])
        {
            if(PAR_UIProcess())
            {
                int i, msgLength = curLength + sizeof(int)*2;
#ifdef VISIT_BLUE_GENE_P
                // Make the buffer be 32-byte aligned
                unsigned char *buf = 0;
                posix_memalign((void **)&buf, 32, msgLength);
#else
                unsigned char *buf = (unsigned char*)malloc(msgLength * sizeof(unsigned char));
#endif
                unsigned char *tmp = buf;

                // Add the message's opcode and length into the buffer
                // that we'll broadcast to other processes so their
                // Xfer objects know what's up.
                unsigned char *cptr = (unsigned char *)&curOpcode;
                for(i = 0; i < sizeof(int); ++i)
                    *tmp++ = *cptr++;
                cptr = (unsigned char *)&curLength;
                for(i = 0; i < sizeof(int); ++i)
                    *tmp++ = *cptr++;

                // Transcribe the message into a buffer that we'll
                // communicate to other processes and also a new
                // temporary connection that we'll feed to the interested
                // object.
                BufferConnection newInput;
                unsigned char c;
                for(i = curLength; i > 0; --i)
                {
                    // Read a character from the input connection.
                    bufferedInput.ReadChar(&c);

                    *tmp++ = c;
                    newInput.WriteChar(c);
                }

                // Send the current opcode and message length. Note that we
                // use VisIt_MPI_Bcast for this call since we need to match
                // what's happening in PAR_EventLoop in the engine. This version
                // of bcast allows engines to reduce their activity instead of
                // using a spin-wait bcast.
                if (slaveProcessInstruction)
                    slaveProcessInstruction();
                VisIt_MPI_Bcast((void *)&msgLength, 1, MPI_INT,
                                0, VISIT_MPI_COMM);

                // Use regular bcast since the previous call to bcast will
                // already have gotten the attention of the other processors.
                MPI_Bcast((void *)buf, msgLength, MPI_UNSIGNED_CHAR,
                          0, VISIT_MPI_COMM);
                free(buf);

                // Read the object from the newInput into its local copy.
                subjectList[curOpcode]->Read(newInput);
            }
            else
            {
                // Non-UI Processes can read the object from *input.
                subjectList[curOpcode]->Read(bufferedInput);
            }

            // Indicate that we want Xfer to ignore update messages if
            // it gets them while processing the Notify.
            SetUpdate(false);
            subjectList[curOpcode]->Notify();
        }
    }
}