Appearance
fundal_dev_handling
FUNDAL, device handling module.
Source: src/lib/fundal_dev_handling.F90
Dependencies
Contents
- host_fallback_policy
- dev_get_device_memory_info
- dev_get_property_string
- dev_set_device_num
- dev_init
- dev_is_host_fallback
- env_upper
- dev_get_device_num
- dev_get_device_type
- dev_get_host_num
- dev_get_num_devices
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
fallback_warned | logical | Host fallback warning already issued (once per process). |
Subroutines
host_fallback_policy
Apply the host-fallback policy once dev_host_fallback is known: if a device is required (argument or environment) fail, returning FUNDAL_ERR_NO_DEVICE if ierr is present or stopping otherwise; else warn (once per process) that the run is on the host, unless the host was explicitly requested through the environment.
fortran
subroutine host_fallback_policy(require_device, forced_by, host_requested, ierr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
require_device | logical | in | Device required by the caller. | |
forced_by | character(len=*) | in | Environment setting requiring a device, empty if none. | |
host_requested | logical | in | Host explicitly requested by the environment. | |
ierr | integer(kind=I4P) | out | optional | Error status. |
dev_get_device_memory_info
Get the current device memory status.
fortran
subroutine dev_get_device_memory_info(mem_free, mem_total)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
mem_free | integer(kind=I8P) | out | optional | Free memory. |
mem_total | integer(kind=I8P) | out | optional | Total memory. |
Call graph
dev_get_property_string
Return the value of a device-property for the specified device. Note: host fallback does not provide such a runtime routine, added only for seamless unified API.
fortran
subroutine dev_get_property_string(dev_num, string, prefix, memory)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dev_num | integer | in | value | Device ID. |
string | character(len=*) | out | Stringified device property. | |
prefix | character(len=*) | in | optional | String prefix. |
memory | integer(kind=I8P) | out | optional | Device memory. |
dev_set_device_num
Set the runtime for the specified device type and device number, and make it the default device of FUNDAL (mydev). Note: host fallback does not provide such a runtime routine, added only for seamless unified API: mydev stays 0.
fortran
subroutine dev_set_device_num(dev_num)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dev_num | integer | in | value | Device ID. |
Call graph
dev_init
Initialize device. Note: the compile-time CPU mode (no device backend) is an explicit build choice, not a host fallback: nothing to initialize, dev_is_host_fallback stays false and require_device is ignored. Same signature as the device backends.
fortran
subroutine dev_init(local_rank, require_device, ierr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
local_rank | integer(kind=I4P) | in | optional | Local rank in multi-processes split ID (unused). |
require_device | logical | in | optional | Forbid the host fallback (unused). |
ierr | integer(kind=I4P) | out | optional | Error status, always 0. |
Call graph
Functions
dev_is_host_fallback
Return true if the library is compiled for a device backend (OpenACC/OpenMP) but dev_init found no device, so that "device" memory and kernels live on the host. Always false in the compile-time CPU mode (no backend) and before dev_init.
Returns: logical
fortran
function dev_is_host_fallback() result(is_fallback)env_upper
Return the value of an environment variable, upper case and trimmed; empty if not set.
Returns: character(len=:)
fortran
function env_upper(name) result(val)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Variable name. |
dev_get_device_num
Return the value of current device ID for the current thread. Note: host fallback does not provide such a runtime routine, added only for seamless unified API.
Returns: integer(kind=I4P)
fortran
function dev_get_device_num() result(device_num)Call graph
dev_get_device_type
Return the device type. Note: host fallback does not provide such a runtime routine, added only for seamless unified API.
Returns: integer(kind=I4P)
fortran
function dev_get_device_type() result(devtype_)dev_get_host_num
Return the value of current host ID for the current thread. Note: host fallback does not provide such a runtime routine, added only for seamless unified API.
Returns: integer(kind=I4P)
fortran
function dev_get_host_num() result(host_num)dev_get_num_devices
Return the number of available (non host) devices. Note: host fallback does not provide such a runtime routine, added only for seamless unified API.
Returns: integer(kind=I4P)
fortran
function dev_get_num_devices() result(devices_number)