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

Add in-place poisson random-number generation #238

Merged
merged 2 commits into from Jun 1, 2020

Conversation

vincefn
Copy link
Contributor

@vincefn vincefn commented May 26, 2020

With this version, the input array can be used to supply the per-element lamba value. This is similar to what numpy.random.poisson() allows, either supplying a shape and one lambda value, or an array of lambda values.

This is very useful when simulating detector data for imaging, where each point has a different expected value.

Let me know if you want examples, there are currently none for the random-number generators.

…en in the input array, similarly to what numpy.random.poisson() allows.
@inducer
Copy link
Owner

inducer commented May 29, 2020

@inducer
Copy link
Owner

inducer commented May 31, 2020

There were some failures in the CI. Could you take a look?

(Click the red X to see the logs.)

@vincefn
Copy link
Contributor Author

vincefn commented May 31, 2020

Hi Andreas, I looked at the CI output but I don't know what going on:

  • a lot of test are failing, including in test_driver
  • the error always seems to be g++-7: No such file or directory
  • I had ran the tests on my computer without a problem

To test in a cleaner (compared to my computer) environment, I just made a notebook on google colab:
https://colab.research.google.com/drive/1njtsz7Jxtsi7l7chEW02b5TvsVmwo4Ym?usp=sharing

the tests pass there, so could it be a problem in the CI setup ? I'm not sure which file is missing, could it be g++-7 itself ?
Let me know if I missed something.

@inducer
Copy link
Owner

inducer commented May 31, 2020

The g++-7 thing was an issue with my CI setup (which should be fixed). I only see one failure:

 Traceback (most recent call last):
  File "/var/lib/gitlab-runner/builds/338cd43e/0/inducer/pycuda/pycuda/tools.py", line 463, in f
    inner_f(*args, **kwargs)
  File "/var/lib/gitlab-runner/builds/338cd43e/0/inducer/pycuda/test/test_gpuarray.py", line 309, in test_curand_wrappers
    assert np.isclose(0.12511, tmp, atol=0.002)
AssertionError: assert False
 +  where False = <function isclose at 0x7fe60455b350>(0.12511, 0, atol=0.002)
 +    where <function isclose at 0x7fe60455b350> = np.isclose

@inducer
Copy link
Owner

inducer commented May 31, 2020

Here is a log with that problem.

@vincefn
Copy link
Contributor Author

vincefn commented May 31, 2020

Hmm - I thought I had set a tolerance high enough that the ratio of 1000000 values with lambda=10 with value==9 would be close enough to 0.12511, but apparently that's not the case... I tested a few 100's of times with all generators and they got close enough every time.

I guess I'll remove that test, it's probably a bad idea to have a numerical test based on random values, the central limit theorem won't get us where we want us every time.

@inducer inducer merged commit 6f3fce2 into inducer:master Jun 1, 2020
@inducer
Copy link
Owner

inducer commented Jun 1, 2020

Thanks for your contribution!

@vincefn
Copy link
Contributor Author

vincefn commented Jun 1, 2020 via email

@vincefn vincefn deleted the poisson_inplace branch June 2, 2020 07:27
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

Successfully merging this pull request may close these issues.

None yet

2 participants