Code Monkey home page Code Monkey logo

CUDAMat

The aim of the cudamat project is to make it easy to perform basic matrix calculations on CUDA-enabled GPUs from Python. cudamat provides a Python matrix class that performs calculations on a GPU. At present, some of the operations our GPU matrix class supports include:

  • Easy conversion to and from instances of numpy.ndarray.
  • Limited slicing support.
  • Matrix multiplication and transpose.
  • Elementwise addition, subtraction, multiplication, and division.
  • Elementwise application of exp, log, pow, sqrt.
  • Summation, maximum and minimum along rows or columns.
  • Conversion of CUDA errors into Python exceptions.

The current feature set of cudamat is biased towards features needed for implementing some common machine learning algorithms. We have included implementations of feedforward neural networks and restricted Boltzmann machines in the examples that come with cudamat.

Example:

import numpy as np
import cudamat as cm

cm.cublas_init()

# create two random matrices and copy them to the GPU
a = cm.CUDAMatrix(np.random.rand(32, 256))
b = cm.CUDAMatrix(np.random.rand(256, 32))

# perform calculations on the GPU
c = cm.dot(a, b)
d = c.sum(axis = 0)

# copy d back to the host (CPU) and print
print(d.asarray())

Documentation

An overview of the main features of cudamat can be found in the technical report:

CUDAMat: A CUDA-based matrix class for Python, Volodymyr Mnih, UTML TR 2009-004.

Download

You can obtain the latest release from the repository by typing:

git clone https://github.com/cudamat/cudamat.git

You can also download one of the releases from the releases section.

Installation

cudamat uses setuptools and can be installed via pip. For details, please see INSTALL.md.

Development

If you want to contribute new features or improvements, you're welcome to fork cudamat on github and send us your pull requests! Please see CONTRIBUTE.md if you need any help with that.

cudamat's Projects

cudamat icon cudamat

Python module for performing basic dense linear algebra computations on the GPU using CUDA.

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.