vector<DeviceInfo>& Device::available_devices() { thread_scoped_lock lock(device_mutex); if(need_devices_update) { devices.clear(); #ifdef WITH_OPENCL if(device_opencl_init()) { device_opencl_info(devices); } #endif #ifdef WITH_CUDA if(device_cuda_init()) { device_cuda_info(devices); } #endif device_cpu_info(devices); #ifdef WITH_NETWORK device_network_info(devices); #endif need_devices_update = false; } return devices; }
vector<DeviceInfo>& Device::available_devices() { static vector<DeviceInfo> devices; static bool devices_init = false; if(!devices_init) { #ifdef WITH_CUDA if(device_cuda_init()) device_cuda_info(devices); #endif #ifdef WITH_OPENCL if(device_opencl_init()) device_opencl_info(devices); #endif #ifdef WITH_MULTI device_multi_info(devices); #endif device_cpu_info(devices); #ifdef WITH_NETWORK device_network_info(devices); #endif devices_init = true; } return devices; }
vector<DeviceInfo>& Device::available_devices() { if(need_devices_update) { devices.clear(); #ifdef WITH_CUDA if(device_cuda_init()) device_cuda_info(devices); #endif #ifdef WITH_OPENCL if(device_opencl_init()) device_opencl_info(devices); #endif #ifdef WITH_MULTI device_multi_info(devices); #endif device_cpu_info(devices); #ifdef WITH_NETWORK device_network_info(devices); #endif need_devices_update = false; } return devices; }