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

"fix gpu init" #7528

Merged
merged 7 commits into from
Jan 31, 2018
Merged

"fix gpu init" #7528

merged 7 commits into from
Jan 31, 2018

Conversation

dzhwinter
Copy link
Contributor

fix init gpu error.

}
#else
LOG(WARNING)
<< "'GPU' is not supported, Please re-compile with WITH_GPU option";
<< "'CUDA' is not supported, Please re-compile with WITH_CUDA option";
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently, CMakeLists.txt does not have WITH_CUDA option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@chengduoZH
Copy link
Contributor

chengduoZH commented Jan 15, 2018

fix #7519
fix #7416

int count = platform::GetCUDADeviceCount();
for (int i = 0; i < count; ++i) {
places.emplace_back(platform::CUDAPlace(i));
}
Copy link
Contributor

@chengduoZH chengduoZH Jan 15, 2018

Choose a reason for hiding this comment

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

The strict way to write is to put line54~56 outside try...catch.
But it's not a big problem here. Please feel free to change it or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

'WARNING: CUDA_VISIBLE_DEVICES set to {0}, not empty . The computation '
'speed will not be optimized if you use multi-gpu. It will '
'fail if this PaddlePaddle binary is compiled without GPU option'
.format(gpu_devices),
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. You want to remind users that currently fluid does not support multi-GPU training, right?
  2. If the user does not compile PaddlePaddle with GPU option, this warning will not show. So It will fail if this PaddlePaddle ... is unnecessary.

file=sys.stderr)
else:
gpu_devices = "0"
os.environ['CUDA_VISIBLE_DEVICES'] = gpu_devices
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic of line 99~110 maybe has some problem.

}

TEST(InitDevices, CUDA) {
using paddle::framework::InitDevices;
Copy link
Contributor

Choose a reason for hiding this comment

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

#ifdef PADDLE_WITH_CUDA should be placed in line31.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is compiled in nv_test.
So #ifdef PADDLE_WITH_CUDA is no needed.

try {
count = paddle::platform::GetCUDADeviceCount();
} catch (const std::exception& exp) {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If #ifdef PADDLE_WITH_CUDA is placed in line 31, I think try ... catch is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@chengduoZH chengduoZH left a comment

Choose a reason for hiding this comment

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

LGTM

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