Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / tools / deviceinfo / llvm-omp-device-info.cpp
blob7dd22aec9828f42ddd26b3b8b74f57fdc2d3c559
1 //===- llvm-omp-device-info.cpp - Obtain device info as seen from OpenMP --===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
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"
15 #include <cstdio>
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");
26 printf("\n");
29 __tgt_unregister_lib(&EmptyDesc);
30 return 0;