Usage Details Using Thread-Safe and Contexts-Domains Extensions
Figure 4 shows the basic usage details of extensions associated with the two proposals.
Fig. 4. Basic usage details of thread-safe and contexts-domains extensions
With the Thread-Safe feature, we register threads and then use normal RMA and AMO routines which are now thread-safe as a result of the combination shmemx_init_thread and shmemx_thread_register. Finally, we unregister the threads and exit after usage.
With the Contexts-Domains feature, any thread can create domain and context objects and make them visible to other threads. Any thread can pick these objects and use them for context-based communications. Threads involved in context and domain object creation or context-based communication operations need not be registered.
Thread-Safe APIs and Contexts-Domains APIs can be used in the same application, though not in the same SHMEM threaded region. Threads and contexts are two separate entities in an application. That said, even registered threads can make use of the context objects.