Solve multithreaded problems running Pytorch programs

Source: Internet
Author: User
Tags pytorch

    • When I use Pycharm to run the (https://github.com/Joyce94/cnn-text-classification-pytorch) Pytorch program, multiple processes are opened on the Linux server, Occupy the server's large number of CPUs, run this program on WINDOWS10, the CPU and memory will be eaten up, because in train.py there is a lot of data training processing, will open multiple processes, occupy a large number of CPUs and processes.
    • Native WINDOW10

    • Linux Server opens multiple processes

    • Linux server consumes a lot of CPU

    • (http://pytorch.org/docs/master/multiprocessing.html) muliprocessing multi-process management in Pytorch, with pool process pools, process () And so on the process of management, it may be I use the wrong way, anyway, it has no effect.
    • However, the simplest is also the best solution: torch.set_num_threads (int thread), can be a good solution to Windows problems, reference (http://pytorch.org/docs/master/torch.html #parallelism) However, there are still some problems on the Linux server, export OMP_NUM_THREADS = 1 can solve the Linux problem.

Solve multithreaded problems running Pytorch programs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.