Skip to content

Conversation

pbelevich
Copy link
Contributor

@pbelevich pbelevich commented Jun 11, 2020

If setup.py detects CUDA_HOME then build using nvcc, otherwise using cc

Fixes #21

Depends on:
pytorch/pytorch#39797
pytorch/pytorch#39816

Stack from ghstack:

m.def("supports_cuda", &supports_cuda);
m.def("create_random_device_generator", &create_random_device_generator, py::arg("token") = nullptr);
m.def("create_mt19937_generator", &create_mt19937_generator, py::arg("seed") = nullptr);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can any of the shared code that isn't cuda-specific go in the cpp file instead of .h?

I notice in pytorch the PYBIND11_MODULE calls at least are all in .cpp files.

@@ -29,7 +29,7 @@ class TestCSPRNG(unittest.TestCase):

size = 1000

all_devices = ['cpu', 'cuda']
all_devices = ['cpu', 'cuda'] if csprng.supports_cuda() else ['cpu']
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there something we'd need to do (in the .circleci config?) to get this to run on a non-cuda machine, so we can validate that changes don't break the cpu-only build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

facebook-github-bot pushed a commit to pytorch/pytorch that referenced this pull request Jun 12, 2020
….cuh (#39797)

Summary:
Pull Request resolved: #39797

This change allows using [OffsetCalculator.cuh](https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/cuda/detail/OffsetCalculator.cuh) on both CPU and CUDA.

It is required by (and manually tested with) pytorch/csprng#28

Test Plan: Imported from OSS

Differential Revision: D22002571

Pulled By: pbelevich

fbshipit-source-id: 0b85e465777f6613f3b3ba91873da57dab949c54
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 12, 2020
…cache methods in normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 12, 2020
… normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 12, 2020
…cache methods in normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 12, 2020
… normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 13, 2020
…cache methods in normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 13, 2020
… normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 13, 2020
…cache methods in normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 13, 2020
… normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 15, 2020
…cache methods in normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 15, 2020
… normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 15, 2020
…cache methods in normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
pbelevich added a commit to pytorch/pytorch that referenced this pull request Jun 15, 2020
… normal_distribution"

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618


Differential Revision: [D22002599](https://our.internmc.facebook.com/intern/diff/D22002599)

[ghstack-poisoned]
facebook-github-bot pushed a commit to pytorch/pytorch that referenced this pull request Jun 16, 2020
…tribution (#39816)

Summary:
Pull Request resolved: #39816

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes #39618

Test Plan: Imported from OSS

Differential Revision: D22002599

Pulled By: pbelevich

fbshipit-source-id: e33d42a7e88c5729b077b9cdbf1437158dab48bc
If setup.py detects CUDA_HOME then build using nvcc, otherwise using cc

Fixes #21 

Depends on:
pytorch/pytorch#39797
pytorch/pytorch#39816




[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Jun 19, 2020
ghstack-source-id: 82603cc
Pull Request resolved: #28
If setup.py detects CUDA_HOME then build using nvcc, otherwise using cc

Fixes #21 

Depends on:
pytorch/pytorch#39797
pytorch/pytorch#39816




[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Jun 19, 2020
ghstack-source-id: f7373bd
Pull Request resolved: #28
If setup.py detects CUDA_HOME then build using nvcc, otherwise using cc

Fixes #21 

Depends on:
pytorch/pytorch#39797
pytorch/pytorch#39816




[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Jun 19, 2020
ghstack-source-id: fe7de9c
Pull Request resolved: #28
If setup.py detects CUDA_HOME then build using nvcc, otherwise using cc

Fixes #21 

Depends on:
pytorch/pytorch#39797
pytorch/pytorch#39816




[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Jun 19, 2020
ghstack-source-id: 06d55d7
Pull Request resolved: #28
@pbelevich pbelevich closed this in c43a8b1 Jun 19, 2020
xwang233 pushed a commit to xwang233/pytorch that referenced this pull request Jun 20, 2020
….cuh (pytorch#39797)

Summary:
Pull Request resolved: pytorch#39797

This change allows using [OffsetCalculator.cuh](https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/cuda/detail/OffsetCalculator.cuh) on both CPU and CUDA.

It is required by (and manually tested with) pytorch/csprng#28

Test Plan: Imported from OSS

Differential Revision: D22002571

Pulled By: pbelevich

fbshipit-source-id: 0b85e465777f6613f3b3ba91873da57dab949c54
xwang233 pushed a commit to xwang233/pytorch that referenced this pull request Jun 20, 2020
…tribution (pytorch#39816)

Summary:
Pull Request resolved: pytorch#39816

This change replaces [`#if !defined(__CUDACC__) && !defined(__HIPCC__)`](https://github.com/pytorch/pytorch/blob/856215509d89c935cd1768ce4b496d4fc0e919a6/aten/src/ATen/core/DistributionsHelper.h#L147) with SFINAE expression that checks if RNG typename has next_double_normal_sample, set_next_double_normal_sample, next_float_normal_sample, set_next_float_normal_sample methods

It is required by (and manually tested with) pytorch/csprng#28

Fixes pytorch#39618

Test Plan: Imported from OSS

Differential Revision: D22002599

Pulled By: pbelevich

fbshipit-source-id: e33d42a7e88c5729b077b9cdbf1437158dab48bc
@facebook-github-bot facebook-github-bot deleted the gh/pbelevich/16/head branch June 23, 2020 14:17
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.

2 participants