Created
February 18, 2024 18:00
-
-
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/41d101f2fdddace3e2432b14729c4b3834a99aeb
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.3.1" | |
//> using dep "org.slf4j:slf4j-api:2.0.12" | |
//> using dep "org.slf4j:slf4j-simple:2.0.12" | |
//> using dep "ai.djl:api:0.26.0" | |
//> using dep "ai.djl:basicdataset:0.26.0" | |
//> using dep "ai.djl:model-zoo:0.26.0" | |
//> using dep "ai.djl.pytorch:pytorch-engine:0.26.0" | |
//> using dep "ai.djl.pytorch:pytorch-model-zoo:0.26.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