Comments (3)
Hmm, can you run any cuda program inside your container? Judging by the error it's very likely that GPU access from your container is misconfigured
from pytorch.
Thank you for your response. Here are my details:
> nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Feb__7_19:32:13_PST_2023
Cuda compilation tools, release 12.1, V12.1.66
Build cuda_12.1.r12.1/compiler.32415258_0
Hereβs a simple CUDA test script (test.cu):
#test.cu
#include <stdio.h>
__global__ void add(int *a, int *b, int *c) {
c[blockIdx.x] = a[blockIdx.x] + b[blockIdx.x];
}
int main() {
int a[5] = {1, 2, 3, 4, 5};
int b[5] = {10, 20, 30, 40, 50};
int c[5] = {0};
int *d_a, *d_b, *d_c;
int size = sizeof(int) * 5;
cudaMalloc((void **)&d_a, size);
cudaMalloc((void **)&d_b, size);
cudaMalloc((void **)&d_c, size);
cudaMemcpy(d_a, a, size, cudaMemcpyHostToDevice);
cudaMemcpy(d_b, b, size, cudaMemcpyHostToDevice);
add<<<5,1>>>(d_a, d_b, d_c);
cudaMemcpy(c, d_c, size, cudaMemcpyDeviceToHost);
printf("η»ζοΌ");
for (int i = 0; i < 5; i++)
printf("%d ", c[i]);
printf("\n");
cudaFree(d_a);
cudaFree(d_b);
cudaFree(d_c);
return 0;
}
When I compiled and ran it:
> nvcc test.cu -o test
> ./test
η»ζοΌ0 0 0 0 0
After many attempts, I found a solution: setting an environment variable before calling torch.cuda.is_available():
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
I suspect this is because I moved the VM location from a host Windows system and reassigned the GPU to the VM. This resulted in two PCI devices showing up, but only one working:
lspci -v
63b6:00:00.0 3D controller: Microsoft Corporation Device 008e
Physical Slot: 3509819646
Flags: bus master, fast devsel, latency 0, NUMA node 0
Capabilities: <access denied>
Kernel driver in use: dxgkrnl
Kernel modules: dxgkrnl
b330:00:00.0 3D controller: Microsoft Corporation Device 008e
Physical Slot: 3646467553
Flags: bus master, fast devsel, latency 0, NUMA node 0
Capabilities: <access denied>
Kernel driver in use: dxgkrnl
Kernel modules: dxgkrnl
from pytorch.
As this seems to be an environment issue, I encourage you to post on the PyTorch forums if additional assistance is needed, as you're more likely to receive help there. Note that the issues here are reserved for bugs within PyTorch itself. Closing for now but feel free to reopen if forum discussion points to a PyTorch bug.
from pytorch.
Related Issues (20)
- Error in gradient of CTCLoss
- [Bug] Data on CPUs Are Not Synchronized Before Subsequent Operations HOT 4
- TORCH_LIBRARY breaks when passing (unexpanded) macro as namespace argument HOT 1
- custom_op API: better type anntation for Tuple
- Segfault, possibly due to recursion limit
- Fix accuracy regression for cspdarknet53 or flakiness associated with cu121 (and potentially cu124) HOT 1
- dynamo minifier test test_cpu_cuda_module_after_dynamo fail with nn module inlining. HOT 1
- SyntaxError: unterminated string literal (detected at line 1) (<unknown>, line 1) HOT 15
- c++ library written with a lot of errors
- [export] Errors out when unflattening TorchTitan HOT 1
- OneCycleLR Example
- Illegal memory access resulted from pointwise autotuning of a cat-like kernel HOT 3
- DISABLED test_workspace_allocation_error (__main__.CudaGraphTreeTests) HOT 1
- Inductor generates unnecessary allocation + copy operations for custom ops with mutable inputs HOT 11
- Strange clamp assert error when building on Fedora 40/gcc 14 in IndexKernel.hip HOT 1
- Add line number to ` _warn_capture_scalar_outputs():`
- module 'torch.mps' has no attribute 'device' HOT 1
- Key error in index_propagation when looking up dynamic shape vr HOT 8
- RuntimeError: `jit.freeze` fails to find externally assigned attributes
- UNSTABLE inductor / cuda12.4-py3.10-gcc9-sm86 / test (dynamic_inductor_timm) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch.