This repo holds a number of extensions for PyTorch. The current development
branch is e2.3.1 which is
based on the 2.3.1
release of PyTorch.
A bitarray implementation built on Tensors.
Lives under /extensions/bitarray
.
A constraints solver built on Tensors. It implements conflict directed backjumping and forward checking, see Prosser93. Instead of implementing a list of open nodes or recursion, it implements a state as an array holding for each variable of the state, (ie. depth of the search tree), the index from the domain of the variable included in the current path. Similarly instead of lists it implements a 1D Tensor for CBJ, and a 2D Tensor for FC.
Lives under /extensions/constraints
.
A graph implemented as two bitmaps, the vertex set and the adjacency matrix. The vertex set defines the vertex indexes that are present in the graph. Information about vertices and edges are kept on external containers, linked by the indexes.
Lives under /extensions/graph
.
A graph DB implemented on top of LMDB. The schema of the DB is documented in
/extensions/graphdb/schema.h
.
Lives under /extensions/graphdb
.
Lives under /extensions/iter
.
Lives under /extensions/llvmast
.
The study of algorithms, mostly in the areas of AI, Graph, Optimisation, and Parallelism.
Lives under /extensions/theory
.
Implements a lock free thread pool.
Lives under /extensions/threadpool
.
The extensions live under the /extensions
directory. A dedicated setup.py
script is used to build the extensions, examples
# Linux
CC=clang CXX=clang++ SETUPTOOLS_EXT_SUFFIX=.so DEBUG=1 USE_DISTRIBUTED=0 USE_MKLDNN=0 USE_CUDA=0 USE_ROCM=0 BUILD_TEST=0 USE_FBGEMM=0 USE_NNPACK=0 USE_QNNPACK=0 USE_XNNPACK=0 USE_MPS=0 EXT_USE_LLVM_CONFIG=/usr/bin/llvm-config python setup.py build --build-lib=./build/lib install
# MacOS
MACOSX_DEPLOYMENT_TARGET=14.5 CC=clang CXX=clang++ SETUPTOOLS_EXT_SUFFIX=.so DEBUG=1 USE_DISTRIBUTED=0 USE_MKLDNN=0 USE_CUDA=0 USE_ROCM=0 BUILD_TEST=0 USE_FBGEMM=0 USE_NNPACK=0 USE_QNNPACK=0 USE_XNNPACK=0 USE_MPS=1 EXT_USE_LLVM_CONFIG=/root/to/llvm\@14/14.0.6/bin/llvm-config EXT_USE_LMDB=/root/to/lmdb/0.9.33/ python setup.py install
In order to prepare the data we run
# Linux, MacOS
CC=clang CXX=clang++ EXT_USE_WORKSPACE=/mnt/macos/pytorch python /mnt/macos/pytorch/extensions/llvmast/setup.py prepare
The flags for LLVM are read from extensions/llvmast/cached_cflags.py
which is
generated during the build step.
- P. Prosser. Hybrid Algorithms for the Constraint Satisfaction Problem. Computational Intelligence. 1993.