Skip to content

QNN DeepLabV3 example opens too many files#21870

Description

@mcollinswisc

馃悰 Describe the bug

When running the deeplab_v3.py example at:
https://github.com/pytorch/executorch/blob/ed65b12309e99fb375af19929e4c40de0c419d95/examples/qualcomm/scripts/deeplab_v3.py
I'm getting an error from too many open files.

Exception: [Errno 24] Too many open files: '/tmp/dlv3/voc_image/VOCdevkit/VOC2012/JPEGImages/2010_001403.jpg'

Full logs at https://gist.github.com/mcollinswisc/1744ed91e86410878c4ce9e8e4c88b28

It can be reproduced with:

python3 -m venv /tmp/dlv3-venv
. /tmp/dlv3-venv/bin/activate

pip install \
    --index-url https://download.pytorch.org/whl/cpu \
    --extra-index-url https://pypi.org/simple \
    executorch==1.4.0 torchvision==0.28.0 py-cpuinfo transformers pydot

ulimit -n 1024   # a no-op in most shells

python -m executorch.examples.qualcomm.scripts.deeplab_v3 \
    --build_folder build-x86 --soc_model SM8550 \
    --artifact /tmp/dlv3 --compile_only --download

Note the "soft" limit of 1024 file handles is already the default in a fresh bash shell on my Ubuntu Resolute system. (The ulimit command above is just to help repro.) 1024 is the Linux kernel default:

Likely cause is that torchvision.datasets.VOCSegmentation will leave an open file handle in the target here:
https://github.com/pytorch/vision/blob/af77a7ce07bf64d6eb7cde147a8040eabcb26226/torchvision/datasets/voc.py#L156
(from https://pillow.readthedocs.io/en/stable/reference/open_files.html#image-lifecycle, for Image.open() "The file is left open for further usage.") The deeplab_v3 example is instantiating these file handles for the whole dataset by passing it to list():


going well past the 1024 limit.

[This is my own summary of a longer analysis by Claude to track this down. Happy to post more of the full thing and/or send a PR with the proposed fix (that loads the dataset sample more efficiently) too.]

Versions

Collecting environment information...
PyTorch version: 2.13.0+cpu
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Ubuntu 26.04 LTS (x86_64)
GCC version: (Ubuntu 15.2.0-16ubuntu1) 15.2.0
Clang version: 21.1.8 (6ubuntu1)
CMake version: version 4.2.3
Libc version: glibc-2.43

Python version: 3.14.4 (main, Jun 18 2026, 14:25:02) [GCC 15.2.0] (64-bit runtime)
Python platform: Linux-7.0.0-29-generic-x86_64-with-glibc2.43
Is CUDA available: False
CUDA runtime version: 13.3.73
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: NVIDIA RTX PRO 6000 Blackwell Max-Q Workstation Edition
Nvidia driver version: Could not collect
cuDNN version: Could not collect
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: False
Caching allocator config: N/A

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 24
On-line CPU(s) list: 0-23
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 9 5900X 12-Core Processor
CPU family: 25
Model: 33
Thread(s) per core: 2
Core(s) per socket: 12
Socket(s): 1
Stepping: 2
Frequency boost: enabled
CPU(s) scaling MHz: 56%
CPU max MHz: 4954.5649
CPU min MHz: 567.0890
BogoMIPS: 7386.09
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm debug_swap
L1d cache: 384 KiB (12 instances)
L1i cache: 384 KiB (12 instances)
L2 cache: 6 MiB (12 instances)
L3 cache: 64 MiB (2 instances)
NUMA node(s): 1
NUMA node0 CPU(s): 0-23
Vulnerability Gather data sampling: Not affected
Vulnerability Ghostwrite: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Old microcode: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Mitigation; Safe RET
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; IBRS_FW; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsa: Mitigation; Clear CPU buffers
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

Versions of relevant libraries:
[pip3] executorch==1.4.0+cpu
[pip3] numpy==2.5.2
[pip3] pytorch_tokenizers==1.4.1
[pip3] torch==2.13.0+cpu
[pip3] torchao==0.18.0+cpu
[pip3] torchvision==0.28.0+cpu
[conda] Could not collect

cc @cbilgin @psiddh

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: qnnIssues related to Qualcomm's QNN delegate and code under backends/qualcomm/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions