Git Product home page Git Product logo

linear-svm-with-pycuda's Introduction

Date:
2018-06-01

Author:
WRF

Description:
This project demonstrates how PyCUDA can be used to build a linear support vector machine using the Huberized squared hinge loss.

Setup (other than installing packages denoted in the scripts):
- Access to GPU
- Install NVIDIA GPU Computing Toolkit with CUDA v9.2: 
	https://developer.nvidia.com/cuda-downloads
- Install MS Visual Studio 2017 Community version (v14.14.26428 worked for me):
	https://www.visualstudio.com/downloads/

Notes: You may need to do the following:
1) In the file host_config.h found here,
	C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include\crt
change line 131 from:
	#if _MSC_VER < 1600 || _MSC_VER > 1913
to:
	#if _MSC_VER < 1600	
This prevents an error being thrown by PyCUDA. Although this has let me use PyCUDA, I do not know it's other ramifications!

2) In %PYTHON%\Lib\site-packages\skcuda\cublas.py, you may need to manually set the location of the relevant cublas.dll file. E.g.,

	dirname_DLL = 'C:\\Anaconda3\\DLLs'
	_libcublas = None
	for _libcublas_libname in _libcublas_libname_list:
	    try:
		if sys.platform == 'win32':
		    _libcublas = ctypes.windll.LoadLibrary(dirname_DLL + "\\" +_libcublas_libname)

-------------------------------------------------------------------------------------------------------------------

DISCLAIMER: 
For anyone that wants to use this code, be aware that it's limited to the following:
i) Subsetted models in one-vs-one fitting cannot be larger than 1024 records (i.e., to fit on a GPU block). 
E.g., your training design matrix could have shape (10M, 100), so long as each one-vs-one label pair has at most 1024 observations.
ii) A small number of response categories, because of an unknown memory issue. In other words, 
too many response categories will likely eat up your RAM and crash your python kernel.

I strongly suspect these issues can be resolved, but have been unable to do so with my limited python/GPU experience. 
If anyone has any recommendations, feel free to post them!

linear-svm-with-pycuda's People

Contributors

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