Skip to content

Installing LEAP without PyTorch

Kyle Champley edited this page Sep 11, 2024 · 19 revisions

LEAP is mostly a C/C++/CUDA library and thus can be used without PyTorch and used for general tomographic reconstruction. The library can be used from other C/C++ software or from Python with the provided wrapper class.

Dependencies

cmake version 3.23 or newer

CUDA toolkit 11.7 or newer (See section below about compiling without a GPU or on Mac)

Linux: gcc compiler

Windows: Visual Studio 2019 (be sure to check the box that says "Desktop development with C++")

If using the Python binding (leapctype.py), one only needs the standard Python packages, including numpy.

Python Binding

This LEAP API is bound to Python using ctypes (a standard Python package) with the file we provide called leapctype.py. To load and launch LEAP, use the following commands:

from leapctype import *
leapct = tomographicModels()

See demo_leapctype for a usage examples.

Install using PIP

mv setup.py setup_torch.py
mv setup_ctype.py setup.py
pip install .

Install on Linux or Mac using CMake

cd LEAP
sh ./etc/build.sh

Install on Livermore Computing (LC) using CMake

module load gcc/8.3.0
module load cuda/11.7.0
cd LEAP
sh ./etc/build.sh

Install on Windows using CMake

cd LEAP
.\etc\win_build.bat

After running the command above, one may use Visual Studio to make changes and re-compile by using the solution file here: LEAP\win_build\leap.sln

Be sure to switch from "Debug" to "Release"

Building without a GPU or on Mac

If you are building on a Mac, you will have to install gcc. First, you need to swap the CMake file by renaming cpu_CMakeLists.txt to CMakeLists.txt (in the src folder). Then you can follow any of the install instructions above.

Usage

Please see our example scripts in the demo_leapctype directory.