-
Notifications
You must be signed in to change notification settings - Fork 354
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
Prototype cupy backend #4952
base: master
Are you sure you want to change the base?
Prototype cupy backend #4952
Conversation
This is now running the |
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.
All this looks sensible to me, though I don't feel I can approve yet
The bits that I'd got to look to be the same as what I'd implemented (though I was much slower and hadn't got to certain parts)
Main points I was wanting to ask about:
- put your own name down where you have done stuff (even if adding to others')
- I've looked where bits have been adapted from and have noticed minor discrepancies that I wasn't sure on, so am asking questions.
_backend_dict = {'cupy' : 'cupyfft'} | ||
_backend_list = ['cupy'] | ||
|
||
_alist, _adict = _list_available(_backend_list, _backend_dict) |
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.
The backend_cuda
version of this has the if pycbc.HAVE_CUDA
statement and this doesn't. This makes me think, should this backend work when not on a GPU?
@@ -0,0 +1,37 @@ | |||
# Copyright (C) 2014 Josh Willis |
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.
you wrote this
@@ -0,0 +1,88 @@ | |||
# Copyright (C) 2012 Josh Willis |
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.
you wrote this
else: | ||
raise ValueError(_INV_FFT_MSG.format("IFFT", itype, otype)) | ||
|
||
|
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.
It would be good to have something similar to the numpy warning, i.e "The cupy backend is a prototype, and performance may not be as expected"
|
||
class FFT(_BaseFFT): | ||
""" | ||
Class for performing FFTs via the numpy interface. |
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.
numpy --> cupy
if self.dtype == _xp.float32 or self.dtype == _xp.float64: | ||
return _xp.argmax(abs(self.data)) | ||
else: | ||
return abs_arg_max_complex(self._data) |
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.
I don't see where this is defined?
if cdtype.kind == 'c': | ||
return _xp.sum(self.data.conj() * other, dtype=complex128) | ||
else: | ||
return inner_real(self.data, other) |
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.
same here - i dont see where this is defined
#def numpy(self): | ||
# return self._data | ||
|
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.
#def numpy(self): | |
# return self._data |
__shared__ unsigned int s; | ||
__shared__ unsigned int e; | ||
__shared__ float2 chisq[${NT} * ${NP}]; | ||
float twopi = 6.283185307179586f; |
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.
I don't really like that this is defined here - is there any SSOT we can get this from automatically?
"""This module contains the CPU-specific code for | ||
convenience utilities for manipulating waveforms |
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.
"""This module contains the CPU-specific code for | |
convenience utilities for manipulating waveforms | |
"""This module contains the CuPy-specific code for | |
convenience utilities for manipulating waveforms |
This adds a prototype CUPY backend to PyCBC.
Our current CUDA GPU backend is not working. There's also a lot more tools now for interacting with CUDA than in 2011. CUPY is really nice, and I think will reduce quite a bit the complexity of our CUDA backend, while still allowing us to use the custom CUDA kernels that exist (as demonstrated in the PR).
This backend will:
I post this now, although I would like to have pycbc_inspiral running before proposing merging ... But I did promise on Wednesday that I would post this.
Others have suggested moving to torch instead. I would like to see a demonstration of this if we want to consider going that route or this one.
ACTIONS