CMU 15-618 Parallel Programming, May 2020
Author: Ziqi Chen, Yuxin Ding
This repository contains the implementations of two image editing algorithms, the Poisson Image Editing algorithm and the PatchMatch algorithm.
For each algorithm, there is a sequential version and three parallel versions, written in OpenMP, CUDA and Halide.
For Halide, there are multiple implementations, with manual scheduling or auto scheduling.
The project is developed on a x86 Red Hat Linux machine.
-
OpenCV 3.4.0 or above
-
OpenMP
-
CUDA 10.2
-
Halide
Please find a precompiled release or compile from source (link).
The paper: PatchMatch: A Randomized Correspondence Algorithm for Structural Image Editing
The code implements a basic application of the algorithm, which reconstructs a target image using a source image.
Target | Source | Output |
---|---|---|
cd patchmatch/seq
# cd patchmatch/omp
# cd patchmatch/cuda
# change input/output files in Makefile, if necessary
# ...
make
make test
cd patchmatch/halide
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HALIDE_INSTALL_PATH/bin
-
Auto Schedule
make auto_all make auto_test
-
Manual Schedule
make halide make test
The paper: Poisson Image Editing
Source | Target | Mask | Output |
---|---|---|---|
cd poisson/seq
cmake.
make
./PoissonImageEdit ../input/1/source.png ../input/1/target.png ../input/1/mask.png
cd poisson/cuda
make
./PoissonImageEdit ../input/1/source.png ../input/1/target.png ../input/1/mask.png
cd poisson/omp
make
./PoissonImageEdit ../input/1/source.png ../input/1/target.png ../input/1/mask.png
-
Halide Auto Schedule
cd poisson/halide make auto_gen export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HALIDE_PATH/bin make auto_schedule_false make auto_schedule_true make auto ./PoissonAuto
-
Halide Manual Schedule
Set
USE_GPU
in PoissonImageEdit_GPU.cpp to 0cd poisson/halide make gpuversion ./PoissonImageEdit_GPU
-
Halide GPU version
Set
USE_GPU
in PoissonImageEdit_GPU.cpp to 1cd poisson/halide make gpuversion ./PoissonImageEdit_GPU