I want to use my two graphic cards for calculation with CUDA Thrust.
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.
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.
I am not sure what the exact problem is, or how to use both cards for calculation.
Minimal code sample:
std::vector<thrust::device_vector<float> > TEST() {
std::vector<thrust::device_vector<float> > vRes;
unsigned int iDeviceCount = GetCudaDeviceCount();
for(unsigned int i = 0; i < iDeviceCount; i++) {
checkCudaErrors(cudaSetDevice(i) );
thrust::host_vector<float> hvConscience(1024);
// first run works, runs afterwards cause errors ..
vRes.push_back(hvConscience); // this push_back causes the error on exec
}
return vRes;
}
Error message on execution:
terminate called after throwing an instance of 'thrust::system::system_error'
what(): invalid argument