diff --git a/README.md b/README.md index f4efbad5ca..0e8dcf8090 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,43 @@ using Paraview. Additionally, the task visualizer can produce PNGs directly using a VTK workflow to render a visualization of ranks and tasks over phases. -![Example Output PNG](./docs/example-output-image.png) \ No newline at end of file +![Example Output PNG](./docs/example-output-image.png) + +## Building the Python bindings + +###Requirements + +In order to build the python bindings, make sure you have a Python <ins>`3.8` or `3.9`</ins> environment, with the `nanobind` package installed. You can install `nanobind` with `pip`: + +```bash +pip install nanobind +``` + +You must have a C++ compiler that supports C++17, and `cmake` >= 3.17. + +Finally, you must have a (<ins>C++</ins>) [VTK](https://vtk.org/) build available on your system. We recommend building from source, and the currently tested version is `9.3.0`. You can find instructions for building VTK [here](https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/docs/build_instructions/build.md). + +### Building + +To build the python bindings, you must specify in the `VTTV_VTK_DIR` environment variable the path to the VTK build directory: + +```bash +export VTTV_VTK_DIR=/path/to/vtk/build +``` + + +Then, to install python-environment-wide the binded `vt-tv` python module, run: + +```bash +pip install . +``` +**Optional** + +To specify the number of parallel jobs to use during the build, you can set the `VTTV_J` environment variable: + +```bash +export VTTV_J=8 +``` + +> [!NOTE] +> Behind the scenes, the usual `cmake` and `make` commands are run. Depending on your system, this can cause the install process to be lengthy as it will be compiling the entire `vt-tv` library. diff --git a/docs/example-output-image.png b/docs/example-output-image.png index 26bd191698..9edfd2b7b4 100644 Binary files a/docs/example-output-image.png and b/docs/example-output-image.png differ diff --git a/setup.py b/setup.py index 6f8a8659ce..1b9559d205 100644 --- a/setup.py +++ b/setup.py @@ -29,11 +29,11 @@ def build_extension(self, ext): build_temp = os.path.join('python-build', 'build', 'temp') os.makedirs(build_temp, exist_ok=True) - vtk_dir = os.environ.get('VTK_DIR') + vtk_dir = os.environ.get('VTTV_VTK_DIR') if not vtk_dir: - raise RuntimeError("Environment variable VTK_DIR is required") + raise RuntimeError("Environment variable VTTV_VTK_DIR is required") - jobs = os.environ.get('JOBS', os.cpu_count()) + jobs = os.environ.get('VTTV_JOBS', os.cpu_count()) cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, '-DPYTHON_EXECUTABLE=' + sys.executable,