Restrictions on Offloaded Code Using Shared Virtual Memory

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

Offloaded code using virtual shared memory has the following restrictions:

  • Multiple host CPU threads can execute concurrently while one host CPU thread offloads a section of code. In this case, synchronization mechanisms such as locks, atomics, mutexes, OpenMP* atomic operations, OpenMP critical, OpenMP taskwait, OpenMP barriers, etc. do not work between the host CPU code and code that is offloaded to the coprocessor. However, if parallelism on the host CPU is enabled using OpenMP, then OpenMP synchronization at the end of a parallel region is guaranteed to work even if some part of the OpenMP parallel region has been offloaded to the coprocessor.

  • Exception handling may be done as usual within code running on the CPU and within code running on the coprocessor. So exceptions can be raised, caught and handled on the CPU, or raised, caught and handled on the coprocessor. However it is not possible to propagate an exception from the coprocessor to the CPU.

  • Virtual shared memory classes that allocate and free memory must use either the _Offload_shared_malloc() and _Offload_shared_free() or _Offload_shared_aligned_malloc() and _Offload_shared_aligned_free() APIs instead of standard allocate and free APIs.

    For an example, see install-dir/Samples/en_US/C++/mic_samples/LEO_tutorial.

    Standard Template libraries which provide classes that allocate and free their own memory are not usable currently with _Cilk_shared unless they are modified to use the _Offload_shared_* specific APIs mentioned above.

  • Runtime Type Information (RTTI) is not supported under the Shared Virtual memory programming method. Specifically, use of dynamic_cast<> and typeid() is not supported.

For more complete information about compiler optimizations, see our Optimization Notice.