Coder Social home page Coder Social logo

driss_torch's Introduction

Summary

threads_low_Res

Simple CMAKE make project for extending PyTorch with custom cuda kernels for doing all the things that I wanna try.

Build

New scikit-build core way

pip install scikit_build_core
pip install pyproject-metadata

# Install in editable mode
pip install -v --no-build-isolation -e .

This will invoke the pyproject.toml file and build the project with the scikit-build package. Including, calling cmake and building the shared library.

What does this do?

So this will go and build the libdriss_torch.so shared library. In which there will be a number of ops that have been registered. In the python package driss_torch there will be small wrappers around the cpp ops with better type hints and documentation.

Could use .ini but this more fun.

Tip (Maybe unsafe?)

The total install command from scratch can take a second. If you want a faster dev flow cd into build and once you change your sources of the lib just run ninja to rebuild the shared library. This will not work if you are adding and deleting files.

Intended Usage

You should be able to grab the ops by doing something like

import torch
import driss_torch

a = torch.randn(10, 10, device='cuda')
b = driss_torch.add_one(b)
print (b)

Install pre-commit hooks

pre-commit install

Running Tests

pytest test/
Old build way

This calls cmake directly in the build dir.

# In the root directory
mkdir build && cd build

# Configure the build, to build with compute arch
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja  -DTORCH_CUDA_ARCH_LIST=9.0 ..

driss_torch's People

Contributors

drisspg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.