-
Notifications
You must be signed in to change notification settings - Fork 31
Build for CPU only if CUDA is not available #28
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
Conversation
[ghstack-poisoned]
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); | ||
} |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
….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
…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]
… 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]
…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]
… 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]
…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]
… 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]
…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]
… 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]
…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]
… 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]
…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]
… 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]
…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]
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]
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]
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]
….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
…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
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: