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

Performance issue on Random Number Generation #162

Closed
neko-suki opened this issue Jan 27, 2019 · 2 comments
Closed

Performance issue on Random Number Generation #162

neko-suki opened this issue Jan 27, 2019 · 2 comments
Assignees
Labels
performance Performance improvement and related
Milestone

Comments

@neko-suki
Copy link
Collaborator

I found a problem on random number generation. It affects performance.

https://github.com/fixstars/clpy/blob/clpy/clpy/random/generator.py#L175

or self.seed_array.size != numpy.prod(size) means when we change the size of randomly generated array, initialization process will run everytime.

The following is code for measure performance.

import clpy
import time

def generate_random(size):
    tmp = clpy.random.rand(size)
    

beg = time.time()
generate_random(1) # this case is extremely slow
end = time.time()
print("time = {:.5f} msec".format(end - beg))


beg = time.time()
generate_random(100000)
end = time.time()
print("time = {:.5f} msec".format(end - beg))

beg = time.time()
generate_random(100000)
end = time.time()
print("time = {:.5f} msec".format(end - beg))

beg = time.time()
generate_random( 99999)
end = time.time()
print("time = {:.5f} msec".format(end - beg))

beg = time.time()
generate_random( 99999)
end = time.time()
print("time = {:.5f} msec".format(end - beg))

The following is the result of performance measurement on Secondary machine (titanv). When the size of array to generate random number is changed, it takes long time.

time = 0.12419 msec
time = 0.00214 msec
time = 0.00089 msec
time = 0.00152 msec
time = 0.00023 msec
@LWisteria
Copy link
Member

@neko-suki Did #166 fix this? If so, please close.

@neko-suki
Copy link
Collaborator Author

@LWisteria OK. I will close this issue.

Improved performance is written here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance improvement and related
Projects
None yet
Development

No branches or pull requests

2 participants