Set num_threads to 50 on 32-bit hppa in two libgomp loop tests
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / acc_get_property.c
blob3460035f0035016940d417d2f887f7335e713f18
1 /* Test the `acc_get_property' and '`acc_get_property_string' library
2 functions by printing the results of those functions for all devices
3 of all device types mentioned in the OpenACC standard.
5 See also acc_get_property.f90. */
6 /* { dg-do run } */
8 #include <openacc.h>
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include <string.h>
13 /* Print the values of the properties of all devices of the given type
14 and do basic device independent validation. */
16 void
17 print_device_properties (acc_device_t type)
19 const char *s;
20 size_t v;
22 int dev_count = acc_get_num_devices (type);
24 for (int i = 0; i < dev_count; ++i)
26 printf (" Device %d:\n", i+1);
28 s = acc_get_property_string (i, type, acc_property_vendor);
29 printf (" Vendor: %s\n", s);
30 if (s == NULL || *s == 0)
32 fprintf (stderr, "acc_property_vendor should not be null or empty.\n");
33 abort ();
36 v = acc_get_property (i, type, acc_property_memory);
37 printf (" Total memory: %zu\n", v);
39 v = acc_get_property (i, type, acc_property_free_memory);
40 printf (" Free memory: %zu\n", v);
42 s = acc_get_property_string (i, type, acc_property_name);
43 printf (" Name: %s\n", s);
44 if (s == NULL || *s == 0)
46 fprintf (stderr, "acc_property_name should not be null or empty.\n");
47 abort ();
50 s = acc_get_property_string (i, type, acc_property_driver);
51 printf (" Driver: %s\n", s);
52 if (s == NULL || *s == 0)
54 fprintf (stderr, "acc_property_string should not be null or empty.\n");
55 abort ();
60 int
61 main ()
63 printf ("acc_device_none:\n");
64 /* For completness; not expected to print anything since there
65 should be no devices of this type. */
66 print_device_properties (acc_device_none);
68 printf ("acc_device_default:\n");
69 print_device_properties (acc_device_default);
71 printf ("acc_device_host:\n");
72 print_device_properties (acc_device_host);
74 printf ("acc_device_not_host:\n");
75 print_device_properties (acc_device_not_host);