Skip to content

fundal_dev_handling ​

FUNDAL, device handling module.

Source: src/lib/fundal_dev_handling.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
fallback_warnedlogicalHost 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

NameTypeIntentAttributesDescription
require_devicelogicalinDevice required by the caller.
forced_bycharacter(len=*)inEnvironment setting requiring a device, empty if none.
host_requestedlogicalinHost explicitly requested by the environment.
ierrinteger(kind=I4P)outoptionalError status.

dev_get_device_memory_info ​

Get the current device memory status.

fortran
subroutine dev_get_device_memory_info(mem_free, mem_total)

Arguments

NameTypeIntentAttributesDescription
mem_freeinteger(kind=I8P)outoptionalFree memory.
mem_totalinteger(kind=I8P)outoptionalTotal 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

NameTypeIntentAttributesDescription
dev_numintegerinvalueDevice ID.
stringcharacter(len=*)outStringified device property.
prefixcharacter(len=*)inoptionalString prefix.
memoryinteger(kind=I8P)outoptionalDevice 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

NameTypeIntentAttributesDescription
dev_numintegerinvalueDevice 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

NameTypeIntentAttributesDescription
local_rankinteger(kind=I4P)inoptionalLocal rank in multi-processes split ID (unused).
require_devicelogicalinoptionalForbid the host fallback (unused).
ierrinteger(kind=I4P)outoptionalError 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

NameTypeIntentAttributesDescription
namecharacter(len=*)inVariable 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)