This is a computer translation of the original content. It is provided for general information only and should not be relied upon as complete or accurate.

Sorry, we can't translate this content right now, please try again later.

Purpose:If you want to manage data manually in certain parts of your application and also want to take advantage of MKL Automatic offload in others, you can do that as explained in the following example

This Article provides example on using Compiler Assisted Offload and Automatic Offload together

The example can be used to simulate concurrent access to MIC from MKL AO and offload compiler w/ and w/o manual synchronization between them

The example consists of:

t.c – the example’s source code

run – the run script that sets up environment, builds example’s binary, and launches it with user-provided parameters

t.simple.c – a simpler version of the example which does not support manual synchronization but is a bit easier to understand (see below)

The example can either run offload and AO DGEMM one after another (if the first command line argument is ‘0’) or concurrently (if the first command line argument is ‘1’)

The manual synchronization mode is enabled by passing ‘1’ as the second command line argument and mimics ORSL: it places mutexes around offload/AO DGEMM calls. Moreover, it allows AO DGEMM to fall back to host if the lock is already set. The simpler version of the example does not support manual synchronization

Some run logs can be found below. It seems like in *this example* sometimes *not* synchronizing is slightly better than always synchronizing presumably because computations never overlap and we get slightly better performance due to overlapped computations spawned from offload compiler/MKL and communications spawned from MKL/offload compiler.