added init() function into MultiGpuMgr, added samples

This commit is contained in:
Alexey Spizhevoy
2011-02-15 10:03:26 +00:00
parent 5d4913a2ee
commit 725d83b0e5
5 changed files with 274 additions and 8 deletions

View File

@@ -120,25 +120,25 @@ int main(int argc, char** argv)
// Init CUDA Driver API
safeCall(cuInit(0));
// Create context for the first GPU
// Create context for GPU #0
CUdevice device;
safeCall(cuDeviceGet(&device, 0));
safeCall(cuCtxCreate(&contexts[0], 0, device));
contextOff();
// Create context for the second GPU
// Create context for GPU #1
safeCall(cuDeviceGet(&device, 1));
safeCall(cuCtxCreate(&contexts[1], 0, device));
contextOff();
// Split source images for processing on the first GPU
// Split source images for processing on GPU #0
contextOn(0);
d_left[0].upload(left.rowRange(0, left.rows / 2));
d_right[0].upload(right.rowRange(0, right.rows / 2));
bm[0] = new StereoBM_GPU();
contextOff();
// Split source images for processing on the second GPU
// Split source images for processing on the GPU #1
contextOn(1);
d_left[1].upload(left.rowRange(left.rows / 2, left.rows));
d_right[1].upload(right.rowRange(right.rows / 2, right.rows));