An AMD ROCm validation utility stores device identifiers in ascending order. Given this sorted array and a target identifier, return the index of the target's first occurrence. Return -1 if the target is absent.
The solution must use binary search rather than scanning the array sequentially, because validation runs may contain millions of sorted entries.
Implement find_first_device(device_ids, target).
device_ids, a list of integers sorted in nondecreasing order, and target, an integer.i such that device_ids[i] == target, or -1 when no such index exists.def find_first_device(device_ids, target):