Function: notify_get_export_key
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
x |
Description
Sets the specified Notify in this process to IPC (Inter-Process Communication) Notify and returns the key (that is, the Notify shared name) to implement task synchronization between different processes on multiple devices. Before calling this API, you need to call the acl.rt.device_enable_peer_access API to enable data interaction between two devices.
This API needs to work with other key APIs to synchronize tasks between different processes on multiple devices. The following uses process A on device 0 and process B on device 1 as an example to describe the process of calling this API.
- In process A:
- Call acl.rt.create_notify to create a Notify.
- Call acl.rt.notify_get_export_key to export the key (Notify share name).
- Obtain the ID of process B and call the acl.rt.notify_set_import_pid API to add the ID of process B to the whitelist.
- Call the acl.rt.wait_and_reset_notify API to deliver a waiting task.
- Call acl.rt.destroy_notify to destroy the Notify. All processes involving IPC Notify need to release Notify. Notify is released only after all processes involving IPC Notify complete the release operation.
- In process B:
- Call acl.rt.device_get_bare_tgid to obtain the ID of process B. This API adapts to both physical machines and VMs when obtaining the process ID. You only need to call this API to obtain the process ID and use the API with other APIs to share memory. If you do not call this API to obtain the process ID, an exception may occur when you use the process ID.
- Call acl.rt.notify_import_by_key to obtain the key information and return the Notify pointer that can be used by the current process. Before calling acl.rt.notify_import_by_key, ensure that IPC Notify cannot be released in advance.
- Call acl.rt.record_notify to deliver a record task.
- Call acl.rt.destroy_notify to destroy the Notify.
Prototype
- C Prototype
aclError aclrtNotifyGetExportKey(aclrtNotify notify, char *key, size_t len, uint64_t flag)
- Python Function
1key, ret = acl.rt.notify_get_export_key(notify, len, flags)
Parameters
Parameter |
Description |
|---|---|
notify |
Int, pointer address of the Notify. |
len |
Int, length of the Notify share name. The minimum value is 65. |
flags |
Int, whether to enable process trustlist verification. The options are as follows:
|
Return Value
Return Value |
Description |
|---|---|
key |
Str, Notify share name. |
ret |
Int, 0 on success; else, failure. |
Restrictions
This operation is not supported in the Ascend virtual instance scenario.