DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Hello World Application
Note
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

The following minimal tutorial will guide through writing and building your first NVIDIA® DriveWorks based application on a Linux desktop machine.

Coding

The first thing to do when building an application based on DriveWorks is to initialize its context:

dwContextParameters sdkParams = {};
dwVersion sdkVersion;
dwGetVersion(&sdkVersion);
dwInitialize(&sdk, sdkVersion, &sdkParams);

The header for the context can be included as:

Now we can for example figure out how many GPUs are available on the host machine:

int32_t gpuCount;
dwContext_getGPUCount(&gpuCount, sdk);
std::cout << "Available GPUs: " << gpuCount << std::endl;

Last thing to do before exiting the program is to release the context:

dwRelease(&sdk);

For your reference this is what the full program will look like:

#include <iostream>
int main(int argc, char **argv)
{
// instantiate Driveworks SDK context
dwContextParameters sdkParams = {};
dwVersion sdkVersion;
dwGetVersion(&sdkVersion);
dwInitialize(&sdk, sdkVersion, &sdkParams);
std::cout << "Context of Driveworks SDK successfully initialized." <<std::endl;
std::cout << "Version: " << sdkVersion.major << "." << sdkVersion.minor << "." << sdkVersion.patch << std::endl;
int32_t gpuCount;
dwContext_getGPUCount(&gpuCount, sdk);
std::cout << "Available GPUs: " << gpuCount << std::endl;
// release Driveworks SDK context
dwRelease(&sdk);
return 0;
}

Building and Executing

This application can be built with gcc using the following command:

    gcc -I/usr/local/driveworks/include/ -I/usr/local/cuda/include helloworld.cpp -ldriveworks -L/usr/local/driveworks/lib/ -lstdc++ -o helloworld

Afterwords when executing ./helloworld you should get an output similiar to:

    Context of Driveworks SDK successfully initialized.
    Version: 1.0.218
    Available GPUs: 1
Note
An extended version of this hello world application is provided, for more information see Hello World Sample.
For more complex examples please refer to Samples.