added init() function into MultiGpuMgr, added samples
This commit is contained in:
@@ -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));
|
||||
|
Reference in New Issue
Block a user