Skip to content

Commit 4981f62

Browse files
fanlucsukuangfj
authored andcommitted
get gpu automatically rather than specify device_id (#3848)
* get gpu automatically rather than specify device_id * fix param type
1 parent daa0746 commit 4981f62

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/pybind/cudamatrix/cu_device_pybind.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ void pybind_cu_device(py::module& m) {
3636
},
3737
py::arg("device_id"));
3838

39+
m.def("SelectGpuId",
40+
[](const std::string& use_gpu) {
41+
#if HAVE_CUDA == 1
42+
CuDevice::Instantiate().SelectGpuId(use_gpu);
43+
#else
44+
KALDI_LOG << "Kaldi is NOT compiled with GPU! Ignore it.";
45+
#endif
46+
},
47+
py::arg("use_gpu"));
48+
3949
m.def("CuDeviceAllowMultithreading", []() {
4050
#if HAVE_CUDA == 1
4151
CuDevice::Instantiate().AllowMultithreading();

0 commit comments

Comments
 (0)