DPCT1093#

Message#

The <Device ID> device may be not the one intended for use. Adjust the selected device if needed.

Detailed Help#

The cudaSetDevice function sets the device to run the code on. After migration to SYCL*, the logic for device selection may need to be updated.

For example, this original CUDA* code:

1int main(int argc, char **argv) {
2  cudaSetDevice(1); // Device 1 is the best choice in the original code.
3  foo(argc, argv);
4  ...
5  return 0;
6}

results in the following migrated SYCL code:

 1int main(int argc, char **argv) {
 2  /*
 3  DPCT1093:0: The "1" device may be not the one intended for use. Adjust the
 4  selected device if needed.
 5  */
 6  dpct::select_device(1); // Device 1 maybe not the best choice in SYCL.
 7  foo(argc, argv);
 8  ...
 9  return 0;
10}

which is manually adjusted to:

1int main(int argc, char **argv) {
2  // User can check device list by command `sycl-ls` and filter the device by using
3  // environment variable `ONEAPI_DEVICE_SELECTOR`.
4  dpct::select_device(0);
5  foo(argc, argv);
6  ...
7  return 0;
8}

Suggestions to Fix#

Review and adjust the device selection logic if needed.