Commit 2703a72d authored by Davis King's avatar Davis King

Added get_num_devices()

parent 603d4743
...@@ -27,6 +27,14 @@ namespace dlib ...@@ -27,6 +27,14 @@ namespace dlib
return dev; return dev;
} }
int get_num_devices (
)
{
int num_devices;
CHECK_CUDA(cudaGetDeviceCount(&num_devices));
return num_devices;
}
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
__global__ void _cuda_multiply1(float* d, const float* s1, const float* s2, size_t n) __global__ void _cuda_multiply1(float* d, const float* s1, const float* s2, size_t n)
......
...@@ -22,6 +22,9 @@ namespace dlib ...@@ -22,6 +22,9 @@ namespace dlib
int get_device ( int get_device (
); );
int get_num_devices (
);
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void multiply ( void multiply (
...@@ -165,6 +168,9 @@ namespace dlib ...@@ -165,6 +168,9 @@ namespace dlib
inline int get_device ( inline int get_device (
){ return 0; } ){ return 0; }
int get_num_devices (
) { return 1; }
#endif // DLIB_USE_CUDA #endif // DLIB_USE_CUDA
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment