Ejemplo n.º 1
0
static int collectLibsCallback
(
    struct dl_phdr_info *info,
    size_t size,
    void *data
)
{
    Foam::DynamicList<Foam::fileName>* ptr =
        reinterpret_cast<Foam::DynamicList<Foam::fileName>*>(data);
    ptr->append(info->dlpi_name);
    return 0;
}
Ejemplo n.º 2
0
bool Foam::OPstream::finishedRequest(const label i)
{
    if (i >= OPstream_outstandingRequests_.size())
    {
        FatalErrorIn
        (
            "OPstream::finishedRequest(const label)"
        )   << "There are " << OPstream_outstandingRequests_.size()
            << " outstanding send requests and you are asking for i=" << i
            << nl
            << "Maybe you are mixing blocking/non-blocking comms?"
            << Foam::abort(FatalError);
    }

    int flag;
    MPI_Test(&OPstream_outstandingRequests_[i], &flag, MPI_STATUS_IGNORE);

    return flag != 0;
}
Ejemplo n.º 3
0
void Foam::OPstream::waitRequests()
{
    if (OPstream_outstandingRequests_.size())
    {
        if
        (
            MPI_Waitall
            (
                OPstream_outstandingRequests_.size(),
                OPstream_outstandingRequests_.begin(),
                MPI_STATUSES_IGNORE
            )
        )
        {
            FatalErrorIn
            (
                "OPstream::waitRequests()"
            )   << "MPI_Waitall returned with error" << Foam::endl;
        }

        OPstream_outstandingRequests_.clear();
    }
}
Ejemplo n.º 4
0
bool Foam::OPstream::write
(
    const commsTypes commsType,
    const int toProcNo,
    const char* buf,
    const std::streamsize bufSize
)
{
    bool transferFailed = true;

    if (commsType == blocking)
    {
        transferFailed = MPI_Bsend
        (
            const_cast<char*>(buf),
            bufSize,
            MPI_PACKED,
            procID(toProcNo),
            msgType(),
            MPI_COMM_WORLD
        );
    }
    else if (commsType == scheduled)
    {
        transferFailed = MPI_Send
        (
            const_cast<char*>(buf),
            bufSize,
            MPI_PACKED,
            procID(toProcNo),
            msgType(),
            MPI_COMM_WORLD
        );
    }
    else if (commsType == nonBlocking)
    {
        MPI_Request request;

        transferFailed = MPI_Isend
        (
            const_cast<char*>(buf),
            bufSize,
            MPI_PACKED,
            procID(toProcNo),
            msgType(),
            MPI_COMM_WORLD,
            &request
        );

        OPstream_outstandingRequests_.append(request);
    }
    else
    {
        FatalErrorIn
        (
            "OPstream::write"
            "(const int fromProcNo, char* buf, std::streamsize bufSize)"
        )   << "Unsupported communications type " << commsType
            << Foam::abort(FatalError);
    }

    return !transferFailed;
}