daquang / YAMDA

Yet Another Motif Discovery Algorithm
MIT License
51 stars 7 forks source link

CUDNN error, how to debug? #10

Closed littleblackfish closed 4 years ago

littleblackfish commented 4 years ago

I made an environment using the environment.yml. I attempt a test run with:

YAMDA/run_em.py -i positive-sample.fa -j negative-sample.fa -o test

which ultimately fails with

RuntimeError: CUDNN_STATUS_EXECUTION_FAILED

I use tensorflow on this particular machine all the time, so I know the gpu is functional. I am at a loss on how to even start debugging this.

daquang commented 4 years ago

Can you post the whole error output and confirm whether pytorch works?

littleblackfish commented 4 years ago

Here is the full output:

Traceback (most recent call last):                                                                                                                                       | 0/1 [00:00<?, ?it/s]
  File "YAMDA/run_em.py", line 146, in <module>                                                                                                                        | 0/547 [00:00<?, ?it/s]
    main()
  File "YAMDA/run_em.py", line 131, in main
    seqs, seqs_neg = model.fit(seqs, seqs_neg)
  File "/nfs/nfs7/home/muroztur/YAMDA/yamda/mixture.py", line 115, in fit
    self._online_em(X, ppms_seeds, ppms_bg_seeds, fracs_seeds, 1)
  File "/nfs/nfs7/home/muroztur/YAMDA/yamda/mixture.py", line 268, in _online_em
    log_ratios = m_log_ratios(x).data
  File "/nfs/nfs5/home/nobackup/muroztur/miniconda3/envs/YAMDA-env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/nfs/nfs5/home/nobackup/muroztur/miniconda3/envs/YAMDA-env/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 176, in forward
    self.padding, self.dilation, self.groups)
RuntimeError: CUDNN_STATUS_EXECUTION_FAILED

Can you recommend a straightforward way to confirm pytorch works?

littleblackfish commented 4 years ago

Okay, I ran some examples from pytorch tutorials, and they seem to be running fine with torch.device("cuda:0").

daquang commented 4 years ago

Can you confirm whether YAMDA works with the included examples?

python run_em.py -r -e -i Examples/H1_POU5F1_ChIP_HAIB.fa.masked -j Examples/H1_POU5F1_ChIP_HAIB_shuffled.fa.masked -oc H1_POU5F1_output

I'm wondering if there's an issue with pytorch. I know that the newest version of pytorch uses cuda 10.2 but tensorflow still uses cuda 10.1, so cudnn might have some issues

littleblackfish commented 4 years ago

Example yields the same error. It looks like the environment.yml specifies pytorch=0.4.0 which is what I have.

littleblackfish commented 4 years ago

Also, the script does not quit but hangs after the error. I can see some memory use and an active process in nvidia-smi, but it does not seem to be doing anything (utilization 0%).

daquang commented 4 years ago

Ah I see. Try upgrading to the latest version of pytorch. pytorch 0.4.0 probably isn't compatible with your current version of cuda. Or, pick a version of pytorch that is compatible with your cuda version

littleblackfish commented 4 years ago

Upgrading to pytorch-1.1.0 got me a little further, but still failed ultimately running the included example: :

Computing log likelihood:   0%|                                                                                                                                        | 0/389 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "run_em.py", line 146, in <module>
    main()
  File "run_em.py", line 131, in main
    seqs, seqs_neg = model.fit(seqs, seqs_neg)
  File "/nfs/nfs7/home/muroztur/YAMDA/yamda/mixture.py", line 118, in fit
    log_likelihoods = self._compute_log_likelihood(X, ppms, ppms_bg, fracs)
  File "/nfs/nfs7/home/muroztur/YAMDA/yamda/mixture.py", line 311, in _compute_log_likelihood
    ppms_bg_logprob = m_log_ppms_bg(x).data
  File "/nfs/nfs5/home/nobackup/muroztur/miniconda3/envs/YAMDA-env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/nfs/nfs5/home/nobackup/muroztur/miniconda3/envs/YAMDA-env/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 196, in forward
    self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM
littleblackfish commented 4 years ago

Also tried upgrading cuDNN to 7.6.5 to no avail.

daquang commented 4 years ago

I have pytorch 1.5.1 and cuda 10.1 and cudnn 7.6.5 and it works fine on my Win10 machine. Can you try upgrading to those?

littleblackfish commented 4 years ago

I am having trouble getting that particular combination to happen, could you please provide a complete environment.yml?

daquang commented 4 years ago

Can you tell me if this pytorch example works?

