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

Implement EigenCudaStreamDevice #3497

Merged
merged 6 commits into from
Aug 16, 2017

Conversation

QiJune
Copy link
Member

@QiJune QiJune commented Aug 15, 2017

When working on refactoring paddle code using unsupported tensor module of Eigen3, I meet the problem that GCC5.4 with -O1 is good, but -O2 will cause segment fault.

There is a bug in unspported tensor module, m_devicePropInitialized and are m_deviceProperties defined as a static variable in a header file. Thanks to @hedaoyuan help to debug to verify this.
If the TensorDeviceCuda.h header file is included by several .cc file, the value of m_devicePropInitialized and m_deviceProperties will be different. Each .cc file will have its own value. The first file value maybe is true(device properties have been inited), but the second file value can still be false. So, it will cause segment fault, when get value from m_deviceProperties[0](m_deviceProperties is actually nullptr in other .cc file).

I found that Tensorflow also used tensor module of Eigen3, but have no such error. Tensorflow has implemented EigenCudaStreamDevice. It's interesting that in the constructor of EigenCudaStreamDevice, no cuda stream will passed, but in Reinitialize, a cuda stream will be passed.

So, I implement a class EigenCudaStreamDevice just as TensorFlow does. And I set gcc version to 5.4, and compile with Release mode.

I will check TensorFlow and Eigen3 in further.

@QiJune QiJune mentioned this pull request Aug 16, 2017
@QiJune QiJune requested review from gangliao and hedaoyuan August 16, 2017 06:05
@QiJune QiJune changed the title [WIP]Implement EigenCudaStreamDevice Implement EigenCudaStreamDevice Aug 16, 2017
Copy link
Contributor

@gangliao gangliao left a comment

Choose a reason for hiding this comment

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

LGTM

@gangliao gangliao merged commit efdb4aa into PaddlePaddle:develop Aug 16, 2017
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