mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added cuda bindings: get_device_name(), set_current_device_blocking_sync().
This commit is contained in:
parent
c7f27517e1
commit
f194bdc948
@ -27,6 +27,21 @@ namespace dlib
|
||||
return dev;
|
||||
}
|
||||
|
||||
std::string get_device_name (
|
||||
int device
|
||||
)
|
||||
{
|
||||
cudaDeviceProp props;
|
||||
CHECK_CUDA(cudaGetDeviceProperties(&props, device));
|
||||
return props.name;
|
||||
}
|
||||
|
||||
void set_current_device_blocking_sync(
|
||||
)
|
||||
{
|
||||
CHECK_CUDA(cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync));
|
||||
}
|
||||
|
||||
int get_num_devices (
|
||||
)
|
||||
{
|
||||
|
@ -23,6 +23,13 @@ namespace dlib
|
||||
int get_num_devices (
|
||||
);
|
||||
|
||||
std::string get_device_name (
|
||||
int device
|
||||
);
|
||||
|
||||
void set_current_device_blocking_sync(
|
||||
);
|
||||
|
||||
bool can_access_peer (int device_id, int peer_device_id);
|
||||
bool can_access_peer (const tensor& device, const tensor& peer_device);
|
||||
|
||||
@ -285,6 +292,18 @@ namespace dlib
|
||||
inline int get_num_devices (
|
||||
) { return 1; }
|
||||
|
||||
inline std::string get_device_name (
|
||||
int device
|
||||
)
|
||||
{
|
||||
DLIB_CASSERT(id == 0, "dlib::cuda::set_device(id) called with an invalid device id.");
|
||||
return "CUDA_DISABLED";
|
||||
}
|
||||
|
||||
inline void set_current_device_blocking_sync(
|
||||
) {}
|
||||
|
||||
|
||||
inline bool can_access_peer (int , int )
|
||||
{ return false; }
|
||||
inline bool can_access_peer (const tensor& , const tensor& )
|
||||
|
Loading…
Reference in New Issue
Block a user