-
Notifications
You must be signed in to change notification settings - Fork 10
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
BUG: Remove CudaContextManager and use cudaSetDevice #34
BUG: Remove CudaContextManager and use cudaSetDevice #34
Conversation
Thanks for the contribution. I think you are actually cleaning up legacy code which is no longer relevant since the introduction of a primary context in 2015... See Cuda 7 release notes.
Should I handle it or do you want to give it a try? |
I can give a try. |
Sorry for the typo. Yes, that's what I mean and what the link suggests. It shouldn't be 0 but the number of the selected device. This selection could be done in the constructor. |
I made the changes. I let you run the tests. Please let me know if everything is ok for you Matthieu |
Thanks looks good. The CI indicates that you didn't commit the |
dba5972
to
3c1b5bc
Compare
3c1b5bc
to
1a8f40a
Compare
Should be ok now |
Thanks. I'm surprised that it compiles locally because there are still references to the context manager. At least the CI doesn't build https://my.cdash.org/viewBuildError.php?buildid=2488764, can you fix it? I also think the commit body is wrong as is (since the Cuda context was not destroyed) + the list of CHANGES is not necessary so I suggest the following message for the commit body:
|
1a8f40a
to
9d3fe9b
Compare
src/itkCudaDataManager.cxx
Outdated
@@ -16,15 +16,13 @@ | |||
* | |||
*=========================================================================*/ | |||
|
|||
#include "itkCudaDataManager.h" |
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.
Oops, erroneous deletion? https://my.cdash.org/viewBuildError.php?buildid=2488836
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.
Yes, sorry
ea34200
to
3b8d4d0
Compare
src/itkCudaDataManager.cxx
Outdated
@@ -24,7 +24,6 @@ namespace itk | |||
// constructor | |||
CudaDataManager::CudaDataManager() | |||
{ | |||
m_ContextManager = CudaContextManager::GetInstance(); | |||
|
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 you remove this long comment too? I think it was already obsolete. Sorry, I should have caught this before...
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.
Done
3b8d4d0
to
e212340
Compare
Use the primary context with cudaSetDevice() introduced by Cuda 7 (https://developer.download.nvidia.com/compute/cuda/7_0/Prod/doc/CUDA_Toolkit_Release_Notes.pdf) instead of a new one. cudaSetDevice is called before every memory transfer between the CPU and GPU to be sure that the context is set for the current thread, see https://developer.nvidia.com/blog/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/.
e212340
to
a8b1e64
Compare
Thanks. Failing python packages are being solved in a separate issue, I'm merging this one. |
No description provided.