NvSciEventService API Usage

NvSciEventService is an event-driven framework that provides OS-agnostic APIs to send events and wait for events. The framework enables you to build portable event-driven applications and simplifies the steps required to prepare endpoint connections.

Initializing the NvSciEventService Library

Each application must call NvSciEventLoopServiceCreateSafe() before using any of the other NvSciEventService and NvSciIpc APIs. This call initializes the NvSciEventService library instance for the application.

Note:

NvSciEventLoopServiceCreateSafe() must be called by the application only once at startup. Only single loop service is currently supported.

NvSciEventLoopService *eventLoopService;
NvSciError err;
err = NvSciEventLoopServiceCreateSafe(1, NULL, &eventLoopService);
if (err != NvSciError_Success) {
        goto fail;
}
err = NvSciIpcInit();
if (err != NvSciError_Success) {
        return err;

Update System Resource

NvSciIpc must open endpoint-related resources, such as shared memory, message queues, and device node. When the number of endpoints increases, the number resources to open also increases, which can exceed the system resource limit, leading to NvSciIpc failure at initialization.

These two system resources matter:
  • RLIMIT_NOFILE – maximum number of files to open
  • RLIMIT_MSGQUEUE – maximum number bytes to be allocated for message queue

They can be increased in /etc/security/limits.conf.

$cat /etc/security/limits.conf
* hard nofile 32768
* soft nofile 32768
* hard msgqueue 18874368
* soft msgqueue 18874368
root hard msgqueue 18874368
root soft msgqueue 18874368
  
#Check your current resource limits using "ulimit -a" command then compare it to above settings.
#If your limits are lower than recommended values, you have to update them.
$sudo sed -i '$ a * hard nofile 32768' /etc/security/limits.conf
$sudo sed -i '$ a * soft nofile 32768' /etc/security/limits.conf
$sudo sed -i '$ a * hard msgqueue 18874368' /etc/security/limits.conf
$sudo sed -i '$ a * soft msgqueue 18874368' /etc/security/limits.conf
$sudo sed -i '$ a root hard msgqueue 18874368' /etc/security/limits.conf
$sudo sed -i '$ a root soft msgqueue 18874368' /etc/security/limits.conf
Note:

Existing sessions retain old limit values.

To apply new limits, reboot the system or use a new session (login).

/etc/security/limits.d/nofile.conf overrides settings in the /etc/security/limits.conf during booting time.