Last active
May 25, 2024 10:20
-
-
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/5d5ff6a93ed7dd68bda667dff51a90b8980b8791
This file contains 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 NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// 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.4.2" | |
//> using dep "org.slf4j:slf4j-api:2.0.13" | |
//> using dep "org.slf4j:slf4j-simple:2.0.13" | |
//> using dep "ai.djl:api:0.28.0" | |
//> using dep "ai.djl:basicdataset:0.28.0" | |
//> using dep "ai.djl:model-zoo:0.28.0" | |
//> using dep "ai.djl.pytorch:pytorch-engine:0.28.0" | |
//> using dep "ai.djl.pytorch:pytorch-model-zoo:0.28.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