| 95 | } |
| 96 | |
| 97 | cudnnHandle_t get_handle ( |
| 98 | ) |
| 99 | { |
| 100 | int new_device_id; |
| 101 | CHECK_CUDA(cudaGetDevice(&new_device_id)); |
| 102 | // make room for more devices if needed |
| 103 | if (new_device_id >= (long)handles.size()) |
| 104 | handles.resize(new_device_id+16); |
| 105 | |
| 106 | // If we don't have a handle already for this device then make one |
| 107 | if (!handles[new_device_id]) |
| 108 | CHECK_CUDNN(cudnnCreate(&handles[new_device_id])); |
| 109 | |
| 110 | // Finally, return the handle for the current device |
| 111 | return handles[new_device_id]; |
| 112 | } |
| 113 | |
| 114 | private: |
| 115 |
no test coverage detected