Last active
February 3, 2026 20:23
-
-
Save dacr/b6cb0b6f61e507dac8bcf34231308d82 to your computer and use it in GitHub Desktop.
get some gpu information / published by https://github.com/dacr/code-examples-manager #2823b304-e6a7-47fb-80b2-4ca33fb3cc3d/96263f0e895c506220fb848bb5ad68209bf5869f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : get some gpu information | |
| // keywords : djl, machine-learning, gpu, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : 2823b304-e6a7-47fb-80b2-4ca33fb3cc3d | |
| // created-on : 2024-02-18T11:58:44+01:00 | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.7.2" | |
| //> using dep "org.slf4j:slf4j-api:2.0.17" | |
| //> using dep "org.slf4j:slf4j-simple:2.0.17" | |
| //> using dep "ai.djl:api:0.33.0" | |
| //> using dep "ai.djl:basicdataset:0.33.0" | |
| //> using dep "ai.djl:model-zoo:0.33.0" | |
| //> using dep "ai.djl.pytorch:pytorch-engine:0.33.0" | |
| //> using dep "ai.djl.pytorch:pytorch-model-zoo:0.33.0" | |
| import ai.djl.Device | |
| import ai.djl.util.cuda.CudaUtils | |
| // --------------------- | |
| val device = Device.gpu() | |
| println( | |
| s""" | |
| cuda version : ${CudaUtils.getCudaVersion} | |
| cuda version string : ${CudaUtils.getCudaVersionString} | |
| gpu count : ${CudaUtils.getGpuCount} | |
| gpu memory : ${CudaUtils.getGpuMemory(device)} | |
| """ | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment