1 //===- llvm-omp-device-info.cpp - Obtain device info as seen from OpenMP --===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This is a command line utility that, by using Libomptarget, and the device
10 // plugins, list devices information as seen from the OpenMP Runtime.
12 //===----------------------------------------------------------------------===//
14 #include "omptarget.h"
17 int main(int argc
, char **argv
) {
18 __tgt_bin_desc EmptyDesc
= {0, nullptr, nullptr, nullptr};
19 __tgt_register_lib(&EmptyDesc
);
20 __tgt_init_all_rtls();
22 for (int Dev
= 0; Dev
< omp_get_num_devices(); Dev
++) {
23 printf("Device (%d):\n", Dev
);
24 if (!__tgt_print_device_info(Dev
))
25 printf(" print_device_info not implemented\n");
29 __tgt_unregister_lib(&EmptyDesc
);