Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in Docker after importing chainerrl #589

Open
russelltankl opened this issue Jan 16, 2020 · 2 comments
Open

Segmentation fault in Docker after importing chainerrl #589

russelltankl opened this issue Jan 16, 2020 · 2 comments

Comments

@russelltankl
Copy link

I've encountered segmentation fault error when using chainerrl with GPU in Docker. The error occurs if I import chainerrl first, then perform a cuda.get_device(args).use(). The quick fix my colleague and I found is to do cuda.get_device(args).use()first, then import chainerrl. Both scenarios are shown below.

root@9d606b33d95a:/home# python3
Python 3.7.6 (default, Dec 19 2019, 23:50:13) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from chainer import cuda
>>> import chainerrl
>>> cuda.get_device(1).use()
Segmentation fault (core dumped)
root@9d606b33d95a:/home# python3
Python 3.7.6 (default, Dec 19 2019, 23:50:13) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from chainer import cuda
>>> cuda.get_device(1).use()
>>> import chainerrl
>>> 

Dockerfile

FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
RUN apt-get update

RUN apt-get install -y wget git build-essential cmake libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev swig && rm -rf /var/lib/apt/lists/*

RUN apt update \
	&& apt install software-properties-common -y \
	&& add-apt-repository ppa:deadsnakes/ppa -y \
	&& apt-get update \
	&& apt install python3.7 -y \
	&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 \
	&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

RUN apt-get install python3.7-dev python3-pip python3-wheel python3-setuptools -y

RUN git clone https://github.com/chainer/chainerrl.git \
	&& cd chainerrl \
	&& python3 setup.py install

RUN pip3 install cupy-cuda101

My current computer configurations:

root@9d606b33d95a:/home# nvidia-smi
Thu Jan 16 21:07:09 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01    Driver Version: 440.33.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  TITAN RTX           On   | 00000000:3B:00.0 Off |                  N/A |
| 63%   81C    P2   246W / 280W |   5777MiB / 24220MiB |     99%      Default |
+-------------------------------+----------------------+----------------------+
|   1  TITAN RTX           On   | 00000000:AF:00.0  On |                  N/A |
| 41%   59C    P8    30W / 280W |   1422MiB / 24217MiB |      9%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+
root@9d606b33d95a:/home# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
root@9d606b33d95a:/home/DRL_Traffic_Corridor#
root@9d606b33d95a:/home# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              32
On-line CPU(s) list: 0-31
Thread(s) per core:  2
Core(s) per socket:  8
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz
Stepping:            4
CPU MHz:             800.012
CPU max MHz:         3000.0000
CPU min MHz:         800.0000
BogoMIPS:            4200.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            11264K
NUMA node0 CPU(s):   0-7,16-23
NUMA node1 CPU(s):   8-15,24-31
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d
root@9d606b33d95a:/home# uname -a
Linux 9d606b33d95a 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

This is the furthest we could debug this issue. This was initially quite an issue until we found out about the import fix. We are just curious why does importing chainerrl throws a segmentation fault.

@muupan
Copy link
Member

muupan commented Jan 28, 2020

Hm, very strange. I cannot reproduce it on my Ubuntu 16.04 machine with CUDA 9.1.

$ ipython
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from chainer import cuda

In [2]: import chainerrl

In [3]: cuda.get_device(1).use()

In [4]:

Have you experienced it on other environments?

@russelltankl
Copy link
Author

So far I could only reproduce this error in a Docker environment. Running the same code outside of Docker seems to work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants