Skip to content

Question about multi streams operate the same QP and CQ #48

Open

Description

@Hannah-xxl

If I use multiple streams in different threads to operate the same SQ or SCQ, how to make sure to get the right DB or CQ values ? Thanks for your answer

Activity

  1. drossetti commented on Apr 9, 2018

    @drossetti
    Contributor

    This is a very complex topic. The descriptors must be submitted to the CUDA streams in such a way that they will be triggered in the expected order, I.e. the same one in which they have been gotten back from the APIs.

  2. Hannah-xxl commented on Apr 10, 2018

    @Hannah-xxl
    Author

    Thank you for your answer. I wonder if using spin lock before exp post for SQ and unlock after getting the descriptors for SCQ can resolve this problem about accessing the same SQ and SCQ ?
    I am not sure...

  3. drossetti commented on Apr 14, 2018

    @drossetti
    Contributor

    note that libgdsync APIs are not thread safe, due to the use of custom res_domain.
    CPU locks would only protect the calls to IB verbs API and would result in a certain sequence of network descriptors.
    But the order in which the descriptor are triggered by the GPU can be different.

  4. Hannah-xxl commented on Apr 20, 2018

    @Hannah-xxl
    Author

    "But the order in which the descriptor are triggered by the GPU can be different."

    Does the problem which you mean lead to the NIC confusing about which WQE to send or which CQE to poll ? Because I want to use gds in a scene that multi-streams from multi-threads operate the only one SQ and SCQ, so the problem most concerns me is this issue.

  5. drossetti commented on Apr 23, 2018

    @drossetti
    Contributor

    yes triggering descriptor in the wrong order can confuse the NIC, e.g. GPU triggers desc n.2 before n.1 that would make the NIC to send both 1 and 2, and later when GPU triggers n.1 the NIC would be confused.

  6. Hannah-xxl commented on Apr 26, 2018

    @Hannah-xxl
    Author

    Thank you very much for your conclusion.
    During these days I wrote a sample to verify this issue. GPU server will create some threads which send msg on different stream to the same SQ and poll the cqe from the matching SCQ. Client will wait for all replies from each server thread. Testing with this demo, I find that it can't work normally when more than two (not including two) threads or streams exist even though all threads are joined successfully. The server hang with getting not_ready_event of some streams with cuEventQuery and the client can't recv all notifiers from server threads.
    The problem of client is caused by what you said I think. But I don't know what's the reason of server's hang with getting not_ready_event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions