diff --git a/build/Makefile b/build/Makefile index ebc69a7..615abf7 100644 --- a/build/Makefile +++ b/build/Makefile @@ -9,7 +9,7 @@ NVCCFLAGS = -std=c++11 # Directories SRCDIR = ../norch/csrc BUILDDIR = ../build -TARGET = ../build/libtensor.so +TARGET = ../norch/libtensor.so # Files SRCS = $(wildcard $(SRCDIR)/*.cpp) diff --git a/build/cpu.o b/build/cpu.o deleted file mode 100644 index 4f63638..0000000 Binary files a/build/cpu.o and /dev/null differ diff --git a/build/cuda.cu.o b/build/cuda.cu.o deleted file mode 100644 index 43c68ba..0000000 Binary files a/build/cuda.cu.o and /dev/null differ diff --git a/build/tensor.o b/build/tensor.o deleted file mode 100644 index ce0b93c..0000000 Binary files a/build/tensor.o and /dev/null differ diff --git a/install.sh b/install.sh deleted file mode 100755 index aa42aec..0000000 --- a/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -apt install nvidia-cuda-toolkit -cd build -make -cd .. \ No newline at end of file diff --git a/norch/__init__.py b/norch/__init__.py index 98792f5..ca7be0b 100644 --- a/norch/__init__.py +++ b/norch/__init__.py @@ -1,3 +1,8 @@ from norch.tensor import Tensor from .nn import * -from .optim import * \ No newline at end of file +from .optim import * +from .utils import * + +__version__ = "0.0.1" +__author__ = 'Lucas de Lima Nogueira' +__credits__ = 'Lucas de Lima Nogueira' \ No newline at end of file diff --git a/norch/__pycache__/__init__.cpython-38.pyc b/norch/__pycache__/__init__.cpython-38.pyc index 21fa162..d172276 100644 Binary files a/norch/__pycache__/__init__.cpython-38.pyc and b/norch/__pycache__/__init__.cpython-38.pyc differ diff --git a/norch/__pycache__/tensor.cpython-38.pyc b/norch/__pycache__/tensor.cpython-38.pyc index 3361225..de9f0ac 100644 Binary files a/norch/__pycache__/tensor.cpython-38.pyc and b/norch/__pycache__/tensor.cpython-38.pyc differ diff --git a/norch/autograd/__init__.py b/norch/autograd/__init__.py new file mode 100644 index 0000000..e7d4dc0 --- /dev/null +++ b/norch/autograd/__init__.py @@ -0,0 +1 @@ +from .functions import * \ No newline at end of file diff --git a/build/libtensor.so b/norch/libtensor.so similarity index 100% rename from build/libtensor.so rename to norch/libtensor.so diff --git a/norch/norch.egg-info/PKG-INFO b/norch/norch.egg-info/PKG-INFO deleted file mode 100644 index 6adfe74..0000000 --- a/norch/norch.egg-info/PKG-INFO +++ /dev/null @@ -1,30 +0,0 @@ -Metadata-Version: 2.1 -Name: norch -Version: 0.0.1 -Summary: A deep learning framework -Home-page: https://github.com/lucasdelimanogueira/PyNorch -Author: Lucas de Lima -Author-email: nogueiralucasdelima@gmail.com -Project-URL: Bug Tracker, https://github.com/lucasdelimanogueira/PyNorch/issues -Project-URL: Repository, https://github.com/lucasdelimanogueira/PyNorch -Classifier: Programming Language :: Python :: 3 -Classifier: Operating System :: OS Independent -Requires-Python: >=3.6 -Description-Content-Type: text/markdown - -# PyNorch -Recreating PyTorch from scratch (C/C++, CUDA and Python, with GPU support and automatic differentiation!) - -# 1 - About -**PyNorch** is a deep learning framework constructed using C/C++, CUDA and Python. This is a personal project with educational purpose only! `Norch` means **NOT** PyTorch, and we have **NO** claims to rivaling the already established PyTorch. The main objective of **PyNorch** was to give a brief understanding of how a deep learning framework works internally. It implements the Tensor object, GPU support and an automatic differentiation system. - -# 2 - Installation -```css -$ sudo apt install nvidia-cuda-toolkit -$ git clone https://github.com/lucasdelimanogueira/PyNorch.git -$ cd build -$ make -$ cd .. -``` - -# 3 - Get started diff --git a/norch/norch.egg-info/SOURCES.txt b/norch/norch.egg-info/SOURCES.txt deleted file mode 100644 index d918a1f..0000000 --- a/norch/norch.egg-info/SOURCES.txt +++ /dev/null @@ -1,24 +0,0 @@ -README.md -install.sh -setup.py -norch/nn/__init__.py -norch/nn/activation.py -norch/nn/loss.py -norch/nn/module.py -norch/nn/parameter.py -norch/nn/modules/__init__.py -norch/nn/modules/linear.py -norch/norch.egg-info/PKG-INFO -norch/norch.egg-info/SOURCES.txt -norch/norch.egg-info/dependency_links.txt -norch/norch.egg-info/top_level.txt -norch/optim/__init__.py -norch/optim/optimizer.py -norch/optim/optimizers/__init__.py -norch/optim/optimizers/sgd.py -norch/utils/__init__.py -norch/utils/utils.py -norch/utils/utils_unittests.py -tests/test_autograd.py -tests/test_nn.py -tests/test_operations.py \ No newline at end of file diff --git a/norch/norch.egg-info/dependency_links.txt b/norch/norch.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/norch/norch.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/norch/norch.egg-info/top_level.txt b/norch/norch.egg-info/top_level.txt deleted file mode 100644 index 793c63f..0000000 --- a/norch/norch.egg-info/top_level.txt +++ /dev/null @@ -1,3 +0,0 @@ -nn -optim -utils diff --git a/norch/tensor.py b/norch/tensor.py index fc5d0de..53b8416 100644 --- a/norch/tensor.py +++ b/norch/tensor.py @@ -13,8 +13,8 @@ class CTensor(ctypes.Structure): ] class Tensor: - os.path.abspath(os.curdir) - _C = ctypes.CDLL(os.path.join(os.path.abspath(os.curdir), "build/libtensor.so")) + module_dir = os.path.dirname(os.path.abspath(__file__)) + _C = ctypes.CDLL(os.path.join(module_dir, "libtensor.so")) def __init__(self, data=None, device="cpu", requires_grad=False): diff --git a/setup.py b/setup.py index b38e402..6ebc8dd 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,26 @@ import setuptools +from setuptools.command.install import install +import subprocess with open("README.md", "r", encoding = "utf-8") as fh: long_description = fh.read() +apt_dependencies = [ + 'nvidia-cuda-toolkit' +] + +for package in apt_dependencies: + subprocess.check_call(['sudo', 'apt', 'install', package]) + +class CustomInstall(install): + def run(self): + subprocess.call(['make', '-C', 'build']) + install.run(self) + + setuptools.setup( name = "norch", version = "0.0.1", - scripts=['install.sh'], author = "Lucas de Lima", author_email = "nogueiralucasdelima@gmail.com", description = "A deep learning framework", @@ -21,7 +35,10 @@ setuptools.setup( "Programming Language :: Python :: 3", "Operating System :: OS Independent", ], - package_dir = {"": "norch"}, - packages = setuptools.find_packages(where="norch"), + packages = setuptools.find_packages(), + package_data={'norch': ['csrc/*', 'libtensor.so']}, + cmdclass={ + 'install': CustomInstall, + }, python_requires = ">=3.6" )