Skip to content

Commit

Permalink
fix segmentfault in (#2506) (#2530)
Browse files Browse the repository at this point in the history
- fix segmentfault in Kunpeng (#2506)
  - avoids the repeated initialization of deepspeed causing by (#2507)
  • Loading branch information
MengqingCao authored May 17, 2024
1 parent 704a5bb commit 2d8bb97
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions wenet/dataset/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@

logging.getLogger('langid').setLevel(logging.INFO)

import os
try:
cpu_info = os.popen("lscpu | grep 'Vendor ID'").read()
# 0x48 --> HiSilicon
if (cpu_info.rstrip().split(" ")[-1] == "0x48"):
# NOTE (MengqingCao): set number of threads in the subprocesses to 1
# Why? There may be some operators ultilizing multi-threads in processor,
# causing possibly deadlock in Kunpeng.
# Similar issue in PyTorch: https://github.com/pytorch/pytorch/issues/45198
torch.set_num_threads(1)
except Exception as ex:
logging.warning('Failed to set number of thread in Kunpeng, \
this may cause segmentfault while dataloading, \
ignore this warning if you are not using Kunpeng')


class UrlOpenError(Exception):

Expand Down

0 comments on commit 2d8bb97

Please sign in to comment.