Giter Club home page Giter Club logo

pyphp_rand_ocl's Introduction

Naive implementation of mt_rand using pyopencl and pycuda

Installation

Numpy and one of Pycuda or pyopencl should me installed to run this.

easy_install numpy pyopencl
OR
pip install numpy pyopencl

For pycuda you should run

easy_install numpy pycuda
OR
pip install numpy pycuda

For any opencl compatible device you should also install opencl package for your device (AMD/NVIDIA/Intel/etc.)

For cuda - you should install nvcc compiler with headers

Execution

One can run this implementation with start_ocl.sh and start_cuda.sh. This scripts will also produce profiling information of execution

PyOpencl implementation will try to run on first device it would found. I don't know for now how to fix it to run only on GPU. If you would run it from shell - there would be some info regarding this

Speed tests

$ grep SIZE config.py
SIZE = 16384
$ ./start_ocl.sh
$ tail -n 2 opencl_profile_0.log
method=[ mt_brute ] gputime=[ 72.640 ] cputime=[ 4.000 ] occupancy=[ 0.667 ]
method=[ memcpyDtoHasync ] gputime=[ 12.512 ] cputime=[ 8.000 ]

$ ./start_cuda.sh
$ tail -n 2 cuda_profile_0.log
method=[ mt_brute ] gputime=[ 68.928 ] cputime=[ 6.000 ] occupancy=[ 0.667 ]
method=[ memcpyDtoH ] gputime=[ 10.720 ] cputime=[ 88.000 ]

Results

72.640+12.51 microseconds for 2^14 hashes = 1.9 * 10^8 seeds

OR

22 seconds for all 2^32 combinations

pyphp_rand_ocl's People

Contributors

gifts avatar

Watchers

 avatar  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.