Skip to content

compile

ericwait edited this page Mar 8, 2019 · 1 revision

Build Hydra Image processor from Source Code

There are binaries available for Windows and linux here. If you desire to build directly from source, HIP comes with two options: Visual Studio solution (Windows) or Makefile (linux). Future releases will utilize CMake to assist in setting up your environment. In the meantime, please use the following directions to set up your development environment.

Windows

IMPORTANT NOTE

Registry settings need to be set for HIP to run successfully on any appreciable data sizes. Please restart your computer after applying.

On Windows devices, the operating system is very particular about having immediate access and availability of the graphics card. With HIP operations that take more than a few hundred milliseconds, the operating system thinks that the graphics card is unresponsive to draw the screen. After a few attempts without success, Windows will attempt to restart the graphics driver. When this happens, HIP will crash because the hardware has been taken away mid-operation. There is a way to tell Windows to be more patient.

Included in the root of the repository are three TDR delay registry files. Each one contains setting to delay the operating system from reseting the graphics driver. I recommend using the tdrDelay_standard.reg file for most configurations. However, if you are using a older graphics card or a mobile version (like that in the Surface Book), I would recommend the tdrDelay_LONG.reg. You could just use the LONG version no matter what your configuration. However, these settings will also delay legitimate errors with the graphics driver. Meaning that if you install a program that crashes the graphics driver, your computer might seem unresponsive for up to 15 minutes before the operating system steps in to recover.

Some of you might be rightfully weary of having your registry changed by some file you found on the Internet. I understand completely. Or maybe your just curious to know what each of the registry values mean. You can either search for "TDR Delay" with your favorite search engine or go to Microsoft's document page on TDR Delay here. If you are still unsure, leave a comment in one of the forums.

Build

The full Hydra Image Processing library can be built using the Visual Studio solution file src/c/CudaImageProccessing.sln. Python bindings are built as part of the main solution, or can be built separately by src/c/CudaPy3DLL.vcxproj.

Two environment variables must be defined for a successful build:

  1. PYTHON3_DIR - Root directory of the Python 3.x installation to build against
  2. NUMPY3_DIR - Root directory of the Numpy installation to build against

It is currently simplest to build Python bindings using the full solution file, at present, as the Python project is dependent on the core image processing library. NOTE: Unless you have Debug build of Python 3.x, the bindings must be built in Release mode.

Python Bindings

Requirements:

Experimental Python bindings have been created for the Hydra Image Processing library, however, they must currently be built from source, since Python versions only support limited binary compatibility.

Installation and Usage

After a successful build the file src/Python/HIP.pyd should be placed in a directory on the PYTHON_PATH to make the Hydra Image Processing tools accessible from Python.

For use in Python import the HIP module:

import HIP

Example of blurring a random numpy volume:

import HIP
import numpy as np

im = np.random.randint(0,256, size=(512,512,25), dtype=np.uint8)
imOut = HIP.Gaussian(im, [25,25,10])