File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -43,9 +43,9 @@ const std::shared_ptr<Generator>& GetDefaultCUDAGenerator(int64_t device_id) {
43
43
cuda_device_flags.resize (num_cuda_devices);
44
44
default_cuda_generators.resize (num_cuda_devices);
45
45
});
46
- if (device_id == - 1 ) {
47
- platform::Place place;
48
- device_id = BOOST_GET_CONST (platform::CUDAPlace, place). GetDeviceId ( );
46
+ if (device_id < 0 ) {
47
+ PADDLE_THROW ( platform::errors::InvalidArgument (
48
+ " cuda device id shoule be greater than 0 " ) );
49
49
}
50
50
51
51
std::call_once (cuda_device_flags[device_id], [device_id]() {
Original file line number Diff line number Diff line change @@ -60,6 +60,6 @@ void BindGenerator(py::module* m_ptr) {
60
60
&framework::Generator::SetIsInitPy);
61
61
m.def (" default_cpu_generator" , &framework::DefaultCPUGenerator);
62
62
m.def (" default_cuda_generator" , &framework::GetDefaultCUDAGenerator);
63
- } // end Generator
64
- } // end namespace pybind
63
+ }
64
+ } // namespace pybind
65
65
} // namespace paddle
You can’t perform that action at this time.
0 commit comments