v4.3 update. (#2709)
* v4.3 update. * Update the cute_dsl_api changelog's doc link * Update version to 4.3.0 * Update the example link * Update doc to encourage user to install DSL from requirements.txt --------- Co-authored-by: Larry Wu <larwu@nvidia.com>
This commit is contained in:
@@ -30,11 +30,12 @@ cmake_minimum_required(VERSION 3.15)
|
||||
project(tensor)
|
||||
|
||||
# Find Python
|
||||
find_package(Python COMPONENTS Interpreter Development REQUIRED)
|
||||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
||||
|
||||
# Get Python site-packages directory using Python
|
||||
execute_process(
|
||||
COMMAND ${Python_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])"
|
||||
COMMAND ${Python3_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])"
|
||||
OUTPUT_VARIABLE Python_SITE_PACKAGES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
@@ -45,7 +46,13 @@ message(STATUS "Python site-packages directory: ${Python_SITE_PACKAGES}")
|
||||
list(APPEND CMAKE_PREFIX_PATH ${Python_SITE_PACKAGES}/nanobind/cmake)
|
||||
|
||||
# Find nanobind
|
||||
find_package(nanobind REQUIRED)
|
||||
find_package(nanobind)
|
||||
if(NOT nanobind_FOUND)
|
||||
message(FATAL_ERROR
|
||||
"nanobind not found!\n"
|
||||
"Please install nanobind with: pip install nanobind\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add the module
|
||||
nanobind_add_module(tensor tensor.cpp)
|
||||
|
||||
@@ -54,7 +54,6 @@ import cutlass.cute as cute
|
||||
|
||||
from cutlass._mlir import ir
|
||||
from cutlass._mlir.dialects import llvm
|
||||
import cutlass._mlir.extras.types as T
|
||||
|
||||
|
||||
class ExampleTensorValue(ir.Value):
|
||||
@@ -244,7 +243,7 @@ import tempfile
|
||||
import torch
|
||||
|
||||
|
||||
def run_test(tmpdir=None):
|
||||
def run_test(tmpdir=None, cmake_args=""):
|
||||
# Skip cleanup if user provides tmpdir
|
||||
cleanup = tmpdir is None
|
||||
# Initialize temporary build directory
|
||||
@@ -253,7 +252,8 @@ def run_test(tmpdir=None):
|
||||
try:
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
subprocess.run(["cmake", "-B", tmpdir, current_dir], check=True)
|
||||
cmake_args = cmake_args.split()
|
||||
subprocess.run(["cmake", "-B", tmpdir, current_dir] + cmake_args, check=True)
|
||||
subprocess.run(["cmake", "--build", tmpdir], check=True)
|
||||
|
||||
sys.path.append(tmpdir)
|
||||
@@ -284,7 +284,10 @@ def run_test(tmpdir=None):
|
||||
# Execute compiled function
|
||||
compiled_func(tensor)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
import traceback
|
||||
|
||||
traceback.print_exception(type(e), e, e.__traceback__)
|
||||
raise e
|
||||
finally:
|
||||
if cleanup:
|
||||
# Clean up the temporary directory
|
||||
@@ -298,8 +301,17 @@ if __name__ == "__main__":
|
||||
description="Set temporary directory for building C modules"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--tmp-dir", type=str, help="Temporary directory path for building C modules"
|
||||
"--tmp-dir",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Temporary directory path for building C modules",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--cmake-args",
|
||||
type=str,
|
||||
default="",
|
||||
help="Extra CMake arguments for building C modules",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
run_test(args.tmp_dir)
|
||||
run_test(tmpdir=args.tmp_dir, cmake_args=args.cmake_args)
|
||||
|
||||
Reference in New Issue
Block a user