2024-07-07 09:50:26 +00:00
|
|
|
{
|
|
|
|
cudaPackages,
|
|
|
|
feature,
|
2024-07-20 12:05:16 +00:00
|
|
|
libraries,
|
2024-07-07 09:50:26 +00:00
|
|
|
versionAttr,
|
2024-07-20 12:05:16 +00:00
|
|
|
pythonPackages,
|
2024-07-07 09:50:26 +00:00
|
|
|
}:
|
|
|
|
|
2024-07-20 12:05:16 +00:00
|
|
|
(cudaPackages.writeGpuTestPython.override { python3Packages = pythonPackages; })
|
2024-07-07 09:50:26 +00:00
|
|
|
{
|
|
|
|
inherit feature;
|
2024-07-20 12:05:16 +00:00
|
|
|
inherit libraries;
|
2024-07-07 09:50:26 +00:00
|
|
|
name = "${feature}Available";
|
|
|
|
}
|
|
|
|
''
|
|
|
|
import torch
|
|
|
|
message = f"{torch.cuda.is_available()=} and {torch.version.${versionAttr}=}"
|
|
|
|
assert torch.cuda.is_available() and torch.version.${versionAttr}, message
|
|
|
|
print(message)
|
|
|
|
''
|