|
| 1 | +# Using the GPU<a name="applications-gpuaccess"></a> |
| 2 | + |
| 3 | +You can access the graphics processor \(GPU\) on the AWS Panorama Appliance to use GPU\-accelerated libraries, or run machine learning models in your application code\. To turn on GPU access, you add GPU access as a requirement to the package configuration after building your application code container\. |
| 4 | + |
| 5 | +**Important** |
| 6 | +If you enable GPU access, you can't run model nodes in any application on the appliance\. For security purposes, GPU access is restricted when the appliance runs a model compiled with SageMaker Neo\. With GPU access, you must run your models in application code nodes, and all applications on the device share access to the GPU\. |
| 7 | + |
| 8 | +To turn on GPU access for your application, update the [package manifest](applications-packages.md) after you build the package with the AWS Panorama Application CLI\. The following example shows the `requirements` block that adds GPU access to the application code node\. |
| 9 | + |
| 10 | +**Example package\.json with requirements block** |
| 11 | + |
| 12 | +``` |
| 13 | +{ |
| 14 | + "nodePackage": { |
| 15 | + "envelopeVersion": "2021-01-01", |
| 16 | + "name": "SAMPLE_CODE", |
| 17 | + "version": "1.0", |
| 18 | + "description": "Computer vision application code.", |
| 19 | + "assets": [ |
| 20 | + { |
| 21 | + "name": "code_asset", |
| 22 | + "implementations": [ |
| 23 | + { |
| 24 | + "type": "container", |
| 25 | + "assetUri": "eba3xmpl71aa387e8f89be9a8c396416cdb80a717bb32103c957a8bf41440b12.tar.gz", |
| 26 | + "descriptorUri": "4abdxmpl5a6f047d2b3047adde44704759d13f0126c00ed9b4309726f6bb43400ba9.json", |
| 27 | + "requirements": [ |
| 28 | + { |
| 29 | + "type": "hardware_access", |
| 30 | + "inferenceAccelerators": [ |
| 31 | + { |
| 32 | + "deviceType": "nvhost_gpu", |
| 33 | + "accessType": "open" |
| 34 | + } |
| 35 | + ] |
| 36 | + } |
| 37 | + ] |
| 38 | + } |
| 39 | + ] |
| 40 | + } |
| 41 | + ], |
| 42 | + "interfaces": [ |
| 43 | + ... |
| 44 | +``` |
| 45 | + |
| 46 | +Update the package manifest between the build and packaging steps in your development workflow\. |
| 47 | + |
| 48 | +**To deploy an application with GPU access** |
| 49 | + |
| 50 | +1. To build the application container, use the `build-container` command\. |
| 51 | + |
| 52 | + ``` |
| 53 | + $ panorama-cli build-container --container-asset-name code_asset --package-path packages/123456789012-SAMPLE_CODE-1.0 |
| 54 | + ``` |
| 55 | + |
| 56 | +1. Add the `requirements` block to the package manifest\. |
| 57 | + |
| 58 | +1. To upload the container asset and package manifest, use the `package-application` command\. |
| 59 | + |
| 60 | + ``` |
| 61 | + $ panorama-cli package-application |
| 62 | + ``` |
| 63 | + |
| 64 | +1. Deploy the application\. |
| 65 | + |
| 66 | +For sample applications that use GPU access, visit the [aws\-panorama\-samples](https://github.com/aws-samples/aws-panorama-samples) GitHub repository\. |
0 commit comments