https://github.com/pytorch/examples/tree/master/mnist

btw, a conda installation will automatically install cuda with pytorch for you:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

littleblackfish commented 4 years ago

conda create -fmy -c defaults -c anaconda -c conda-forge -c bioconda -c pytorch -n YAMDA-env numpy scipy pyfaidx tqdm pytorch torchvision meme biopython pybedtools

finally yielded a working environment. Note that I had to remove few bits from the recommended install command to get it to solve.

I appreciate the hard work that was put into this. Looks like it will be able to go through datasets that I could never get MEME to do in whole, but seriously, if there is an environment.yml shipped with the project I expect it to be a known working environment, otherwise what's the point?

I am not sure what is the best practice here, but would you like me to put in a pull request with a snapshot of my current working environment?

daquang commented 4 years ago

This is certainly strange. I just tried it on a jupyterlab server with a V100 GPU and it ran fine. Here's my terminal output:

root@050ddac727e7:/opt/notebooks# git clone https://github.com/daquang/YAMDA.git
Cloning into 'YAMDA'...
remote: Enumerating objects: 359, done.
remote: Total 359 (delta 0), reused 0 (delta 0), pack-reused 359
Receiving objects: 100% (359/359), 20.61 MiB | 27.31 MiB/s, done.
Resolving deltas: 100% (197/197), done.
root@050ddac727e7:/opt/notebooks# cd YAMDA
root@050ddac727e7:/opt/notebooks/YAMDA# ls
Dockerfile  LICENSE    docker-compose.yml  erase_annoying_sequences.py  makefile   yamda
Examples    README.md  environment.yml     logo                         run_em.py
root@050ddac727e7:/opt/notebooks/YAMDA# conda env create -f environment.yml
Collecting package metadata (repodata.json): done
Solving environment: done

