1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page dwx_hello_world Hello World Application
5 The following minimal tutorial will guide through writing and building your first NVIDIA<sup>®</sup> DriveWorks based application on a Linux desktop machine.
9 The first thing to do when building an application based on DriveWorks is to initialize its context:
11 dwContextHandle_t sdk = DW_NULL_HANDLE;
12 dwContextParameters sdkParams = {};
14 dwGetVersion(&sdkVersion);
15 dwInitialize(&sdk, sdkVersion, &sdkParams);
18 The header for the context can be included as:
20 #include <dw/core/context/Context.h>
23 Now we can for example figure out how many GPUs are available on the host machine:
26 dwContext_getGPUCount(&gpuCount, sdk);
27 std::cout << "Available GPUs: " << gpuCount << std::endl;
30 Last thing to do before exiting the program is to release the context:
35 For your reference this is what the full program will look like:
38 #include <dw/core/context/Context.h>
40 int main(int argc, char **argv)
43 dwContextHandle_t sdk = DW_NULL_HANDLE;
45 // instantiate Driveworks SDK context
46 dwContextParameters sdkParams = {};
48 dwGetVersion(&sdkVersion);
49 dwInitialize(&sdk, sdkVersion, &sdkParams);
51 std::cout << "Context of Driveworks SDK successfully initialized." <<std::endl;
52 std::cout << "Version: " << sdkVersion.major << "." << sdkVersion.minor << "." << sdkVersion.patch << std::endl;
55 dwContext_getGPUCount(&gpuCount, sdk);
56 std::cout << "Available GPUs: " << gpuCount << std::endl;
58 // release Driveworks SDK context
65 ## Building and Executing
67 This application can be built with gcc using the following command:
69 gcc -I/usr/local/driveworks/include/ -I/usr/local/cuda/include helloworld.cpp -ldriveworks -L/usr/local/driveworks/lib/ -lstdc++ -o helloworld
71 Afterwords when executing <b>./helloworld</b> you should get an output similiar to:
73 Context of Driveworks SDK successfully initialized.
77 @note An extended version of this hello world application is provided, for more information see @ref dwx_hello_world_sample.
78 @note For more complex examples please refer to @ref dwx_samples_section.