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

cpu_usage 100% In centos #89

Open
eheroqiu opened this issue Apr 7, 2020 · 1 comment
Open

cpu_usage 100% In centos #89

eheroqiu opened this issue Apr 7, 2020 · 1 comment

Comments

@eheroqiu
Copy link

eheroqiu commented Apr 7, 2020

When I use scoop in centos, no matter how many do I set the number of -n ,My cpu usage is 100%, but cpu load is very normal in macos.
ps. My centos machine is 40 cores

how does it happened?

@ljluestc
Copy link

from math import hypot
from random import random
from scoop import futures
import time

def test(tries):
return sum(hypot(random(), random()) < 1 for _ in range(tries))

def calcPi(nbFutures, tries):
expr = futures.map(test, [tries] * nbFutures)
return 4. * sum(expr) / float(nbFutures * tries)

if name == "main":
nbFutures = 3000
tries = 5000

bt = time.time()

# Divide the work among fewer processes to minimize overhead
chunk_size = 10
expr = futures.map(test, [chunk_size] * (nbFutures * tries // chunk_size))

print("pi = {}".format(4. * sum(expr) / float(nbFutures * tries)))
print('time:', time.time() - bt)

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