Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding NUMBA_MLIR_USE_DPNP to setup.py, environment.yml and setenv.sh #42

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/modules/FindLevelZero.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ else()

find_library(LevelZero_LIBRARY
NAMES ze_loader
HINTS /usr/lib/x86_64-linux-gnu
)
endif()

Expand Down
27 changes: 21 additions & 6 deletions numba_mlir/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from setuptools import find_packages, setup
import versioneer
import numpy
from pathlib import Path

root_dir = os.path.dirname(os.path.abspath(__file__))

Expand All @@ -18,7 +19,9 @@
MLIR_DIR = os.path.join(LLVM_PATH, "lib", "cmake", "mlir")
TBB_DIR = os.path.join(os.environ["TBB_PATH"], "lib", "cmake", "tbb")
NUMBA_MLIR_USE_MKL = os.environ.get("NUMBA_MLIR_USE_MKL")
CMAKE_INSTALL_PREFIX = os.path.join(root_dir, "..")
CMAKE_INSTALL_PREFIX = os.path.join(str(Path(root_dir).parent))
NUMBA_MLIR_USE_DPNP = os.environ.get("NUMBA_MLIR_USE_DPNP")
NUMBA_MLIR_ENABLE_IGPU_DIALECT = os.environ.get("NUMBA_MLIR_ENABLE_IGPU_DIALECT")

cmake_build_dir = os.path.join(CMAKE_INSTALL_PREFIX, "numba_mlir_cmake_build")
cmake_cmd = [
Expand Down Expand Up @@ -50,17 +53,23 @@
# DPNP
try:
from dpnp import get_include as dpnp_get_include
from dpctl import get_include as dpctl_get_include

DPNP_LIBRARY_DIR = os.path.join(dpnp_get_include(), "..", "..")
DPNP_INCLUDE_DIR = dpnp_get_include()
DPNP_LIBRARY_DIR = str(Path(DPNP_INCLUDE_DIR).parent.parent)
DPCTL_INCLUDE_DIR = dpctl_get_include()
DPCTL_LIBRARY_DIR = str(Path(DPCTL_INCLUDE_DIR).parent)
cmake_cmd += [
"-DDPNP_INCLUDE_DIR=" + DPNP_INCLUDE_DIR,
"-DDPNP_LIBRARY_DIR=" + DPNP_LIBRARY_DIR,
"-DDPNP_INCLUDE_DIR=" + DPNP_INCLUDE_DIR,
"-DNUMBA_MLIR_USE_DPNP=ON",
"-DDPCTL_INCLUDE_DIR=" + DPCTL_INCLUDE_DIR,
"-DDPCTL_LIBRARY_DIR=" + DPCTL_LIBRARY_DIR,
"-DNUMBA_MLIR_USE_DPNP=" + ("ON" if NUMBA_MLIR_USE_DPNP == '1' else "OFF"),
]
print("Found DPNP at", DPNP_LIBRARY_DIR)
print("Found DPCTL at", DPCTL_LIBRARY_DIR)
except ImportError:
print("DPNP not found")
print("DPNP or DPCTL not found")

# GPU/L0
LEVEL_ZERO_DIR = os.getenv("LEVEL_ZERO_DIR", None)
Expand All @@ -69,7 +78,13 @@
else:
print("LEVEL_ZERO_DIR is", LEVEL_ZERO_DIR)
cmake_cmd += [
"-DNUMBA_MLIR_ENABLE_IGPU_DIALECT=ON",
"-DNUMBA_MLIR_ENABLE_IGPU_DIALECT=ON",
]

# If L0 is already on the system
if NUMBA_MLIR_ENABLE_IGPU_DIALECT == '1':
cmake_cmd += [
"-DNUMBA_MLIR_ENABLE_IGPU_DIALECT=ON",
]

try:
Expand Down