cuihaoleo / gmtsar_optimize

Parallel xcorr programs for multi-core CPUs and GPUs for GMTSAR.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parallel xcorr programs for GMTSAR

Introduction

In GMTSAR package, xcorr program is the main part of InSAR image registration. We apply parallel optimization to xcorr program of GMTSAR package. We provide two programs for different hardwares:

  • xcorr2 program is the multi-thread version
  • xcorr2_cl program is the GPU accelerated version

Dependencies & Build

The code is written in C (xcorr2) and C++ (xcorr2_cl). To build the programs, C/C++ development tools must be installed. GNU toolchain is preferred, which includes gcc and g++ compilers, and make tools.

xcorr2 depends on following libraries:

  • FFTW 3 (3.3.6 tested)
  • Glib 2 (2.52.3 tested)

xcorr2_cl depends on following libraries:

  • ArrayFire (3.5.0 tested)
  • GPU drivers and GPGPU libraries (CUDA or OpenCL toolkits)

OS-specific building instructions are as follows.

Ubuntu 16.04 LTS

Install GNU toolchain:

apt-get install build-essential

Install building dependencies of xcorr2:

apt-get install libglib2.0-dev libfftw3-dev

Install building dependencies of xcorr2_cl:

apt-get install libarrayfire-unified-dev libarrayfire-opencl3

Then, cd into source directory and run make to build the binaries.

make xcorr2     # build xcorr2 only
make xcorr2_cl  # build xcorr2_cl only
make            # build all binaries

Now you should get executable xcorr2 and/or xcorr2_cl binaries.

To enable GPU acceleration, proper GPU drivers and OpenCL runtime libraries must be installed as well.

For recent NVIDIA cards with proprietary driver installed, install NVIDIA OpenCL driver (or full CUDA toolkit):

apt-get install nvidia-opencl-icd-XXX
# where XXX must be the same as the version of NVIDIA driver

For AMD/NVIDIA cards with open-source driver installed, install Mesa implementation of OpenCL:

apt-get install mesa-opencl-icd

macOS (with Homebrew)

Following instructions assume that GMT5SAR and its dependencies has been installed. If not, please follow GMTSAR's installation guide.

Ensure pkg-config is installed:

brew install pkg-config

Install building dependencies of xcorr2_cl:

brew install arrayfire

Then, cd into source directory and run make to build the binaries.

make xcorr2     # build xcorr2 only
make xcorr2_cl  # build xcorr2_cl only
make            # build all binaries

Now you should get executable xcorr2 and/or xcorr2_cl binaries.

Note: We don't have MacBook with discrete graphics card, so OpenCL version is not fully tested on macOS.

Usage

xcorr2 and xcorr2_cl provide exact the same arguments as GMTSAR xcorr program.

For example, run it on ALOS SLC generated by GMTSAR:

xcorr2 IMG-HH-ALPSRP207600640-H1.0__A.PRM IMG-HH-ALPSRP227730640-H1.0__A.PRM -xsearch 64 -ysearch 64 -nx 32 -ny 64 -range_interp 2 -interp 16

xcorr2 and xcorr2_cl is designed to be seamlessly integrated into GMTSAR package. To accelerate image registration in GMTSAR processing chain, you may simply replace original xcorr program with xcorr2 or xcorr2_cl.

We also provide a script called xcorr2_helper to simplify the usage. To use it, build the binaries first and add the source directory to PATH enviroment variable:

export PATH=path/to/gmtsar_optimize:$PATH   # bash
setenv PATH path/to/gmtsar_optimize\:$PATH  # csh

Then prepend xcorr2_helper <profile> to GMTSAR commands to enable parallel xcorr program, where <profile> can be mt (for multi-thread version) or opencl (for OpenCL GPU version). For example:

xcorr2_profile mt p2p_ALOS.csh IMG-HH-ALPSRP207600640-H1.0__A IMG-HH-ALPSRP227730640-H1.0__A config.alos.txt
xcorr2_profile opencl p2p_ALOS.csh IMG-HH-ALPSRP207600640-H1.0__A IMG-HH-ALPSRP227730640-H1.0__A config.alos.txt

More examples

Use multi-thread version xcorr2 on ENVI_Baja_EQ dataset:

xcorr2_helper p2p_ENVI.csh ENV1_2_084_2943_2961_42222 ENV1_2_084_2943_2961_42723 config.envi.txt

Use OpenCL version xcorr2_cl on ALOS2_SCAN_SSAF dataset:

xcorr2_helper opencl p2p_ALOS2_SCAN_SLC.csh IMG-HH-ALOS2022872950-141025-WBDR1.1__D IMG-HH-ALOS2029082950-141206-WBDR1.1__D config.alos2.scan.txt 1
xcorr2_helper opencl p2p_ALOS2_SCAN_SLC.csh IMG-HH-ALOS2022872950-141025-WBDR1.1__D IMG-HH-ALOS2029082950-141206-WBDR1.1__D config.alos2.scan.txt 2
xcorr2_helper opencl p2p_ALOS2_SCAN_SLC.csh IMG-HH-ALOS2022872950-141025-WBDR1.1__D IMG-HH-ALOS2029082950-141206-WBDR1.1__D config.alos2.scan.txt 3
xcorr2_helper opencl p2p_ALOS2_SCAN_SLC.csh IMG-HH-ALOS2022872950-141025-WBDR1.1__D IMG-HH-ALOS2029082950-141206-WBDR1.1__D config.alos2.scan.txt 4
xcorr2_helper opencl p2p_ALOS2_SCAN_SLC.csh IMG-HH-ALOS2022872950-141025-WBDR1.1__D IMG-HH-ALOS2029082950-141206-WBDR1.1__D config.alos2.scan.txt 5

About

Parallel xcorr programs for multi-core CPUs and GPUs for GMTSAR.

License:MIT License


Languages

Language:C 62.3%Language:C++ 18.3%Language:Python 17.5%Language:Makefile 1.9%