Intel® Fortran Compiler 16.0 User and Reference Guide
This topic only applies to Intel® Many Integrated Core Architecture (Intel® MIC Architecture).
Use the functions described in this section to determine:
the number of coprocessors in a system
the coprocessor on which a program is running
Use the header file mic_lib.f90 to define the interfaces for these functions and their usage. Include it with USE mic_lib.
In a system with multiple coprocessors, you need to specify the target-number argument when using the offload directive to reliably use data persistence. When you use alloc_if or free_if to implement data persistence on the coprocessor, but do not specify target-number, the compiler runtime randomly chooses a coprocessor, so the chosen coprocessor could be one on which the data is not available.
To determine the number of coprocessors in the system, use the function result = OFFLOAD_NUMBER_OF_DEVICES().
The function returns an integer equal to the number of coprocessors installed and working in the system. If none are installed and working, the return value is 0.
To determine the coprocessor that is executing the program, use the function result = OFFLOAD_GET_DEVICE_NUMBER().
The function returns an integer equal to the number of the coprocessor executing the program, where 0 is the first card. If the program is executing on the CPU, the return value is -1.
To determine if a section of offloaded code has completed running on a given coprocessor, you can use the API OFFLOAD_SIGNALED().
The syntax for this API is:
OFFLOAD_SIGNALED(target_number,signal)