Skip to content

zenustech/POC_zpc_jit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proof-of-concept for ZPC JIT

Build

This build has been tested on windows 10/11 and ubuntu 20/22 with llvm 15, cuda 11.6+ and python 3.10. Other configurations might also work just fine. If there are build issues encountered, your feedback is always appreciated.

Prerequisites

Currently zpc jit module supports these JIT backends: LLVM (with openmp support if its runtime available) and Nvidia nvrtc. py_zfx is the target branch that is assumed to build ZPC JIT pipeline.

Under linux system,

sudo apt install libelf-dev
cmake llvm -Bbuild -DLLVM_USE_CRT_RELEASE=MT -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_BUILD_TYPE:STRING=Release -DLLVM_TARGETS_TO_BUILD:STRING=X86 -DLLVM_ENABLE_PROJECTS="clang;openmp;compiler-rt" -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_ENABLE_PEDANTIC=OFF -DLLVM_ENABLE_PIC=ON
cmake --build build --parallel 16
sudo cmake --build build --parallel 16 --target install

Under windows system, it is preferred to acquire llvm through vcpkg.

.\vcpkg install llvm:x64-windows

If a manual installation is demanded, make sure all ATL components have already been installed with visual studio, which is required for building LLVM. Then open terminal "x64 Native Tools Command Prompt for VS20xx", run the following build script.

cmake llvm -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=RELEASE -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang;openmp;compiler-rt" -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_PIC=ON
cd build
ninja
ninja install

Ninja generator should be accessible alongside visual studio.

Cuda 11.6+ is required for zpc build, though the newest version is generally preferred.

python 3.11

Whenever you build a cmake c++ project that depends on the python package (i.e. find_package(Python3)) under windows system, it is preferred to put "-DCMAKE_MODULE_PATH=path/to/vs/cmake/path" during cmake configuration, where the FindPython3.cmake file that belongs to your visual studio IDE resides (e.g. "C:/Microsoft_Visual_Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.26/Modules"), thus avoiding misuse of python from your vcpkg packages.

Python Package Installation

pip install . --verbose

Zeno Installation

(TBD)

Usage

import pyzpc as zs
import zpy  # if used in zeno, this is required

standalone mode

zeno mode

Example

About

proof of concept for JIT routine built upon zpc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published