title: Alternative OpenMP construct when a target device is present
body: <p>I have an OpenMP C code which has two constructs - one for running on a GPU, and one for the CPU.</p>
  <p>The first starts:</p>
  <pre><code>#pragma omp target teams distribute parallel for ...
  </code></pre>
  <p>while the second is:</p>
  <pre><code>#pragma omp parallel for
  </code></pre>
  <p>The first one also includes map clauses for data transfer.</p>
  <p>I want the first to be used if a target device exists, and otherwise to default to the second (to run on the host).</p>
  <p>What is the best way of doing this?</p>
  <p>Note, I can put preprocessor options around the constructs, but I am hoping this is not necessary.</p>