diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index acc2b84..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ghcr.io/tensor-array/tensor-array:master - -# [Optional] Uncomment this section to install additional vcpkg ports. -# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install " - -# [Optional] Uncomment this section to install additional packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 3884093..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,40 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/cpp -{ - "name": "C++", - "build": { - "dockerfile": "Dockerfile" - }, - - "features": { - "ghcr.io/devcontainers/features/github-cli:1": {}, - "ghcr.io/devcontainers/features/python:1": {} - }, - - "customizations": { - "vscode": { - "extensions": [ - "ms-vscode.cpptools-extension-pack", - "ms-vscode.cmake-tools" - ] - } - }, - - "hostRequirements": { - "gpu": "optional" - } - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "gcc -v", - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" -} diff --git a/pyproject.toml b/pyproject.toml index f7649e4..e9f9bf4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,10 +28,14 @@ before-all = [ "chmod +x scripts/build-env/manylinux.sh", "scripts/build-env/manylinux.sh" ] +repair-wheel-command = [ + "auditwheel repair -w {dest_dir} --exclude libcudart.so.* --exclude libcublas.so.* --exclude libcublasLt.so.* {wheel}" +] [tool.cibuildwheel.linux.environment] cuda = "12.4" temp = "/tmp/cuda-temp" +TENSOR_ARRAY_INSTALL_PATH = "/tmp/tensor-array-temp" CUDA_PATH = "/usr/local/cuda-${cuda}" PATH = "${PATH}:${CUDA_PATH}/bin" -LD_LIBRARY_PATH = "${LD_LIBRARY_PATH}:${CUDA_PATH}/lib:${CUDA_PATH}/lib64" +LD_LIBRARY_PATH = "${LD_LIBRARY_PATH}:${CUDA_PATH}/lib:${CUDA_PATH}/lib64:${TENSOR_ARRAY_INSTALL_PATH}/lib/tensor-array:${TENSOR_ARRAY_INSTALL_PATH}/lib64/tensor-array" diff --git a/scripts/build-env/manylinux.sh b/scripts/build-env/manylinux.sh index 37adbfc..df2554d 100644 --- a/scripts/build-env/manylinux.sh +++ b/scripts/build-env/manylinux.sh @@ -62,7 +62,7 @@ fi cd build # Configure the build with CMake echo "Configuring the build with CMake..." -cmake .. -DCMAKE_CUDA_HOST_COMPILER="/usr/bin/gcc" +cmake .. -DCMAKE_CUDA_HOST_COMPILER="/usr/bin/gcc" -DCMAKE_INSTALL_PREFIX=${TENSOR_ARRAY_INSTALL_PATH} cmake --build . cmake --install . diff --git a/setup.py b/setup.py index 905d4e7..9837ec0 100644 --- a/setup.py +++ b/setup.py @@ -7,20 +7,22 @@ from setuptools import setup, find_packages from pybind11.setup_helpers import Pybind11Extension, build_ext -__version__ = "0.0.7" +__version__ = "0.0.9" def main(): cwd = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(cwd, "README.md"), encoding="utf-8") as f: long_description = f.read() + tensor_array_lib_path = os.environ['TENSOR_ARRAY_INSTALL_PATH'] + ext_modules = [ Pybind11Extension( - "tensor_array._ext", + "tensor_array.tensor2", sources = glob.glob(os.path.join("cpp", "*.cc")), - include_dirs=["/usr/local/include"], - library_dirs=["/usr/local/lib", "/usr/local/lib64"], - # libraries=["tensorarray_core", "tensorarray_layers"], + include_dirs=[tensor_array_lib_path + "/include"], + library_dirs=[tensor_array_lib_path + "/lib/tensor-array", tensor_array_lib_path + "/lib64/tensor-array"], + libraries=["tensorarray_core", "tensorarray_layers"], define_macros=[("VERSION_INFO", __version__)], ), ] diff --git a/src/tensor_array/core/constants.py b/src/tensor_array/core/constants.py index 9d01931..3731977 100644 --- a/src/tensor_array/core/constants.py +++ b/src/tensor_array/core/constants.py @@ -17,7 +17,7 @@ def zeros(shape : tuple, dtype : DataTypes = DataTypes.S_INT_32) -> Tensor: Tensor: A tensor filled with zeros. """ - from .._ext.tensor2 import zeros as _zeros + from ..tensor2 import zeros as _zeros return _zeros(shape, dtype) def rand(shape : tuple, seed: int = 0) -> Tensor: @@ -32,5 +32,5 @@ def rand(shape : tuple, seed: int = 0) -> Tensor: Tensor: A tensor filled with random values. """ - from .._ext.tensor2 import rand as _rand + from ..tensor2 import rand as _rand return _rand(shape, seed) diff --git a/src/tensor_array/core/datatypes.py b/src/tensor_array/core/datatypes.py index 228f250..3b9261e 100644 --- a/src/tensor_array/core/datatypes.py +++ b/src/tensor_array/core/datatypes.py @@ -4,7 +4,7 @@ # The DataTypes enum includes types such as BOOL, INT, FLOAT, DOUBLE, and others, which correspond to the data types used in tensors. """ -from .._ext.tensor2 import DataType as _DataType +from ..tensor2 import DataType as _DataType from enum import Enum class DataTypes(Enum): diff --git a/src/tensor_array/core/operator.py b/src/tensor_array/core/operator.py index 9797f48..07e6a68 100644 --- a/src/tensor_array/core/operator.py +++ b/src/tensor_array/core/operator.py @@ -15,7 +15,7 @@ def add(value_1 : Tensor, value_2 : Tensor) -> Tensor: Returns: Tensor: A tensor that is the element-wise sum of value_1 and value_2 """ - from .tensor2 import add as _add + from ..tensor2 import add as _add return _add(value_1, value_2) def divide(value_1 : Tensor, value_2 : Tensor) -> Tensor: @@ -27,7 +27,7 @@ def divide(value_1 : Tensor, value_2 : Tensor) -> Tensor: Returns: Tensor: A tensor that is the element-wise division of value_1 by value_2 """ - from .tensor2 import divide as _divide + from ..tensor2 import divide as _divide return _divide(value_1, value_2) def multiply(value_1 : Tensor, value_2 : Tensor) -> Tensor: @@ -39,7 +39,7 @@ def multiply(value_1 : Tensor, value_2 : Tensor) -> Tensor: Returns: Tensor: A tensor that is the element-wise product of value_1 and value_2 """ - from .tensor2 import multiply as _multiply + from ..tensor2 import multiply as _multiply return _multiply(value_1, value_2) def power(value_1 : Tensor, value_2 : Tensor) -> Tensor: @@ -51,7 +51,7 @@ def power(value_1 : Tensor, value_2 : Tensor) -> Tensor: Returns: Tensor: A tensor that is the element-wise result of value_1 raised to the power of value_2 """ - from .tensor2 import power as _power + from ..tensor2 import power as _power return _power(value_1, value_2) def matmul(value_1 : Tensor, value_2 : Tensor) -> Tensor: @@ -63,7 +63,7 @@ def matmul(value_1 : Tensor, value_2 : Tensor) -> Tensor: Returns: Tensor: A tensor that is the result of matrix multiplication between value_1 and value_2 """ - from .._ext.tensor2 import matmul as _matmul + from ..tensor2 import matmul as _matmul return _matmul(value_1, value_2) def condition(condition_value : Tensor, value_if_true : Tensor, value_if_false : Tensor) -> Tensor: @@ -76,5 +76,5 @@ def condition(condition_value : Tensor, value_if_true : Tensor, value_if_false : Returns: Tensor: A tensor that is either value_if_true or value_if_false, depending on the condition. """ - from .._ext.tensor2 import condition as _condition + from ..tensor2 import condition as _condition return _condition(condition_value, value_if_true, value_if_false) diff --git a/src/tensor_array/core/tensor.py b/src/tensor_array/core/tensor.py index d479365..453637a 100644 --- a/src/tensor_array/core/tensor.py +++ b/src/tensor_array/core/tensor.py @@ -5,7 +5,7 @@ """ from __future__ import annotations -from .._ext.tensor2 import Tensor as _Tensor +from ..tensor2 import Tensor as _Tensor from .datatypes import DataTypes class Tensor(_Tensor):