Skip to content

Commit

Permalink
Merge branch 'pipeline' of github.com:zhaorz/FlowOnTheGo into pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Zhao committed May 10, 2017
2 parents 56e5b53 + 2ae3b3b commit 9c404c1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ namespace OFC {
patch_x.resize(op->n_vals,1);
patch_y.resize(op->n_vals,1);

checkCudaErrors(
/*checkCudaErrors(
cudaMalloc ((void**) &pDevicePatch, patch.size() * sizeof(float)) );
checkCudaErrors(
cudaMalloc ((void**) &pDevicePatchX, patch_x.size() * sizeof(float)) );
checkCudaErrors(
cudaMalloc ((void**) &pDevicePatchY, patch_y.size() * sizeof(float)) );
cudaMalloc ((void**) &pDevicePatchY, patch_y.size() * sizeof(float)) );*/
checkCudaErrors(
cudaMalloc ((void**) &pDeviceRawDiff, patch.size() * sizeof(float)) );
checkCudaErrors(
Expand All @@ -76,9 +76,9 @@ namespace OFC {

PatClass::~PatClass() {

cudaFree(pDevicePatch);
/*cudaFree(pDevicePatch);
cudaFree(pDevicePatchX);
cudaFree(pDevicePatchY);
cudaFree(pDevicePatchY);*/

cudaFree(pDeviceRawDiff);
cudaFree(pDeviceCostDiff);
Expand Down
35 changes: 20 additions & 15 deletions src/patchgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ namespace OFC {
pHostDevicePatchXs = new float*[n_patches];
pHostDevicePatchYs = new float*[n_patches];

float* pHostDeviceTempXX[n_patches];
float* pHostDeviceTempXY[n_patches];
float* pHostDeviceTempYY[n_patches];
pHostDeviceTempXX = new float*[n_patches];
pHostDeviceTempXY = new float*[n_patches];
pHostDeviceTempYY = new float*[n_patches];

for (int i = 0; i < n_patches; i++) {
checkCudaErrors(
Expand Down Expand Up @@ -156,13 +156,14 @@ namespace OFC {
PatGridClass::~PatGridClass() {

for (int i = 0; i < n_patches; ++i) {
cudaFree(pDevicePatches[i]);
cudaFree(pDevicePatchXs[i]);
cudaFree(pDevicePatchYs[i]);

cudaFree(pDeviceTempXX[i]);
cudaFree(pDeviceTempXY[i]);
cudaFree(pDeviceTempYY[i]);
checkCudaErrors( cudaFree(pHostDevicePatches[i]) );
checkCudaErrors( cudaFree(pHostDevicePatchXs[i]) );
checkCudaErrors( cudaFree(pHostDevicePatchYs[i]) );

cudaFree(pHostDeviceTempXX[i]);
cudaFree(pHostDeviceTempXY[i]);
cudaFree(pHostDeviceTempYY[i]);

delete patches[i];
}
Expand All @@ -175,6 +176,10 @@ namespace OFC {
delete pHostDevicePatchXs;
delete pHostDevicePatchYs;

delete pHostDeviceTempXX;
delete pHostDeviceTempXY;
delete pHostDeviceTempYY;

delete midpointX_host;
delete midpointY_host;
cudaFree(pDeviceMidpointX);
Expand Down Expand Up @@ -263,7 +268,7 @@ namespace OFC {

void PatGridClass::AggregateFlowDense(float *flowout) {

bool isValid[n_patches];
/*bool isValid[n_patches];
float flowXs[n_patches];
float flowYs[n_patches];
float* costs[n_patches];
Expand Down Expand Up @@ -295,7 +300,7 @@ namespace OFC {
checkCudaErrors( cudaMemcpy(deviceFlowYs, flowYs,
n_patches * sizeof(float), cudaMemcpyHostToDevice) );
checkCudaErrors( cudaMemcpy(deviceCosts, costs,
n_patches * sizeof(float*), cudaMemcpyHostToDevice) );
n_patches * sizeof(float*), cudaMemcpyHostToDevice) );*/


gettimeofday(&tv_start, nullptr);
Expand All @@ -306,12 +311,12 @@ namespace OFC {
checkCudaErrors(
cudaMemset (pDeviceFlowOut, 0.0, i_params->width * i_params->height * 2 * sizeof(float)) );

cu::densifyPatches(
/*cu::densifyPatches(
deviceCosts, pDeviceFlowOut, pDeviceWeights,
deviceFlowXs, deviceFlowYs, deviceIsValid,
pDeviceMidpointX, pDeviceMidpointY, n_patches,
op, i_params);
/*for (int ip = 0; ip < n_patches; ++ip) {
op, i_params);*/
for (int ip = 0; ip < n_patches; ++ip) {
if (patches[ip]->IsValid()) {

const Eigen::Vector2f* fl = patches[ip]->GetCurP(); // flow displacement of this patch
Expand All @@ -326,7 +331,7 @@ namespace OFC {
op->patch_size, op->min_errval);

}
}*/
}

gettimeofday(&tv_end, nullptr);
aggregateTime += (tv_end.tv_sec - tv_start.tv_sec) * 1000.0f +
Expand Down
1 change: 1 addition & 0 deletions src/patchgrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace OFC {
// Hessian
// TODO: Can we shared memory?
float** pDeviceTempXX, ** pDeviceTempXY, ** pDeviceTempYY;
float** pHostDeviceTempXX, **pHostDeviceTempXY, **pHostDeviceTempYY;
float* pDeviceH00, * pDeviceH01, * pDeviceH11;
float* H00, * H01, * H11;

Expand Down

0 comments on commit 9c404c1

Please sign in to comment.