title: Multi GPU usage with CUDA Thrust
body: <p>I want to use my two graphic cards for calculation with CUDA Thrust. </p>
  
  <p>I have two graphic cards. Running on single cards works well for both cards, even when I store two device_vectors in the std::vector. </p>
  
  <p>If I use both cards at the same time, the first cycle in the loop works and causes no error. After the first run it causes an error, probably because the device pointer is not valid. </p>
  
  <p>I am not sure what the exact problem is, or how to use both cards for calculation.  </p>
  
  <p>Minimal code sample:</p>
  
  <pre><code>std::vector&lt;thrust::device_vector&lt;float&gt; &gt; TEST() {
      std::vector&lt;thrust::device_vector&lt;float&gt; &gt; vRes;
  
      unsigned int iDeviceCount   = GetCudaDeviceCount();
      for(unsigned int i = 0; i &lt; iDeviceCount; i++) {
          checkCudaErrors(cudaSetDevice(i) ); 
          thrust::host_vector&lt;float&gt; hvConscience(1024);
  
                  // first run works, runs afterwards cause errors ..
          vRes.push_back(hvConscience); // this push_back causes the error on exec
  
      }
      return vRes;
  }
  </code></pre>
  
  <p>Error message on execution:</p>
  
  <pre><code>terminate called after throwing an instance of 'thrust::system::system_error'
  what():  invalid argument
  </code></pre>