Downloading and Extracting Packages
libedit-3.1.20170329 | 172 KB    | ####################################################################################### | 100% 
perl-net-http-6.09   | 11 KB     | ####################################################################################### | 100% 
perl-xml-sax-0.99    | 24 KB     | ####################################################################################### | 100% 
nccl-1.3.5           | 8.6 MB    | ####################################################################################### | 100% 
six-1.11.0           | 21 KB     | ####################################################################################### | 100% 
samtools-1.7         | 1.0 MB    | ####################################################################################### | 100% 
sqlite-3.23.1        | 1.5 MB    | ####################################################################################### | 100% 
libtiff-4.0.9        | 566 KB    | ####################################################################################### | 100% 
freetype-2.8         | 804 KB    | ####################################################################################### | 100% 
readline-7.0         | 1.1 MB    | ####################################################################################### | 100% 
perl-xml-simple-2.22 | 31 KB     | ####################################################################################### | 100% 
pytorch-0.4.0        | 224.9 MB  | ####################################################################################### | 100% 
perl-http-date-6.02  | 8 KB      | ####################################################################################### | 100% 
bedtools-2.27.1      | 712 KB    | ####################################################################################### | 100% 
olefile-0.45.1       | 47 KB     | ####################################################################################### | 100% 
perl-xml-sax-expat-0 | 5 KB      | ####################################################################################### | 100% 
pip-10.0.1           | 1.8 MB    | ####################################################################################### | 100% 
libgcc-ng-7.2.0      | 6.1 MB    | ####################################################################################### | 100% 
ncurses-6.1          | 943 KB    | ####################################################################################### | 100% 
pyfaidx-0.5.3        | 41 KB     | ####################################################################################### | 100% 
tqdm-4.23.3          | 58 KB     | ####################################################################################### | 100% 
pysam-0.14.1         | 7.9 MB    | ####################################################################################### | 100% 
perl-io-socket-ssl-2 | 114 KB    | ####################################################################################### | 100% 
perl-xsloader-0.22   | 7 KB      | ####################################################################################### | 100% 
htslib-1.7           | 1.1 MB    | ####################################################################################### | 100% 
setuptools-39.1.0    | 550 KB    | ####################################################################################### | 100% 
perl-yaml-1.24       | 38 KB     | ####################################################################################### | 100% 
perl-html-tree-5.03  | 88 KB     | ####################################################################################### | 100% 
pandas-0.23.0        | 11.8 MB   | ####################################################################################### | 100% 
intel-openmp-2018.0. | 620 KB    | ####################################################################################### | 100% 
perl-xml-sax-base-1. | 13 KB     | ####################################################################################### | 100% 
perl-net-ssleay-1.84 | 261 KB    | ####################################################################################### | 100% 
wheel-0.31.1         | 62 KB     | ####################################################################################### | 100% 
perl-uri-1.71        | 54 KB     | ####################################################################################### | 100% 
perl-http-negotiate- | 7 KB      | ####################################################################################### | 100% 
libxslt-1.1.32       | 538 KB    | ####################################################################################### | 100% 
perl-scalar-list-uti | 33 KB     | ####################################################################################### | 100% 
libcurl-7.60.0       | 495 KB    | ####################################################################################### | 100% 
mkl_fft-1.0.1        | 140 KB    | ####################################################################################### | 100% 
perl-http-message-6. | 32 KB     | ####################################################################################### | 100% 
tk-8.6.7             | 3.2 MB    | ####################################################################################### | 100% 
pycparser-2.18       | 169 KB    | ####################################################################################### | 100% 
perl-xml-parser-2.44 | 151 KB    | ####################################################################################### | 100% 
ghostscript-9.18     | 15.1 MB   | ####################################################################################### | 100% 
libgfortran-ng-7.2.0 | 1.2 MB    | ####################################################################################### | 100% 
numpy-1.13.3         | 3.9 MB    | ####################################################################################### | 100% 
jpeg-9b              | 248 KB    | ####################################################################################### | 100% 
perl-encode-locale-1 | 9 KB      | ####################################################################################### | 100% 
anaconda-custom      | 6 KB      | ####################################################################################### | 100% 
pytz-2018.4          | 212 KB    | ####################################################################################### | 100% 
pillow-5.1.0         | 582 KB    | ####################################################################################### | 100% 
xz-5.2.4             | 366 KB    | ####################################################################################### | 100% 
perl-digest-hmac-1.0 | 6 KB      | ####################################################################################### | 100% 
libstdcxx-ng-7.2.0   | 2.5 MB    | ####################################################################################### | 100% 
curl-7.60.0          | 140 KB    | ####################################################################################### | 100% 
libgcc-7.2.0         | 304 KB    | ####################################################################################### | 100% 
perl-5.22.0.1        | 15.1 MB   | ####################################################################################### | 100% 
libffi-3.2.1         | 43 KB     | ####################################################################################### | 100% 
perl-mime-base64-3.1 | 14 KB     | ####################################################################################### | 100% 
biopython-1.71       | 2.4 MB    | ####################################################################################### | 100% 
certifi-2018.4.16    | 142 KB    | ####################################################################################### | 100% 
meme-4.12.0          | 11.0 MB   | ####################################################################################### | 100% 
bzip2-1.0.6          | 414 KB    | ####################################################################################### | 100% 
cudnn-7.1.2          | 367.8 MB  | ####################################################################################### | 100% 
perl-http-cookies-6. | 11 KB     | ####################################################################################### | 100% 
perl-xml-namespacesu | 6 KB      | ####################################################################################### | 100% 
torchvision-0.2.1    | 75 KB     | ####################################################################################### | 100% 
icu-58.2             | 22.5 MB   | ####################################################################################### | 100% 
cudatoolkit-9.0      | 340.4 MB  | ####################################################################################### | 100% 
perl-io-html-1.001   | 11 KB     | ####################################################################################### | 100% 
cffi-1.11.5          | 212 KB    | ####################################################################################### | 100% 
bcftools-1.7         | 2.7 MB    | ####################################################################################### | 100% 
ca-certificates-2018 | 124 KB    | ####################################################################################### | 100% 
scipy-0.19.1         | 17.4 MB   | ####################################################################################### | 100% 
zlib-1.2.11          | 101 KB    | ####################################################################################### | 100% 
perl-ntlm-1.09       | 9 KB      | ####################################################################################### | 100% 
perl-test-more-1.001 | 2 KB      | ####################################################################################### | 100% 
mkl-2018.0.2         | 205.2 MB  | ####################################################################################### | 100% 
perl-http-daemon-6.0 | 9 KB      | ####################################################################################### | 100% 
yaml-0.1.7           | 85 KB     | ####################################################################################### | 100% 
openssl-1.0.2o       | 3.4 MB    | ####################################################################################### | 100% 
perl-html-template-2 | 32 KB     | ####################################################################################### | 100% 
perl-html-parser-3.7 | 61 KB     | ####################################################################################### | 100% 
python-dateutil-2.7. | 260 KB    | ####################################################################################### | 100% 
perl-threaded-5.22.0 | 2 KB      | ####################################################################################### | 100% 
expat-2.2.5          | 186 KB    | ####################################################################################### | 100% 
ninja-1.8.2          | 1.3 MB    | ####################################################################################### | 100% 
perl-file-listing-6. | 5 KB      | ####################################################################################### | 100% 
perl-www-robotrules- | 6 KB      | ####################################################################################### | 100% 
mkl_random-1.0.1     | 373 KB    | ####################################################################################### | 100% 
perl-lwp-mediatypes- | 19 KB     | ####################################################################################### | 100% 
libpng-1.6.34        | 334 KB    | ####################################################################################### | 100% 
perl-libwww-perl-6.1 | 63 KB     | ####################################################################################### | 100% 
perl-html-tagset-3.2 | 9 KB      | ####################################################################################### | 100% 
perl-cgi-4.22        | 162 KB    | ####################################################################################### | 100% 
libssh2-1.8.0        | 243 KB    | ####################################################################################### | 100% 
pybedtools-0.7.10    | 13.0 MB   | ####################################################################################### | 100% 
python-3.6.5         | 29.4 MB   | ####################################################################################### | 100% 
libxml2-2.9.8        | 2.0 MB    | ####################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Ran pip subprocess with arguments:
['/opt/conda/envs/YAMDA-env/bin/python', '-m', 'pip', 'install', '-U', '-r', '/opt/notebooks/YAMDA/condaenv.1tsl8bup.requirements.txt']
Pip subprocess output:
Requirement already up-to-date: torch==0.4.0 in /opt/conda/envs/YAMDA-env/lib/python3.6/site-packages (from -r /opt/notebooks/YAMDA/condaenv.1tsl8bup.requirements.txt (line 1)) (0.4.0)

