| 357 | |
| 358 | #ifdef USE_NCCL |
| 359 | bp::object NCCL_New_Uid() { |
| 360 | std::string uid = NCCL<Dtype>::new_uid(); |
| 361 | #if PY_MAJOR_VERSION >= 3 |
| 362 | // Convert std::string to bytes so that Python does not |
| 363 | // try to decode the string using the current locale. |
| 364 | |
| 365 | // Since boost 1.53 boost.python will convert str and bytes |
| 366 | // to std::string but will convert std::string to str. Here we |
| 367 | // force a bytes object to be returned. When this object |
| 368 | // is passed back to the NCCL constructor boost.python will |
| 369 | // correctly convert the bytes to std::string automatically |
| 370 | PyObject* py_uid = PyBytes_FromString(uid.c_str()); |
| 371 | return bp::object(bp::handle<>(py_uid)); |
| 372 | #else |
| 373 | // automatic conversion is correct for python 2. |
| 374 | return bp::object(uid); |
| 375 | #endif |
| 376 | } |
| 377 | #endif |
| 378 | |
| 379 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SolveOverloads, Solve, 0, 1); |
nothing calls this directly
no outgoing calls
no test coverage detected