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. */
13 /* Print the values of the properties of all devices of the given type
14 and do basic device independent validation. */
17 print_device_properties (acc_device_t type
)
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");
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");
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");
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
);