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.c
11 print *, "acc_device_none:"
12 ! For completeness; not expected to print anything
13 call print_device_properties (acc_device_none
)
15 print *, "acc_device_default:"
16 call print_device_properties (acc_device_default
)
18 print *, "acc_device_host:"
19 call print_device_properties (acc_device_host
)
21 print *, "acc_device_not_host:"
22 call print_device_properties (acc_device_not_host
)
25 ! Print the values of the properties of all devices of the given type
26 ! and do basic device independent validation.
27 subroutine print_device_properties (device_type
)
29 use iso_c_binding
, only
: c_size_t
32 integer, intent(in
) :: device_type
34 integer :: device_count
36 integer(c_size_t
) :: v
39 device_count
= acc_get_num_devices(device_type
)
41 do device
= 0, device_count
- 1
42 print "(a, i0)", " Device ", device
44 call acc_get_property_string (device
, device_type
, acc_property_vendor
, s
)
45 print "(a, a)", " Vendor: ", trim (s
)
47 print *, "acc_property_vendor should not be empty."
51 v
= acc_get_property (device
, device_type
, acc_property_memory
)
52 print "(a, i0)", " Total memory: ", v
54 print *, "acc_property_memory should not be negative."
58 v
= acc_get_property (device
, device_type
, acc_property_free_memory
)
59 print "(a, i0)", " Free memory: ", v
61 print *, "acc_property_free_memory should not to be negative."
65 v
= acc_get_property (device
, device_type
, int(2360, kind
= acc_device_property
))
67 print *, "Value of unknown numeric property should be 0."
71 call acc_get_property_string (device
, device_type
, acc_property_name
, s
)
72 print "(a, a)", " Name: ", trim (s
)
74 print *, "acc_property_name should not be empty."
78 call acc_get_property_string (device
, device_type
, acc_property_driver
, s
)
79 print "(a, a)", " Driver: ", trim (s
)
81 print *, "acc_property_driver should not be empty."
85 call acc_get_property_string (device
, device_type
, int(4060, kind
= acc_device_property
), s
)
87 print *, "Value of unknown string property should be empty string."
92 end subroutine print_device_properties