#
# To activate this environment, use
#
#     $ conda activate YAMDA-env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

root@050ddac727e7:/opt/notebooks/YAMDA# conda activate YAMDA-env
(YAMDA-env) root@050ddac727e7:/opt/notebooks/YAMDA# python run_em.py -r -e -i Examples/H1_POU5F1_ChIP_HAIB.fa.masked -j Examples/H1_POU5F1_ChIP_HAIB_shuffled.fa.masked -oc H1_POU5F1_output 
Loading sequences from FASTA

Finding motif 1 of 1
Searching positive sequences: 100%|█████████████████████████████████████████████████████████████████| 9/9 [00:05<00:00,  1.73it/s]
Searching negative sequences: 100%|█████████████████████████████████████████████████████████████████| 9/9 [00:05<00:00,  1.73it/s]
On-line EM: 100%|███████████████████████████████████████████████████████████████████████████████████| 1/1 [00:05<00:00,  5.28s/it]
Batch EM: 100%|█████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  3.03it/s]
Computing log likelihood: 100%|███████████████████████████████████████████████████████████████| 389/389 [00:00<00:00, 2030.59it/s]
Using seed originating from word: NNNATGCATNACAAAGNNNN
Batch EM - convergence reached after 7 epochs: 100%|██████████████████████████████████████████████| 20/20 [00:01<00:00, 16.36it/s]
Pass 7/20: 100%|██████████████████████████████████████████████████████████████████████████████| 389/389 [00:00<00:00, 2236.09it/s]
Removing sequences containing at least one motif occurrence
Saving results to H1_POU5F1_output
(YAMDA-env) root@050ddac727e7:/opt/notebooks/YAMDA# nvidia-smi
Thu Jul 16 07:30:59 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.95.01    Driver Version: 440.95.01    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla V100-SXM2...  Off  | 00000000:00:1E.0 Off |                    0 |
| N/A   34C    P0    24W / 300W |      0MiB / 16160MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
(YAMDA-env) root@050ddac727e7:/opt/notebooks/YAMDA# 

I'm not exactly sure what was the cause of the bug on your end, as I couldn't replicate it. You are free to put in a pull request.

littleblackfish commented 4 years ago

Strange indeed, nothing seems to be far off, but that environment certainly did not work for me. Glad it was an easy fix.

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro RTX 6000     Off  | 00000000:3B:00.0 Off |                    0 |
| N/A   35C    P0    55W / 250W |    978MiB / 22698MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  Quadro RTX 6000     Off  | 00000000:5E:00.0 Off |                    0 |
| N/A   28C    P8    12W / 250W |     11MiB / 22698MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   2  Quadro RTX 6000     Off  | 00000000:AF:00.0 Off |                    0 |
| N/A   27C    P8    13W / 250W |     11MiB / 22698MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   3  Quadro RTX 6000     Off  | 00000000:D8:00.0 Off |                    0 |
| N/A   28C    P8    15W / 250W |     11MiB / 22698MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+