thirdparty/cuda/api/stream.hpp
inline device::id_t associated_device(stream::id_t stream_id)
{
	if (stream_id == cuda::stream::default_stream_id) {
		throw std::invalid_argument("Cannot determine device association for the default/null stream");
	}
	for(device::id_t device_index = 0; device_index < device::count(); ++device_index) {
		if (is_associated_with(stream_id, device_index)) { return device_index; }
	}
	throw std::runtime_error(
		"Could not find any device associated with stream " + cuda::detail::ptr_as_hex(stream_id));
}
/**
 * @brief Obtains the device ID with which a stream with a given ID is associated
 *
 * Strangely enough, CUDA won't tell you which device a stream is associated with,
 * while it can - supposedly - tell this itself when querying stream status. So,
 * let's use that. This is ugly and possibly buggy, but it _might_ just work.
 *
 * @param stream_id a stream identifier
 * @return the identifier of the device for which the stream was created.
 */
@brief Obtains the device ID with which a stream with a given ID is associated
Strangely enough, CUDA won't tell you which device a stream is associated with,
while it can - supposedly - tell this itself when querying stream status. So,
let's use that. This is ugly and possibly buggy, but it _might_ just work.

@param stream_id a stream identifier
@return the identifier of the device for which the stream was created.
@brief Obtains the device ID with which a stream with a given ID is associated Strangely enough CUDA won ' t tell you which device a stream is associated with while it can - supposedly - tell this itself when querying stream status . So let ' s use that . This is ugly and possibly buggy but it _might_ just work . @param stream_id a stream identifier @return the identifier of the device for which the stream was created .
inline device::id_t associated_device(stream::id_t stream_id)
{
	if (stream_id == cuda::stream::default_stream_id) {
		throw std::invalid_argument("Cannot determine device association for the default/null stream");
	}
	for(device::id_t device_index = 0; device_index < device::count(); ++device_index) {
		if (is_associated_with(stream_id, device_index)) { return device_index; }
	}
	throw std::runtime_error(
		"Could not find any device associated with stream " + cuda::detail::ptr_as_hex(stream_id));
}
inline device :: id_t associated_device ( stream :: id_t stream_id ) { if ( stream_id == cuda :: stream :: default_stream_id ) { throw std :: invalid_argument ( " " ) ; } for ( device :: id_t device_index = 0 ; device_index < device :: count ( ) ; ++ device_index ) { if ( is_associated_with ( stream_id , device_index ) ) { return device_index ; } } throw std :: runtime_error ( " " + cuda :: detail :: ptr_as_hex ( stream_id ) ) ; }
@brief Obtains the device ID with which a stream with a given ID is associated
 Strangely enough, CUDA won't tell you which device a stream is associated with,
 while it can - supposedly - tell this itself when querying stream status.
@brief Obtains the device ID with which a stream with a given ID is associated Strangely enough CUDA won ' t tell you which device a stream is associated with while it can - supposedly - tell this itself when querying stream status .