Multiple ibv_contexts in a single process

I am using RDMA verbs in Mellanox OFED 5.x. I am wondering that whether it is safe to allocate multiple ibv_contexts for a Infiniband device by calling ibv_open_device() in a single process [i.e., a ibv_context per thread]. Is there any potential race/undefined behavior? Thank you.

Hello alogfans,

Thank you for posting your inquiry to the NVIDIA Developer Forums!

Using multiple contexts is possible within a single process (single threaded), or a multi-threaded application; however, it is not necessary. libibverbs is thread-safe. The below blog post goes into more detail on thread-safe functions/features, locking mechanisms, and internal implementation:

If you’re in need of further development assistance, or require assistance in building out a deployment, I would highly recommend engaging your account team. They can help put you in touch with resources within our Solutions and Engineering team, and provide you with a support bundle to suit your needs.

Have a great day,
NVIDIA Networking Support

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.