Last active
September 1, 2024 10:15
-
-
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/3e7495abc301a09becbd9048deceef27ede5afd3
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 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.29.0" | |
//> using dep "ai.djl:basicdataset:0.29.0" | |
//> using dep "ai.djl:model-zoo:0.29.0" | |
//> using dep "ai.djl.pytorch:pytorch-engine:0.29.0" | |
//> using dep "ai.djl.pytorch:pytorch-model-zoo:0.29.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