Intel® Fortran Compiler 16.0 User and Reference Guide

Dealing with Multiple Coprocessors in a System

This topic only applies to Intel® Many Integrated Core Architecture (Intel® MIC Architecture).

Use the functions described in this section to determine:

Use the header file mic_lib.f90 to define the interfaces for these functions and their usage. Include it with USE mic_lib.

Note

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.

Determining the Number of Coprocessors in a System

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.

Determining the Coprocessor on Which a Program is Running

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.

Determining if Code has Completed Running on a Coprocessor

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)

See Also