PyTorch cannot find GPU

I tried to install pytorch on a cluster, which is centos 6.9 and I don’t have a root account. The default glibc is too old, so I first installed a newer glibc version and compiled python myself.
I start my python with

/cshome/shangton/apps/glibc/lib/ --library-path /cshome/shangton/apps/glibc/lib:/cshome/shangton/apps/python3/lib:/lib64:/cshome/shangton/miniconda3/lib:/usr/local/cuda-8.0/lib64 /cshome/shangton/apps/python3/bin/python3

But torch doesn’t seem to find the device,

Python 3.6.3 (default, May 31 2018, 20:42:57)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.device_count()
1 Like

Did you see any information regarding CUDA or your GPU during the build from source?
Were any warnings thrown?

Oh I didn’t build from source, just pip install torch (or specify a link with cuda myself)
I will try to build it from source.

Sorry, I thought you already compiled PyTorch from source.
Anyway, did you make sure to use the compiled python version?
You can check it with which python3.

I use absolute path to call python (the long command in the first line)

I finally made it,

/cshome/shangton/apps/glibc/lib/ --library-path /cshome/shangton/apps/glibc/lib:/cshome/shangton/apps/python3/lib:/lib64:/cshome/shangton/miniconda3/lib:/usr/local/cuda-8.0/lib64:/usr/lib64 /cshome/shangton/apps/python3/bin/python3

Add one more lib path