{"id":13419325,"url":"https://github.com/deeplearningais/CUV","last_synced_at":"2025-03-15T05:30:54.226Z","repository":{"id":71215385,"uuid":"619277","full_name":"deeplearningais/CUV","owner":"deeplearningais","description":"Matrix library for CUDA in C++ and Python","archived":false,"fork":false,"pushed_at":"2017-01-04T13:33:37.000Z","size":4906,"stargazers_count":196,"open_issues_count":5,"forks_count":48,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-07-31T22:46:52.578Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"www.ais.uni-bonn.de","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deeplearningais.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2010-04-20T09:27:02.000Z","updated_at":"2024-06-21T11:17:55.000Z","dependencies_parsed_at":"2023-05-04T10:48:19.196Z","dependency_job_id":null,"html_url":"https://github.com/deeplearningais/CUV","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeplearningais%2FCUV","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeplearningais%2FCUV/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeplearningais%2FCUV/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeplearningais%2FCUV/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deeplearningais","download_url":"https://codeload.github.com/deeplearningais/CUV/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690112,"owners_count":20331726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:14.412Z","updated_at":"2025-03-15T05:30:53.674Z","avatar_url":"https://github.com/deeplearningais.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings","C++","Libraries 🗂️","Free/Open Source BLAS/Matrix Libraries"],"sub_categories":["Cross-Platform Libraries 🌍"],"readme":"CUV Documentation\n\n0.9.201107041204\n\nSummary\n\nCUV is a C++ template and Python library which makes it easy to use NVIDIA(tm)\nCUDA.\n\nFeatures\n\nSupported Platforms:\n\n  • This library was only tested on Ubuntu Karmic, Lucid and Maverick. It uses\n    mostly standard components (except PyUBLAS) and should run without major\n    modification on any current linux system.\n\nSupported GPUs:\n\n  • By default, code is generated for the lowest compute architecture. We\n    recommend you change this to match your hardware. Using ccmake you can set\n    the build variable \"CUDA_ARCHITECTURE\" for example to -arch=compute_20\n  • All GT 9800 and GTX 280 and above\n  • GT 9200 without convolutions. It might need some minor modifications to\n    make the rest work. If you want to use that card and have problems, just\n    get in contact.\n  • On 8800GTS, random numbers and convolutions wont work.\n\nStructure:\n\n  • Like for example Matlab, CUV assumes that everything is an n-dimensional\n    array called \"tensor\"\n  • Tensors can have an arbitrary data-type and can be on the host (CPU-memory)\n    or device (GPU-memory)\n  • Tensors can be column-major or row-major (1-dimensional tensors are, by\n    convention, row-major)\n  • The library defines many functions which may or may not apply to all\n    possible combinations. Variations are easy to add.\n  • For convenience, we also wrap some of the functionality provided by Alex\n    Krizhevsky on his website (http://www.cs.utoronto.ca/~kriz/) with\n    permission. Thanks Alex for providing your code!\n\nPython Integration\n\n  • CUV plays well with python and numpy. That is, once you wrote your fast GPU\n    functions in CUDA/C++, you can export them using Boost.Python. You can use\n    Numpy for pre-processing and fancy stuff you have not yet implemented, then\n    push the Numpy-matrix to the GPU, run your operations there, pull again to\n    CPU and visualize using matplotlib. Great.\n\nImplemented Functionality\n\n  • Simple Linear Algebra for dense vectors and matrices (BLAS level 1,2,3)\n  • Helpful functors and abstractions\n  • Sparse matrices in DIA format and matrix-multiplication for these matrices\n  • I/O functions using boost.serialization\n  • Fast Random Number Generator\n  • Up to now, CUV was used to build dense and sparse Neural Networks and\n    Restricted Boltzmann Machines (RBM), convolutional or locally connected.\n\nDocumentation\n\n  • Tutorials are available on http://www.ais.uni-bonn.de/~schulz/tag/cuv\n  • The documentation can be generated from the code or accessed on the\n    internet: http://www.ais.uni-bonn.de/deep_learning/doc/html/index.html\n\nContact\n\n  • We are eager to help you getting started with CUV and improve the library\n    continuously! If you have any questions, feel free to contact Hannes Schulz\n    (schulz at ais dot uni-bonn dot de) or Andreas Mueller (amueller at ais dot\n    uni-bonn dot de). You can find the website of our group at http://\n    www.ais.uni-bonn.de/deep_learning/index.html.\n\nInstallation\n\nRequirements\n\nFor C++ libs, you will need:\n\n  • cmake (and cmake-curses-gui for easy configuration)\n  • libboost-dev \u003e= 1.37\n  • libblas-dev\n  • libtemplate-perl -- (we might get rid of this dependency soon)\n  • NVIDIA CUDA (tm), including SDK. We support versions 3.X and 4.0\n  • thrust library - included in CUDA since 4.0 (otherwise available from http:\n    //code.google.com/p/thrust/)\n  • doxygen (if you want to build the documentation yourself)\n\nFor Python Integration, you additionally have to install\n\n  • pyublas -- from http://mathema.tician.de/software/pyublas\n  • python-nose -- for python testing\n  • python-dev\n\nOptionally, install dependent libraries\n\n  • cimg-dev for visualization of matrices (grayscale only, ATM)\n\nObtaining CUV\n\nYou should check out the git repository\n\n   $ git clone git://github.com/deeplearningais/CUV.git\n\nInstallation Procedure\n\nBuilding a debug version:\n\n $ cd cuv-version-source\n $ mkdir -p build/debug\n $ cd build/debug\n $ cmake -DCMAKE_BUILD_TYPE=Debug ../../\n $ ccmake .          # adjust paths to your system (cuda, thrust, pyublas, ...)!\n                     # turn on/off optional libraries (CImg, ...)\n $ make -j\n $ ctest             # run tests to see if it went well\n $ sudo make install\n $ export PYTHONPATH=`pwd`/src      # only if you want python bindings\n\nBuilding a release version:\n\n $ cd cuv-version-source\n $ mkdir -p build/release\n $ cd build/release\n $ cmake -DCMAKE_BUILD_TYPE=Release ../../\n $ ccmake .          # adjust paths to your system (cuda, thrust, pyublas, ...)!\n                     # turn on/off optional libraries (CImg, ...)\n $ make -j\n $ ctest             # run tests to see if it went well\n $ sudo make install\n $ export PYTHONPATH=`pwd`/src      # only if you want python bindings\n\nOn Debian/Ubuntu systems, you can skip the sudo make install step and instead\ndo\n\n $ cpack -G DEB\n $ sudo dpkg -i cuv-VERSION.deb\n\nBuilding the documentation\n\n $ cd build/debug    # change to the build directory\n $ make doc\n\nSample Code\n\nWe show two brief examples. For further inspiration, please take a look at the\ntest cases implemented in the src/tests directory.\n\nPushing and pulling of memory\n\nC++ Code:\n\n #include \u003ccuv.hpp\u003e\n     using namespace cuv;\n\n     int main(void){\n         tensor\u003cfloat,host_memory_space\u003e h(256);  // reserves space in host memory\n         tensor\u003cfloat,dev_memory_space\u003e  d(256);  // reserves space in device memory\n\n         fill(h,0);                          // terse form\n         apply_0ary_functor(h,NF_FILL,0.f);    // more verbose\n\n         d=h;                                // push to device\n         sequence(d);                        // fill device vector with a sequence\n\n         h=d;                                // pull to host\n         for(int i=0;i\u003ch.size();i++)\n         {\n             assert(d[i] == h[i]);\n         }\n     }\n\nPython Code:\n\n import cuv_python as cp\n import numpy as np\n\n h = np.zeros((1,256))                                   # create numpy matrix\n d = cp.dev_tensor_float(h)                              # constructs by copying numpy_array\n\n h2 = np.zeros((1,256)).copy(\"F\")                        # create numpy matrix\n d2 = cp.dev_tensor_float_cm(h2)                         # creates dev_tensor_float_cm (column-major float) object\n\n cp.fill(d,1)                                            # terse form\n cp.apply_nullary_functor(d,cp.nullary_functor.FILL,1)   # verbose form\n\n h = d.np                                                # pull and convert to numpy\n assert(np.sum(h) == 256)\n d.dealloc()                                             # explicitly deallocate memory (optional)\n\nSimple Matrix operations\n\nC++-Code\n\n #include \u003ccuv.hpp\u003e\n using namespace cuv;\n\n int main(void){\n     tensor\u003cfloat,dev_memory_space,column_major\u003e C(2048,2048),A(2048,2048),B(2048,2048);\n\n     fill(C,0);         // initialize to some defined value, not strictly necessary here\n     sequence(A);\n     sequence(B);\n\n     apply_binary_functor(A,B,BF_MULT);  // elementwise multiplication\n     A *= B;                             // operators also work (elementwise)\n     prod(C,A,B, 'n','t');               // matrix multiplication\n }\n\nPython Code\n\n import cuv_python as cp\n import numpy as np\n C = cp.dev_tensor_float_cm([2048,2048])   # column major tensor\n A = cp.dev_tensor_float_cm([2048,2048])\n B = cp.dev_tensor_float_cm([2048,2048])\n cp.fill(C,0)                       # fill with some defined values, not really necessary here\n cp.sequence(A)\n cp.sequence(B)\n cp.apply_binary_functor(B,A,cp.binary_functor.MULT) # elementwise multiplication\n B *= A                                              # operators also work (elementwise)\n cp.prod(C,A,B,'n','t')                              # matrix multiplication\n\nThe examples can be found in the \"examples/\" folder under \"python\" and \"cpp\"\n\nGenerated on Mon Jul 4 2011 12:04:53 for CUV by  doxygen 1.7.1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeplearningais%2FCUV","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeplearningais%2FCUV","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeplearningais%2FCUV/lists"}