GithubHelp home page GithubHelp logo

threadedsparsearrays.jl's Introduction

ThreadedSparseArrays.jl

Build Status Codecov

Simple package providing a wrapper type enabling threaded sparse matrix–dense matrix multiplication. Based on this PR.

Installation

Install with:

] add ThreadedSparseArrays

Note that you must enable threading in Julia for ThreadedSparseArrays to work. You can do so by setting the JULIA_NUM_THREADS environment variable. To test that it is set properly, run

Threads.nthreads()

and make sure it returns the number of threads you wanted.

Example usage

To use ThreadedSparseArrays, all you need to do is to wrap your sparse matrix using the ThreadedSparseMatrixCSC type, like this:

using SparseArrays
using ThreadedSparseArrays

A = sprand(10000, 100, 0.05); # sparse
X1 = randn(100, 100); # dense
X2 = randn(10000, 100); # dense

At = ThreadedSparseMatrixCSC(A); # threaded version

# threaded sparse matrix–dense matrix multiplication
B1 = At*X1;
B2 = At'X2;

Notes

  • If the right hand side X is a Vector, you need to use At'X to get threading. At*X will not work.
  • You might only get speedups for large matrices. Use @btime from the BenchmarkTools.jl package to check if your use case is improved.

threadedsparsearrays.jl's People

Contributors

jagot avatar rasmushenningsson avatar thorek1 avatar viralbshah 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.