0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Python to RubyAdvent Calendar 2021

Day 20

[py2rb] multiprocessing

Last updated at Posted at 2022-01-26

はじめに

移植やってます。
( from python 3.7 to ruby 2.7 )

multiprocessing (Python)

import multiprocessing as mp

try:
    _NPROC = mp.cpu_count()
except NotImplementedError:
    _NPROC = 4

並列処理を移植するって、完全に力不足。

どうする (Ruby)

require 'etc'
p Etc.nprocessors #=> 4

いや、cpuのコア数を数えるくらいならできますけど。

メモ

  • Python の multiprocessing を学習した
  • 百里を行く者は九十里を半ばとす
0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?