From 29902d2bbfd8245e4a840a4243d777c8ed9cd345 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Fri, 20 Mar 2020 00:08:26 +0530 Subject: [PATCH 01/25] Solved issue #10 --- adaboost/core/data_structures.hpp | 37 ------------ adaboost/core/data_structures_impl.cpp | 77 ------------------------- adaboost/core/operations.hpp | 38 ++++++++++++ adaboost/core/operations_impl.cpp | 80 ++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 114 deletions(-) diff --git a/adaboost/core/data_structures.hpp b/adaboost/core/data_structures.hpp index a7c67be..4e33051 100644 --- a/adaboost/core/data_structures.hpp +++ b/adaboost/core/data_structures.hpp @@ -184,43 +184,6 @@ namespace adaboost ~Matrix(); }; - /* @overload - * Used for taking dot product of two vectors. - * - * @param vec1 First vector in dot product. - * @param vec2 Second vector in dot product. - * @param result For storing the result. - */ - template - void product(const Vector& vec1, - const Vector& vec2, - data_type_vector& result); - - /* @overload - * Used for multiplying a vector - * and a matrix. - * - * @param vec The vector. - * @param mat The matrix. - * @param result A vector for storing the result. - */ - template - void multiply(const Vector& vec, - const Matrix& mat, - Vector& result); - - /* @overload - * Used for multiplyng two matrices. - * - * @param vec1 First matrix. - * @param vec2 Second matrix. - * @param result A matrix for storing the result. - */ - template - void multiply(const Matrix& mat1, - const Matrix& mat2, - Matrix& result); - } // namespace core } // namespace adaboost diff --git a/adaboost/core/data_structures_impl.cpp b/adaboost/core/data_structures_impl.cpp index 37bf6f5..7055850 100644 --- a/adaboost/core/data_structures_impl.cpp +++ b/adaboost/core/data_structures_impl.cpp @@ -51,16 +51,6 @@ namespace adaboost this->data[index] = value; } - template - void Vector:: - fill(data_type_vector value) - { - for(unsigned int i = 0; i < this->size; i++) - { - this->data[i] = value; - } - } - template unsigned int Vector::get_size() const { @@ -133,19 +123,6 @@ namespace adaboost this->data[x*this->cols + y] = value; } - template - void Matrix:: - fill(data_type_matrix value) - { - for(unsigned int i = 0; i < this->rows; i++) - { - for(unsigned int j = 0; j < this->cols; j++) - { - this->data[i*this->cols + j] = value; - } - } - } - template unsigned int Matrix:: get_rows() const @@ -176,60 +153,6 @@ namespace adaboost } } - template - void product(const Vector& vec1, - const Vector& vec2, - data_type_vector& result) - { - adaboost::utils::check(vec1.get_size() == vec2.get_size(), - "Size of vectors don't match."); - result = 0; - for(unsigned int i = 0; i < vec1.get_size(); i++) - { - result += (vec1.at(i)*vec2.at(i)); - } - } - - template - void multiply(const Vector& vec, - const Matrix& mat, - Vector& result) - { - adaboost::utils::check(vec.get_size() == mat.get_rows(), - "Orders mismatch in the inputs."); - for(unsigned int j = 0; j < mat.get_cols(); j++) - { - data_type_vector _result = 0; - for(unsigned int i = 0; i < mat.get_rows(); i++) - { - _result += (vec.at(i)*mat.at(i, j)); - } - result.set(j, _result); - } - } - - template - void multiply(const Matrix& mat1, - const Matrix& mat2, - Matrix& result) - { - adaboost::utils::check(mat1.get_cols() == mat2.get_rows(), - "Order of matrices don't match."); - unsigned int common_cols = mat1.get_cols(); - for(unsigned int i = 0; i < result.get_rows(); i++) - { - for(unsigned int j = 0; j < result.get_cols(); j++) - { - data_type_matrix _result = 0; - for(unsigned int k = 0; k < common_cols; k++) - { - _result += (mat1.at(i, k)*mat2.at(k, j)); - } - result.set(i, j, _result); - } - } - } - #include "instantiated_templates_data_structures.hpp" } // namespace core diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index 0438f71..0440abd 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -53,6 +53,44 @@ namespace adaboost const Vector& vec, data_type_1& result); + /* + * @overload + * Used for taking dot product of two vectors. + * + * @param vec1 First vector in dot product. + * @param vec2 Second vector in dot product. + * @param result For storing the result. + */ + template + void product(const Vector& vec1, + const Vector& vec2, + data_type_vector& result); + + /* @overload + * Used for multiplyng two matrices. + * + * @param vec1 First matrix. + * @param vec2 Second matrix. + * @param result A matrix for storing the result. + */ + template + void multiply(const Matrix& mat1, + const Matrix& mat2, + Matrix& result); + + /* @overload + * Used for multiplying a vector + * and a matrix. + * + * @param vec The vector. + * @param mat The matrix. + * @param result A vector for storing the result. + */ + template + void multiply(const Vector& vec, + const Matrix& mat, + Vector& result); + } // namespace core } // namespace adaboost diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index be93813..27db15f 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -47,6 +47,86 @@ namespace adaboost result = arg_max; } + template + void Vector:: + fill(data_type_vector value) + { + for(unsigned int i = 0; i < this->size; i++) + { + this->data[i] = value; + } + } + + + template + void Matrix:: + fill(data_type_matrix value) + { + for(unsigned int i = 0; i < this->rows; i++) + { + for(unsigned int j = 0; j < this->cols; j++) + { + this->data[i*this->cols + j] = value; + } + } + } + + + template + void multiply(const Vector& vec, + const Matrix& mat, + Vector& result) + { + adaboost::utils::check(vec.get_size() == mat.get_rows(), + "Orders mismatch in the inputs."); + for(unsigned int j = 0; j < mat.get_cols(); j++) + { + data_type_vector _result = 0; + for(unsigned int i = 0; i < mat.get_rows(); i++) + { + _result += (vec.at(i)*mat.at(i, j)); + } + result.set(j, _result); + } + } + + template + void multiply(const Matrix& mat1, + const Matrix& mat2, + Matrix& result) + { + adaboost::utils::check(mat1.get_cols() == mat2.get_rows(), + "Order of matrices don't match."); + unsigned int common_cols = mat1.get_cols(); + for(unsigned int i = 0; i < result.get_rows(); i++) + { + for(unsigned int j = 0; j < result.get_cols(); j++) + { + data_type_matrix _result = 0; + for(unsigned int k = 0; k < common_cols; k++) + { + _result += (mat1.at(i, k)*mat2.at(k, j)); + } + result.set(i, j, _result); + } + } + } + + template + void product(const Vector& vec1, + const Vector& vec2, + data_type_vector& result) + { + adaboost::utils::check(vec1.get_size() == vec2.get_size(), + "Size of vectors don't match."); + result = 0; + for(unsigned int i = 0; i < vec1.get_size(); i++) + { + result += (vec1.at(i)*vec2.at(i)); + } + } + + #include "instantiated_templates_operations.hpp" } // namespace core From acf949dd2ab358a8f901eacd30087a96aec01422 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Fri, 20 Mar 2020 00:33:35 +0530 Subject: [PATCH 02/25] Solved #10 --- adaboost/core/data_structures.hpp | 16 ---------------- adaboost/core/operations.hpp | 18 ++++++++++++++++++ adaboost/core/operations_impl.cpp | 6 ++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/adaboost/core/data_structures.hpp b/adaboost/core/data_structures.hpp index 4e33051..0448913 100644 --- a/adaboost/core/data_structures.hpp +++ b/adaboost/core/data_structures.hpp @@ -66,14 +66,6 @@ namespace adaboost void set(unsigned int index, data_type_vector value); - /* - * Used for filling the vector with a given value. - * - * @param value The value with which the vector is - * to be populated. - */ - void fill(data_type_vector value); - /* * Used for obtaining the size of the vector. */ @@ -158,14 +150,6 @@ namespace adaboost unsigned int y, data_type_matrix value); - /* - * Used for filling the matrix with a given value. - * - * @param value The value with which the matrix is - * to be populated. - */ - void fill(data_type_matrix value); - /* * Used for obtaining number of rows in the vector. */ diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index 0440abd..1e5a675 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -7,6 +7,24 @@ namespace adaboost { namespace core { + /* @overload + * Used for filling the vector with a given value. + * + * @param value The value with which the vector is + * to be populated. + */ + template + void fill(data_type_vector value); + + /* @overload + * Used for filling the matrix with a given value. + * + * @param value The value with which the matrix is + * to be populated. + */ + template + void fill(data_type_matrix value); + /* * This function computes the sum of * elements of the given vector and the diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index 27db15f..0fa5006 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -48,8 +48,7 @@ namespace adaboost } template - void Vector:: - fill(data_type_vector value) + void fill(data_type_vector value); { for(unsigned int i = 0; i < this->size; i++) { @@ -59,8 +58,7 @@ namespace adaboost template - void Matrix:: - fill(data_type_matrix value) + void fill(data_type_matrix value); { for(unsigned int i = 0; i < this->rows; i++) { From a34240888666c0d69087e12fa4c0e0b3f1f0659c Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Fri, 20 Mar 2020 02:45:52 +0530 Subject: [PATCH 03/25] Tried solving #10 --- adaboost/core/data_structures_impl.cpp | 4 +- adaboost/core/operations.hpp | 29 ++++++++++++++ adaboost/core/operations_impl.cpp | 42 ++++++++++++++++++++- adaboost/cuda/cuda_data_structures.hpp | 20 +--------- adaboost/cuda/cuda_data_structures_impl.hpp | 42 --------------------- 5 files changed, 73 insertions(+), 64 deletions(-) diff --git a/adaboost/core/data_structures_impl.cpp b/adaboost/core/data_structures_impl.cpp index 7055850..262f1eb 100644 --- a/adaboost/core/data_structures_impl.cpp +++ b/adaboost/core/data_structures_impl.cpp @@ -1,8 +1,8 @@ #ifndef ADABOOST_CORE_DATA_STRUCTURES_IMPL_CPP #define ADABOOST_CORE_DATA_STRUCTURES_IMPL_CPP -#include -#include +//#include +//#include #include namespace adaboost diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index 1e5a675..ce9ca2f 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -16,6 +16,21 @@ namespace adaboost template void fill(data_type_vector value); + /* + * Used for filling the vector with a given value. + * If block size is passed 0 then the values are + * filled on the CPU otherwise they are filled on + * GPU. + * + * @param value The value with which the vector is + * to be populated. + * @param block_size The number of threads to be + * launched per block on GPU. + */ + template + void fill(data_type_vector value, + unsigned block_size=0); + /* @overload * Used for filling the matrix with a given value. * @@ -25,6 +40,20 @@ namespace adaboost template void fill(data_type_matrix value); + /* + * Used for filling the matrix with a given value. + * If block size x and block size y is passed 0 and 0 then the values are + * filled on the CPU otherwise they are filled on + * GPU. + * + * @param value The value with which the matrix is + * to be populated. + */ + template + void fill(data_type_matrix value, + unsigned block_size_x=0, + unsigned block_size_y=0); + /* * This function computes the sum of * elements of the given vector and the diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index 0fa5006..4ea594c 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -48,7 +48,7 @@ namespace adaboost } template - void fill(data_type_vector value); + void fill(data_type_vector value) { for(unsigned int i = 0; i < this->size; i++) { @@ -58,7 +58,7 @@ namespace adaboost template - void fill(data_type_matrix value); + void fill(data_type_matrix value) { for(unsigned int i = 0; i < this->rows; i++) { @@ -69,6 +69,44 @@ namespace adaboost } } + template + void fill(data_type_matrix value, + unsigned block_size_x=0, + unsigned block_size_y=0);{ + if(block_size_x == 0 || block_size_y == 0) + { + this->adaboost::core::Matrix::fill(value); + } + else + { + dim3 gridDim((this->cols_gpu + block_size_x - 1)/block_size_x, + (this->rows_gpu + block_size_y - 1)/block_size_y); + dim3 blockDim(block_size_x, block_size_y); + fill_matrix_kernel + <<>> + (this->data_gpu, + this->cols_gpu, + value); + } + } + + template + void fill(data_type_vector value, + unsigned block_size=0){ + if(block_size == 0) + { + this->adaboost::core::Vector::fill(value); + } + else + { + fill_vector_kernel + <<< + (this->size_gpu + block_size - 1)/block_size, + block_size + >>>(this->data_gpu, this->size_gpu, value); + } + } + template void multiply(const Vector& vec, diff --git a/adaboost/cuda/cuda_data_structures.hpp b/adaboost/cuda/cuda_data_structures.hpp index b6f67c9..9b60f69 100644 --- a/adaboost/cuda/cuda_data_structures.hpp +++ b/adaboost/cuda/cuda_data_structures.hpp @@ -1,3 +1,5 @@ + + #ifndef CUDA_ADABOOST_CORE_DATA_STRUCTURES_HPP #define CUDA_ADABOOST_CORE_DATA_STRUCTURES_HPP @@ -54,20 +56,6 @@ namespace adaboost */ VectorGPU(unsigned _size); - /* - * Used for filling the vector with a given value. - * If block size is passed 0 then the values are - * filled on the CPU otherwise they are filled on - * GPU. - * - * @param value The value with which the vector is - * to be populated. - * @param block_size The number of threads to be - * launched per block on GPU. - */ - void fill(data_type_vector value, - unsigned block_size=0); - /* * Copies the data from GPU to CPU. */ @@ -129,10 +117,6 @@ namespace adaboost MatrixGPU(unsigned _rows, unsigned _cols); - void fill(data_type_matrix value, - unsigned block_size_x=0, - unsigned block_size_y=0); - void copy_to_host(); void copy_to_device(); diff --git a/adaboost/cuda/cuda_data_structures_impl.hpp b/adaboost/cuda/cuda_data_structures_impl.hpp index e48f3ce..84accb6 100644 --- a/adaboost/cuda/cuda_data_structures_impl.hpp +++ b/adaboost/cuda/cuda_data_structures_impl.hpp @@ -61,25 +61,6 @@ namespace adaboost } } - template - void VectorGPU:: - fill(data_type_vector value, - unsigned block_size) - { - if(block_size == 0) - { - this->adaboost::core::Vector::fill(value); - } - else - { - fill_vector_kernel - <<< - (this->size_gpu + block_size - 1)/block_size, - block_size - >>>(this->data_gpu, this->size_gpu, value); - } - } - template void VectorGPU::copy_to_host() @@ -250,29 +231,6 @@ namespace adaboost data[row*cols + col] = value; } - template - void MatrixGPU:: - fill(data_type_matrix value, - unsigned block_size_x, - unsigned block_size_y) - { - if(block_size_x == 0 || block_size_y == 0) - { - this->adaboost::core::Matrix::fill(value); - } - else - { - dim3 gridDim((this->cols_gpu + block_size_x - 1)/block_size_x, - (this->rows_gpu + block_size_y - 1)/block_size_y); - dim3 blockDim(block_size_x, block_size_y); - fill_matrix_kernel - <<>> - (this->data_gpu, - this->cols_gpu, - value); - } - } - template void MatrixGPU:: copy_to_host() From 5a525b5c7fcd6740b2eeff7e45c806e344f9955e Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Fri, 20 Mar 2020 03:18:13 +0530 Subject: [PATCH 04/25] corrected a mistake in data_structures_impl.cpp --- adaboost/core/data_structures_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adaboost/core/data_structures_impl.cpp b/adaboost/core/data_structures_impl.cpp index 262f1eb..7055850 100644 --- a/adaboost/core/data_structures_impl.cpp +++ b/adaboost/core/data_structures_impl.cpp @@ -1,8 +1,8 @@ #ifndef ADABOOST_CORE_DATA_STRUCTURES_IMPL_CPP #define ADABOOST_CORE_DATA_STRUCTURES_IMPL_CPP -//#include -//#include +#include +#include #include namespace adaboost From 587e931ab03dbf9047afc7dafbf8886c7b902ecc Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Fri, 20 Mar 2020 04:03:09 +0530 Subject: [PATCH 05/25] added cuda_data_structures header file to operation_impl --- adaboost/core/operations.hpp | 8 ++++---- adaboost/core/operations_impl.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index ce9ca2f..2b1dca5 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -14,7 +14,7 @@ namespace adaboost * to be populated. */ template - void fill(data_type_vector value); + void fill(const data_type_vector value); /* * Used for filling the vector with a given value. @@ -28,7 +28,7 @@ namespace adaboost * launched per block on GPU. */ template - void fill(data_type_vector value, + void fill(const data_type_vector value, unsigned block_size=0); /* @overload @@ -38,7 +38,7 @@ namespace adaboost * to be populated. */ template - void fill(data_type_matrix value); + void fill(const data_type_matrix value); /* * Used for filling the matrix with a given value. @@ -50,7 +50,7 @@ namespace adaboost * to be populated. */ template - void fill(data_type_matrix value, + void fill(const data_type_matrix value, unsigned block_size_x=0, unsigned block_size_y=0); diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index 4ea594c..c9d4842 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace adaboost @@ -48,7 +49,7 @@ namespace adaboost } template - void fill(data_type_vector value) + void fill(const data_type_vector value) { for(unsigned int i = 0; i < this->size; i++) { @@ -58,7 +59,7 @@ namespace adaboost template - void fill(data_type_matrix value) + void fill(const data_type_matrix value) { for(unsigned int i = 0; i < this->rows; i++) { @@ -70,7 +71,7 @@ namespace adaboost } template - void fill(data_type_matrix value, + void fill(const data_type_matrix value, unsigned block_size_x=0, unsigned block_size_y=0);{ if(block_size_x == 0 || block_size_y == 0) @@ -91,7 +92,7 @@ namespace adaboost } template - void fill(data_type_vector value, + void fill(const data_type_vector value, unsigned block_size=0){ if(block_size == 0) { From 08c351971847500c315541c8028c34cc50ebc836 Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Thu, 26 Mar 2020 00:51:59 +0530 Subject: [PATCH 06/25] Update adaboost/cuda/cuda_data_structures.hpp Co-Authored-By: Gagandeep Singh --- adaboost/cuda/cuda_data_structures.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/adaboost/cuda/cuda_data_structures.hpp b/adaboost/cuda/cuda_data_structures.hpp index 9b60f69..2976db0 100644 --- a/adaboost/cuda/cuda_data_structures.hpp +++ b/adaboost/cuda/cuda_data_structures.hpp @@ -1,5 +1,3 @@ - - #ifndef CUDA_ADABOOST_CORE_DATA_STRUCTURES_HPP #define CUDA_ADABOOST_CORE_DATA_STRUCTURES_HPP From ae27bd8f6f9f453680422dad063b73ac70ebf182 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Sun, 29 Mar 2020 14:03:01 +0530 Subject: [PATCH 07/25] adding windows support to the readme --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2873a42..0575d08 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,10 @@ We are using the following technologies in our project, 4. Google Test 5. Boost.Python -Note that for building and installing currently only Linux systems are supported. Building from source -------------------- +For Linux Systems 1. git clone https://github.com/codezonediitj/adaboost 2. Move to back to parent directory, `cd ../` @@ -46,6 +46,20 @@ By default `ON`, set it to `OFF` if you do not want to update the already existi Required for installing. Defines the path where the library is to be installed. Set it to, `/usr/local/include` on Linux based systems. + +For Windows Systems + +1. git clone https://github.com/codezonediitj/adaboost +2. Move to back to parent directory, `cd ../` +3. Execute, `mkdir build-adaboost` +4. Execute, `cd build-adaboost` +5. Install CMake from - https://cmake.org/download/ + - Locate the CMake bin folder and copy it's address + + + + + Installing ---------- From cc96fcb5de988f4f971b77914bf6c05a1bdb2bdb Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Sun, 29 Mar 2020 14:17:51 +0530 Subject: [PATCH 08/25] Update README.md --- README.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/README.md b/README.md index 0575d08..845aed8 100644 --- a/README.md +++ b/README.md @@ -46,20 +46,6 @@ By default `ON`, set it to `OFF` if you do not want to update the already existi Required for installing. Defines the path where the library is to be installed. Set it to, `/usr/local/include` on Linux based systems. - -For Windows Systems - -1. git clone https://github.com/codezonediitj/adaboost -2. Move to back to parent directory, `cd ../` -3. Execute, `mkdir build-adaboost` -4. Execute, `cd build-adaboost` -5. Install CMake from - https://cmake.org/download/ - - Locate the CMake bin folder and copy it's address - - - - - Installing ---------- From 1df605375ae003cb84b77e8085cebd4739a5fab2 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Sun, 29 Mar 2020 14:03:01 +0530 Subject: [PATCH 09/25] adding windows support to the readme --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 1edebda..bed46f0 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,15 @@ We are using the following technologies in our project, 4. Google Test 5. Boost.Python + Building from source -------------------- **Linux** +======= + +Building from source +-------------------- +For Linux Systems 1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` 2. Move to back to parent directory, `cd ../` @@ -55,6 +61,20 @@ By default `ON`, set it to `OFF` if you do not want to update the already existi Required for installing if not installing to `/usr/local/include` on Linux based systems. Defines the path where the library is to be installed. + +For Windows Systems + +1. git clone https://github.com/codezonediitj/adaboost +2. Move to back to parent directory, `cd ../` +3. Execute, `mkdir build-adaboost` +4. Execute, `cd build-adaboost` +5. Install CMake from - https://cmake.org/download/ + - Locate the CMake bin folder and copy it's address + + + + + Installing ---------- From 783cd2bd0ff7e17425c0c445b0870abec725f4ff Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Sun, 29 Mar 2020 14:17:51 +0530 Subject: [PATCH 10/25] Update README.md --- README.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/README.md b/README.md index bed46f0..4eea772 100644 --- a/README.md +++ b/README.md @@ -61,20 +61,6 @@ By default `ON`, set it to `OFF` if you do not want to update the already existi Required for installing if not installing to `/usr/local/include` on Linux based systems. Defines the path where the library is to be installed. - -For Windows Systems - -1. git clone https://github.com/codezonediitj/adaboost -2. Move to back to parent directory, `cd ../` -3. Execute, `mkdir build-adaboost` -4. Execute, `cd build-adaboost` -5. Install CMake from - https://cmake.org/download/ - - Locate the CMake bin folder and copy it's address - - - - - Installing ---------- From 2df647f5a08b7e3e9ddb4d409cf4b53014b191f8 Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Wed, 1 Apr 2020 21:12:18 +0530 Subject: [PATCH 11/25] Delete README.md --- README.md | 91 ------------------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index a0a3121..0000000 --- a/README.md +++ /dev/null @@ -1,91 +0,0 @@ -AdaBoost -======== - -[![Build Status](https://travis-ci.com/codezonediitj/adaboost.svg?branch=master)](https://travis-ci.com/codezonediitj/adaboost) [![Join the chat at https://gitter.im/codezoned2017/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codezoned2017/Lobby) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat) - -About Us --------- - -We are some machine learning enthusiasts who aim to implement the adaboost algorithm from scratch. - -Technologies ------------- - -We are using the following technologies in our project, - -1. C++ -2. Python -3. CUDA C -4. Google Test -5. Boost.Python - - -Building from source --------------------- -For Linux Systems - -1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` -2. Move to back to parent directory, `cd ../` -3. Execute, `mkdir build-adaboost` -4. Execute, `cd build-adaboost` -5. Execute, `cmake -D[OPTIONS] ../adaboost` -6. Execute, `make`. Do not execute, `make -j5` if you are using `-DINSTALL_GOOGLETEST=ON` otherwise `make` will try to link tests with `gtest gtest_main` before `GoogleTest` is installed into your system. -7. To test, run, `./bin/*`. Ensure that you have used the option `-DBUILD_TESTS=ON` in step 5 above. - -We provide the following options for `cmake`, - -1. `BUILD_TESTS` - -By default `OFF`, set it to `ON` if you wish to run the tests. Tests are stored in the `bin` under your build directory. - -2. `INSTALL_GOOGLETEST` - -By default `ON`, set it to `OFF` if you do not want to update the already existing GoogleTest on your system. Note that it uses [this release](https://github.com/google/googletest/archive/release-1.10.0.tar.gz) of googletest. - -3. `CMAKE_INSTALL_PREFIX` - -Required for installing if not installing to `/usr/local/include` on Linux based systems. Defines the path where the library is to be installed. - -Installing ----------- - -Follow the steps for building from source. After that run the following, - -``` -sudo make install -``` - -How to contribute? ------------------- - -Follow the steps given below, - -1. Fork, https://github.com/codezonediitj/adaboost -2. Execute, `git clone https://github.com/codezonediitj/adaboost/` -3. Change your working directory to `../adaboost`. -4. Execute, `git remote add origin_user https://github.com//adaboost/` -5. Execute, `git checkout -b `. -6. Make changes to the code. -7. Add your name and email to the AUTHORS, if you wish to. -8. Execute, `git add .`. -9. Execute, `git commit -m "your-commit-message"`. -10. Execute, `git push origin_user `. -11. Make a PR. - -That's it, 10 easy steps for your first contribution. For future contributions just follow steps 5 to 10. Make sure that before starting work, always checkout to master and pull the recent changes using the remote `origin` and then start following steps 5 to 10. - -See you soon with your first PR. - -Guidelines ----------- - -We recommend you to introduce yourself on our [gitter channel](https://gitter.im/codezoned2017/Lobby). You can include the literature you have studied relevant to adaboost, some projects, prior experience with the technologies mentioned above, in your introduction. - -Please follow the rules and guidelines given below, - -1. For Python we follow the [numpydoc docstring guide](https://numpydoc.readthedocs.io/en/latest/format.html). -2. For C++ we follow our own coding style mentioned [here](https://github.com/codezonediitj/adaboost/issues/3#issuecomment-581055358). -3. For C++ documentation we follow, Doxygen style guide. Refer to various modules in the existing `master` branch for the pattern. -4. Follow the Pull Request policy given [here](https://github.com/codezonediitj/adaboost/wiki/Pull-Request-Policy). All changes are made through Pull Requests, no direct commits to the master branch. - -Keep contributing!! From cb7d86fc59c7b76f764e39f98c45fe1ade1c6ece Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Wed, 1 Apr 2020 21:18:38 +0530 Subject: [PATCH 12/25] adding README --- README.md | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4eea772 --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +AdaBoost +======== + +[![Build Status](https://travis-ci.com/codezonediitj/adaboost.svg?branch=master)](https://travis-ci.com/codezonediitj/adaboost) [![Join the chat at https://gitter.im/codezoned2017/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codezoned2017/Lobby) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat) + +About Us +-------- + +We are some machine learning enthusiasts who aim to implement the adaboost algorithm from scratch. + +Technologies +------------ + +We are using the following technologies in our project, + +1. C++ +2. Python +3. CUDA C +4. Google Test +5. Boost.Python + + +Building from source +-------------------- +**Linux** +======= + +Building from source +-------------------- +For Linux Systems + +1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` +2. Move to back to parent directory, `cd ../` +3. Execute, `mkdir build-adaboost` +4. Execute, `cd build-adaboost` +5. Execute, `cmake -D[OPTIONS] ../adaboost` +6. Execute, `make`. Do not execute, `make -j5` if you are using `-DINSTALL_GOOGLETEST=ON` otherwise `make` will try to link tests with `gtest gtest_main` before `GoogleTest` is installed into your system. +7. To test, run, `./bin/*`. Ensure that you have used the option `-DBUILD_TESTS=ON` in step 5 above. + +**Windows** + +1. git clone https://github.com/codezonediitj/adaboost +2. Move to back to parent directory, `cd ../` +3. Execute, `mkdir build-adaboost` +4. Execute, `cd build-adaboost` +5. Install CMake from [https://cmake.org/download/](https://cmake.org/download/). You can also follow the steps given at, https://cgold.readthedocs.io/en/latest/first-step/installation.html#windows +6. Open `cmake` GUI and put the `adaboost` directory as source code in the source code field and `build-adaboost` directory in the build binaries field. +7. Select the `cmake` options(see below) which you want to use for building, then click `Configure` and `Generate`, to build the files . + +We provide the following options for `cmake`, + +1. `BUILD_TESTS` + +By default `OFF`, set it to `ON` if you wish to run the tests. Tests are stored in the `bin` under your build directory. + +2. `INSTALL_GOOGLETEST` + +By default `ON`, set it to `OFF` if you do not want to update the already existing GoogleTest on your system. Note that it uses [this release](https://github.com/google/googletest/archive/release-1.10.0.tar.gz) of googletest. + +3. `CMAKE_INSTALL_PREFIX` + +Required for installing if not installing to `/usr/local/include` on Linux based systems. Defines the path where the library is to be installed. + +Installing +---------- + +Follow the steps for building from source. After that run the following, + +**Linux** +``` +sudo make install +``` +**Windows** +``` +cmake install +``` + +How to contribute? +------------------ + +Follow the steps given below, + +1. Fork, https://github.com/codezonediitj/adaboost +2. Execute, `git clone https://github.com/codezonediitj/adaboost/` +3. Change your working directory to `../adaboost`. +4. Execute, `git remote add origin_user https://github.com//adaboost/` +5. Execute, `git checkout -b `. +6. Make changes to the code. +7. Add your name and email to the AUTHORS, if you wish to. +8. Execute, `git add .`. +9. Execute, `git commit -m "your-commit-message"`. +10. Execute, `git push origin_user `. +11. Make a PR. + +That's it, 10 easy steps for your first contribution. For future contributions just follow steps 5 to 10. Make sure that before starting work, always checkout to master and pull the recent changes using the remote `origin` and then start following steps 5 to 10. + +See you soon with your first PR. + +Guidelines +---------- + +We recommend you to introduce yourself on our [gitter channel](https://gitter.im/codezoned2017/Lobby). You can include the literature you have studied relevant to adaboost, some projects, prior experience with the technologies mentioned above, in your introduction. + +Please follow the rules and guidelines given below, + +1. For Python we follow the [numpydoc docstring guide](https://numpydoc.readthedocs.io/en/latest/format.html). +2. For C++ we follow our own coding style mentioned [here](https://github.com/codezonediitj/adaboost/issues/3#issuecomment-581055358). +3. For C++ documentation we follow, Doxygen style guide. Refer to various modules in the existing `master` branch for the pattern. +4. Follow the Pull Request policy given [here](https://github.com/codezonediitj/adaboost/wiki/Pull-Request-Policy). All changes are made through Pull Requests, no direct commits to the master branch. + +Keep contributing!! From fbb0f44192e2cc3d1536388406e50ca82ceee739 Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Wed, 1 Apr 2020 21:21:47 +0530 Subject: [PATCH 13/25] Delete README.md --- README.md | 111 ------------------------------------------------------ 1 file changed, 111 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 4eea772..0000000 --- a/README.md +++ /dev/null @@ -1,111 +0,0 @@ -AdaBoost -======== - -[![Build Status](https://travis-ci.com/codezonediitj/adaboost.svg?branch=master)](https://travis-ci.com/codezonediitj/adaboost) [![Join the chat at https://gitter.im/codezoned2017/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codezoned2017/Lobby) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat) - -About Us --------- - -We are some machine learning enthusiasts who aim to implement the adaboost algorithm from scratch. - -Technologies ------------- - -We are using the following technologies in our project, - -1. C++ -2. Python -3. CUDA C -4. Google Test -5. Boost.Python - - -Building from source --------------------- -**Linux** -======= - -Building from source --------------------- -For Linux Systems - -1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` -2. Move to back to parent directory, `cd ../` -3. Execute, `mkdir build-adaboost` -4. Execute, `cd build-adaboost` -5. Execute, `cmake -D[OPTIONS] ../adaboost` -6. Execute, `make`. Do not execute, `make -j5` if you are using `-DINSTALL_GOOGLETEST=ON` otherwise `make` will try to link tests with `gtest gtest_main` before `GoogleTest` is installed into your system. -7. To test, run, `./bin/*`. Ensure that you have used the option `-DBUILD_TESTS=ON` in step 5 above. - -**Windows** - -1. git clone https://github.com/codezonediitj/adaboost -2. Move to back to parent directory, `cd ../` -3. Execute, `mkdir build-adaboost` -4. Execute, `cd build-adaboost` -5. Install CMake from [https://cmake.org/download/](https://cmake.org/download/). You can also follow the steps given at, https://cgold.readthedocs.io/en/latest/first-step/installation.html#windows -6. Open `cmake` GUI and put the `adaboost` directory as source code in the source code field and `build-adaboost` directory in the build binaries field. -7. Select the `cmake` options(see below) which you want to use for building, then click `Configure` and `Generate`, to build the files . - -We provide the following options for `cmake`, - -1. `BUILD_TESTS` - -By default `OFF`, set it to `ON` if you wish to run the tests. Tests are stored in the `bin` under your build directory. - -2. `INSTALL_GOOGLETEST` - -By default `ON`, set it to `OFF` if you do not want to update the already existing GoogleTest on your system. Note that it uses [this release](https://github.com/google/googletest/archive/release-1.10.0.tar.gz) of googletest. - -3. `CMAKE_INSTALL_PREFIX` - -Required for installing if not installing to `/usr/local/include` on Linux based systems. Defines the path where the library is to be installed. - -Installing ----------- - -Follow the steps for building from source. After that run the following, - -**Linux** -``` -sudo make install -``` -**Windows** -``` -cmake install -``` - -How to contribute? ------------------- - -Follow the steps given below, - -1. Fork, https://github.com/codezonediitj/adaboost -2. Execute, `git clone https://github.com/codezonediitj/adaboost/` -3. Change your working directory to `../adaboost`. -4. Execute, `git remote add origin_user https://github.com//adaboost/` -5. Execute, `git checkout -b `. -6. Make changes to the code. -7. Add your name and email to the AUTHORS, if you wish to. -8. Execute, `git add .`. -9. Execute, `git commit -m "your-commit-message"`. -10. Execute, `git push origin_user `. -11. Make a PR. - -That's it, 10 easy steps for your first contribution. For future contributions just follow steps 5 to 10. Make sure that before starting work, always checkout to master and pull the recent changes using the remote `origin` and then start following steps 5 to 10. - -See you soon with your first PR. - -Guidelines ----------- - -We recommend you to introduce yourself on our [gitter channel](https://gitter.im/codezoned2017/Lobby). You can include the literature you have studied relevant to adaboost, some projects, prior experience with the technologies mentioned above, in your introduction. - -Please follow the rules and guidelines given below, - -1. For Python we follow the [numpydoc docstring guide](https://numpydoc.readthedocs.io/en/latest/format.html). -2. For C++ we follow our own coding style mentioned [here](https://github.com/codezonediitj/adaboost/issues/3#issuecomment-581055358). -3. For C++ documentation we follow, Doxygen style guide. Refer to various modules in the existing `master` branch for the pattern. -4. Follow the Pull Request policy given [here](https://github.com/codezonediitj/adaboost/wiki/Pull-Request-Policy). All changes are made through Pull Requests, no direct commits to the master branch. - -Keep contributing!! From a0677af48998d21122ff8c8076e24d22937e1232 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Wed, 1 Apr 2020 21:29:22 +0530 Subject: [PATCH 14/25] commit --- README.md | 111 ------------------------------------------------------ 1 file changed, 111 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 4eea772..0000000 --- a/README.md +++ /dev/null @@ -1,111 +0,0 @@ -AdaBoost -======== - -[![Build Status](https://travis-ci.com/codezonediitj/adaboost.svg?branch=master)](https://travis-ci.com/codezonediitj/adaboost) [![Join the chat at https://gitter.im/codezoned2017/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codezoned2017/Lobby) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat) - -About Us --------- - -We are some machine learning enthusiasts who aim to implement the adaboost algorithm from scratch. - -Technologies ------------- - -We are using the following technologies in our project, - -1. C++ -2. Python -3. CUDA C -4. Google Test -5. Boost.Python - - -Building from source --------------------- -**Linux** -======= - -Building from source --------------------- -For Linux Systems - -1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` -2. Move to back to parent directory, `cd ../` -3. Execute, `mkdir build-adaboost` -4. Execute, `cd build-adaboost` -5. Execute, `cmake -D[OPTIONS] ../adaboost` -6. Execute, `make`. Do not execute, `make -j5` if you are using `-DINSTALL_GOOGLETEST=ON` otherwise `make` will try to link tests with `gtest gtest_main` before `GoogleTest` is installed into your system. -7. To test, run, `./bin/*`. Ensure that you have used the option `-DBUILD_TESTS=ON` in step 5 above. - -**Windows** - -1. git clone https://github.com/codezonediitj/adaboost -2. Move to back to parent directory, `cd ../` -3. Execute, `mkdir build-adaboost` -4. Execute, `cd build-adaboost` -5. Install CMake from [https://cmake.org/download/](https://cmake.org/download/). You can also follow the steps given at, https://cgold.readthedocs.io/en/latest/first-step/installation.html#windows -6. Open `cmake` GUI and put the `adaboost` directory as source code in the source code field and `build-adaboost` directory in the build binaries field. -7. Select the `cmake` options(see below) which you want to use for building, then click `Configure` and `Generate`, to build the files . - -We provide the following options for `cmake`, - -1. `BUILD_TESTS` - -By default `OFF`, set it to `ON` if you wish to run the tests. Tests are stored in the `bin` under your build directory. - -2. `INSTALL_GOOGLETEST` - -By default `ON`, set it to `OFF` if you do not want to update the already existing GoogleTest on your system. Note that it uses [this release](https://github.com/google/googletest/archive/release-1.10.0.tar.gz) of googletest. - -3. `CMAKE_INSTALL_PREFIX` - -Required for installing if not installing to `/usr/local/include` on Linux based systems. Defines the path where the library is to be installed. - -Installing ----------- - -Follow the steps for building from source. After that run the following, - -**Linux** -``` -sudo make install -``` -**Windows** -``` -cmake install -``` - -How to contribute? ------------------- - -Follow the steps given below, - -1. Fork, https://github.com/codezonediitj/adaboost -2. Execute, `git clone https://github.com/codezonediitj/adaboost/` -3. Change your working directory to `../adaboost`. -4. Execute, `git remote add origin_user https://github.com//adaboost/` -5. Execute, `git checkout -b `. -6. Make changes to the code. -7. Add your name and email to the AUTHORS, if you wish to. -8. Execute, `git add .`. -9. Execute, `git commit -m "your-commit-message"`. -10. Execute, `git push origin_user `. -11. Make a PR. - -That's it, 10 easy steps for your first contribution. For future contributions just follow steps 5 to 10. Make sure that before starting work, always checkout to master and pull the recent changes using the remote `origin` and then start following steps 5 to 10. - -See you soon with your first PR. - -Guidelines ----------- - -We recommend you to introduce yourself on our [gitter channel](https://gitter.im/codezoned2017/Lobby). You can include the literature you have studied relevant to adaboost, some projects, prior experience with the technologies mentioned above, in your introduction. - -Please follow the rules and guidelines given below, - -1. For Python we follow the [numpydoc docstring guide](https://numpydoc.readthedocs.io/en/latest/format.html). -2. For C++ we follow our own coding style mentioned [here](https://github.com/codezonediitj/adaboost/issues/3#issuecomment-581055358). -3. For C++ documentation we follow, Doxygen style guide. Refer to various modules in the existing `master` branch for the pattern. -4. Follow the Pull Request policy given [here](https://github.com/codezonediitj/adaboost/wiki/Pull-Request-Policy). All changes are made through Pull Requests, no direct commits to the master branch. - -Keep contributing!! From 2e05e35cb2db7138e3b02d0d9b21b5b3ddc903c4 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Wed, 1 Apr 2020 21:51:52 +0530 Subject: [PATCH 15/25] commit --- README.md | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4eea772 --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +AdaBoost +======== + +[![Build Status](https://travis-ci.com/codezonediitj/adaboost.svg?branch=master)](https://travis-ci.com/codezonediitj/adaboost) [![Join the chat at https://gitter.im/codezoned2017/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codezoned2017/Lobby) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat) + +About Us +-------- + +We are some machine learning enthusiasts who aim to implement the adaboost algorithm from scratch. + +Technologies +------------ + +We are using the following technologies in our project, + +1. C++ +2. Python +3. CUDA C +4. Google Test +5. Boost.Python + + +Building from source +-------------------- +**Linux** +======= + +Building from source +-------------------- +For Linux Systems + +1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` +2. Move to back to parent directory, `cd ../` +3. Execute, `mkdir build-adaboost` +4. Execute, `cd build-adaboost` +5. Execute, `cmake -D[OPTIONS] ../adaboost` +6. Execute, `make`. Do not execute, `make -j5` if you are using `-DINSTALL_GOOGLETEST=ON` otherwise `make` will try to link tests with `gtest gtest_main` before `GoogleTest` is installed into your system. +7. To test, run, `./bin/*`. Ensure that you have used the option `-DBUILD_TESTS=ON` in step 5 above. + +**Windows** + +1. git clone https://github.com/codezonediitj/adaboost +2. Move to back to parent directory, `cd ../` +3. Execute, `mkdir build-adaboost` +4. Execute, `cd build-adaboost` +5. Install CMake from [https://cmake.org/download/](https://cmake.org/download/). You can also follow the steps given at, https://cgold.readthedocs.io/en/latest/first-step/installation.html#windows +6. Open `cmake` GUI and put the `adaboost` directory as source code in the source code field and `build-adaboost` directory in the build binaries field. +7. Select the `cmake` options(see below) which you want to use for building, then click `Configure` and `Generate`, to build the files . + +We provide the following options for `cmake`, + +1. `BUILD_TESTS` + +By default `OFF`, set it to `ON` if you wish to run the tests. Tests are stored in the `bin` under your build directory. + +2. `INSTALL_GOOGLETEST` + +By default `ON`, set it to `OFF` if you do not want to update the already existing GoogleTest on your system. Note that it uses [this release](https://github.com/google/googletest/archive/release-1.10.0.tar.gz) of googletest. + +3. `CMAKE_INSTALL_PREFIX` + +Required for installing if not installing to `/usr/local/include` on Linux based systems. Defines the path where the library is to be installed. + +Installing +---------- + +Follow the steps for building from source. After that run the following, + +**Linux** +``` +sudo make install +``` +**Windows** +``` +cmake install +``` + +How to contribute? +------------------ + +Follow the steps given below, + +1. Fork, https://github.com/codezonediitj/adaboost +2. Execute, `git clone https://github.com/codezonediitj/adaboost/` +3. Change your working directory to `../adaboost`. +4. Execute, `git remote add origin_user https://github.com//adaboost/` +5. Execute, `git checkout -b `. +6. Make changes to the code. +7. Add your name and email to the AUTHORS, if you wish to. +8. Execute, `git add .`. +9. Execute, `git commit -m "your-commit-message"`. +10. Execute, `git push origin_user `. +11. Make a PR. + +That's it, 10 easy steps for your first contribution. For future contributions just follow steps 5 to 10. Make sure that before starting work, always checkout to master and pull the recent changes using the remote `origin` and then start following steps 5 to 10. + +See you soon with your first PR. + +Guidelines +---------- + +We recommend you to introduce yourself on our [gitter channel](https://gitter.im/codezoned2017/Lobby). You can include the literature you have studied relevant to adaboost, some projects, prior experience with the technologies mentioned above, in your introduction. + +Please follow the rules and guidelines given below, + +1. For Python we follow the [numpydoc docstring guide](https://numpydoc.readthedocs.io/en/latest/format.html). +2. For C++ we follow our own coding style mentioned [here](https://github.com/codezonediitj/adaboost/issues/3#issuecomment-581055358). +3. For C++ documentation we follow, Doxygen style guide. Refer to various modules in the existing `master` branch for the pattern. +4. Follow the Pull Request policy given [here](https://github.com/codezonediitj/adaboost/wiki/Pull-Request-Policy). All changes are made through Pull Requests, no direct commits to the master branch. + +Keep contributing!! From 2195e6bb614beba083c91dec525ce80417daa044 Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Wed, 1 Apr 2020 21:53:28 +0530 Subject: [PATCH 16/25] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ + From 21a1df85d0372e263c4132f504a9b490a273fe5f Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Fri, 3 Apr 2020 01:29:43 +0530 Subject: [PATCH 17/25] changed fill method's definition --- adaboost/core/operations.hpp | 8 ++++++-- adaboost/core/operations_impl.cpp | 16 +++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index 2b1dca5..927d702 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -12,9 +12,11 @@ namespace adaboost * * @param value The value with which the vector is * to be populated. + * @param vec The Vector */ template - void fill(const data_type_vector value); + void fill(const data_type_vector value, + const Vector& vec); /* * Used for filling the vector with a given value. @@ -36,9 +38,11 @@ namespace adaboost * * @param value The value with which the matrix is * to be populated. + * @param vec The Matrix */ template - void fill(const data_type_matrix value); + void fill(const data_type_matrix value, + const Matrix& mat); /* * Used for filling the matrix with a given value. diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index c9d4842..bf43d27 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -49,23 +49,25 @@ namespace adaboost } template - void fill(const data_type_vector value) + void fill(const data_type_vector value, + const Vector& vec) { - for(unsigned int i = 0; i < this->size; i++) + for(unsigned int i = 0; i < vec.get_size(); i++) { - this->data[i] = value; + vec.get_data_pointer()data[i] = value; } } template - void fill(const data_type_matrix value) + void fill(const data_type_matrix value, + const Matrix& mat) { - for(unsigned int i = 0; i < this->rows; i++) + for(unsigned int i = 0; i < mat.get_rows(); i++) { - for(unsigned int j = 0; j < this->cols; j++) + for(unsigned int j = 0; j < mat.get_cols(); j++) { - this->data[i*this->cols + j] = value; + mat.get_data_pointer()[i*mat.get_cols() + j] = value; } } } From ae4180cec58d785c7f7e1a6f1d65b09899950b85 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Fri, 3 Apr 2020 02:43:00 +0530 Subject: [PATCH 18/25] minor modification --- adaboost/core/operations.hpp | 6 +- adaboost/core/operations_impl.cpp | 139 +++++++++++++++--------------- 2 files changed, 75 insertions(+), 70 deletions(-) diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index 927d702..df73f94 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -26,11 +26,13 @@ namespace adaboost * * @param value The value with which the vector is * to be populated. + * @param vec The Vector * @param block_size The number of threads to be * launched per block on GPU. */ template void fill(const data_type_vector value, + const VectorGPU& vec, unsigned block_size=0); /* @overload @@ -38,7 +40,7 @@ namespace adaboost * * @param value The value with which the matrix is * to be populated. - * @param vec The Matrix + * @param mat The Matrix */ template void fill(const data_type_matrix value, @@ -52,9 +54,11 @@ namespace adaboost * * @param value The value with which the matrix is * to be populated. + * @param mat The matrix */ template void fill(const data_type_matrix value, + const MatrixGPU& mat, unsigned block_size_x=0, unsigned block_size_y=0); diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index bf43d27..113b13a 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -9,48 +9,10 @@ namespace adaboost { namespace core - { - template - void Sum( - data_type (*func_ptr)(data_type), - const Vector& vec, - unsigned start, - unsigned end, - data_type& result) - { - adaboost::utils::check(vec.get_size() >= start, - "Start is out of range."); - end = vec.get_size() - 1 < end ? - vec.get_size() - 1 : end; - result = 0; - for(unsigned i = start; i <= end; i++) - { - result += func_ptr(vec.at(i)); - } - } - - template - void Argmax( - data_type_2 (*func_ptr)(data_type_1), - const Vector& vec, - data_type_1& result) - { - data_type_2 max_val = func_ptr(vec.at(0)); - data_type_1 arg_max = vec.at(0); - for(unsigned i = 0; i < vec.get_size(); i++) - { - if(max_val < func_ptr(vec.at(i))) - { - max_val = func_ptr(vec.at(i)); - arg_max = vec.at(i); - } - } - result = arg_max; - } - - template + { + template void fill(const data_type_vector value, - const Vector& vec) + const Vector& vec) { for(unsigned int i = 0; i < vec.get_size(); i++) { @@ -58,10 +20,27 @@ namespace adaboost } } + template + void fill(const data_type_vector value, + unsigned block_size=0, + const VectorGPU& vec){ + if(block_size == 0) + { + this->adaboost::core::Vector::fill(value); + } + else + { + fill_vector_kernel + <<< + ( vec.get_size(gpu) + block_size - 1)/block_size, + block_size + >>>(vec.get_data_pointer(gpu), vec.get_size(gpu), value); + } + } - template + template void fill(const data_type_matrix value, - const Matrix& mat) + const Matrix& mat) { for(unsigned int i = 0; i < mat.get_rows(); i++) { @@ -72,49 +51,71 @@ namespace adaboost } } - template + template void fill(const data_type_matrix value, + const MatrixGPU& mat, unsigned block_size_x=0, - unsigned block_size_y=0);{ + unsigned block_size_y=0){ if(block_size_x == 0 || block_size_y == 0) { this->adaboost::core::Matrix::fill(value); } else { - dim3 gridDim((this->cols_gpu + block_size_x - 1)/block_size_x, - (this->rows_gpu + block_size_y - 1)/block_size_y); + dim3 gridDim((mat.get_cols(gpu) + block_size_x - 1)/block_size_x, + (mat.get_rows(gpu) + block_size_y - 1)/block_size_y); dim3 blockDim(block_size_x, block_size_y); fill_matrix_kernel <<>> - (this->data_gpu, - this->cols_gpu, + (mat.get_data_pointer(gpu), + mat.get_rows(gpu), value); } } + - template - void fill(const data_type_vector value, - unsigned block_size=0){ - if(block_size == 0) - { - this->adaboost::core::Vector::fill(value); - } - else + template + void Sum( + data_type (*func_ptr)(data_type), + const Vector& vec, + unsigned start, + unsigned end, + data_type& result) + { + adaboost::utils::check(vec.get_size() >= start, + "Start is out of range."); + end = vec.get_size() - 1 < end ? + vec.get_size() - 1 : end; + result = 0; + for(unsigned i = start; i <= end; i++) + { + result += func_ptr(vec.at(i)); + } + } + + template + void Argmax( + data_type_2 (*func_ptr)(data_type_1), + const Vector& vec, + data_type_1& result) + { + data_type_2 max_val = func_ptr(vec.at(0)); + data_type_1 arg_max = vec.at(0); + for(unsigned i = 0; i < vec.get_size(); i++) + { + if(max_val < func_ptr(vec.at(i))) { - fill_vector_kernel - <<< - (this->size_gpu + block_size - 1)/block_size, - block_size - >>>(this->data_gpu, this->size_gpu, value); + max_val = func_ptr(vec.at(i)); + arg_max = vec.at(i); } } - - - template + result = arg_max; + } + + template void multiply(const Vector& vec, - const Matrix& mat, - Vector& result) + const Matrix& mat, + Vector& result) { adaboost::utils::check(vec.get_size() == mat.get_rows(), "Orders mismatch in the inputs."); @@ -131,8 +132,8 @@ namespace adaboost template void multiply(const Matrix& mat1, - const Matrix& mat2, - Matrix& result) + const Matrix& mat2, + Matrix& result) { adaboost::utils::check(mat1.get_cols() == mat2.get_rows(), "Order of matrices don't match."); From 8c4d0fdf7e5301904099ebfb7bc3ce3afbe11948 Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Fri, 3 Apr 2020 03:14:26 +0530 Subject: [PATCH 19/25] Update README.md --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 49a60a7..a57b9f3 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,6 @@ We are using the following technologies in our project, Building from source -------------------- **Linux** -======= - -Building from source --------------------- -For Linux Systems 1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` 2. Move to back to parent directory, `cd ../` From 551491f5353fc7f8688cc7e800e541d61eeed956 Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Fri, 3 Apr 2020 22:38:54 +0530 Subject: [PATCH 20/25] Update README.md Co-Authored-By: Gagandeep Singh --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 49a60a7..b557bda 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ - +AdaBoost +======== [![Build Status](https://travis-ci.com/codezonediitj/adaboost.svg?branch=master)](https://travis-ci.com/codezonediitj/adaboost) [![Join the chat at https://gitter.im/codezoned2017/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codezoned2017/Lobby) ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat) @@ -109,4 +110,3 @@ Please follow the rules and guidelines given below, Keep contributing!! ======= - From 5975697b9f6025c8762035a1bff49312530f3721 Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Fri, 3 Apr 2020 22:39:10 +0530 Subject: [PATCH 21/25] Update README.md Co-Authored-By: Gagandeep Singh --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index b557bda..b428b7e 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,6 @@ We are using the following technologies in our project, Building from source -------------------- **Linux** -======= - -Building from source --------------------- -For Linux Systems 1. Clone Repository to local machine `git clone https://github.com/codezonediitj/adaboost` 2. Move to back to parent directory, `cd ../` From 613c4fa74faa3e64bc8f4e7d4c219d4ae32a5079 Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Sat, 4 Apr 2020 00:44:22 +0530 Subject: [PATCH 22/25] added fill kernels to operations --- adaboost/core/operations_impl.cpp | 28 +++++++++++++++++++++ adaboost/cuda/cuda_data_structures_impl.hpp | 28 +-------------------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index 113b13a..c12e590 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -19,6 +19,20 @@ namespace adaboost vec.get_data_pointer()data[i] = value; } } + + template + __global__ void fill_vector_kernel + (data_type_vector* data, + unsigned size, + data_type_vector value) + { + unsigned index = threadIdx.x; + unsigned stride = blockDim.x; + for(unsigned i = index; i < size; i += stride) + { + data[i] = value; + } + } template void fill(const data_type_vector value, @@ -38,6 +52,8 @@ namespace adaboost } } + + template void fill(const data_type_matrix value, const Matrix& mat) @@ -50,6 +66,18 @@ namespace adaboost } } } + + template + __global__ + void fill_matrix_kernel + (data_type_matrix* data, + unsigned cols, + data_type_matrix value) + { + unsigned row = blockDim.y*blockIdx.y + threadIdx.y; + unsigned col = blockDim.x*blockIdx.x + threadIdx.x; + data[row*cols + col] = value; + } template void fill(const data_type_matrix value, diff --git a/adaboost/cuda/cuda_data_structures_impl.hpp b/adaboost/cuda/cuda_data_structures_impl.hpp index 84accb6..6b3a651 100644 --- a/adaboost/cuda/cuda_data_structures_impl.hpp +++ b/adaboost/cuda/cuda_data_structures_impl.hpp @@ -47,20 +47,6 @@ namespace adaboost { } - template - __global__ void fill_vector_kernel - (data_type_vector* data, - unsigned size, - data_type_vector value) - { - unsigned index = threadIdx.x; - unsigned stride = blockDim.x; - for(unsigned i = index; i < size; i += stride) - { - data[i] = value; - } - } - template void VectorGPU::copy_to_host() @@ -107,7 +93,7 @@ namespace adaboost } else { - return this->adaboost::core::Vector::get_data_pointer(); + return this>adaboost::core::Vector::get_data_pointer(); } } @@ -219,18 +205,6 @@ namespace adaboost { } - template - __global__ - void fill_matrix_kernel - (data_type_matrix* data, - unsigned cols, - data_type_matrix value) - { - unsigned row = blockDim.y*blockIdx.y + threadIdx.y; - unsigned col = blockDim.x*blockIdx.x + threadIdx.x; - data[row*cols + col] = value; - } - template void MatrixGPU:: copy_to_host() From 6bb348a434086f87b8fd564a9cdbe63f532c77bd Mon Sep 17 00:00:00 2001 From: Monika Jha Date: Sat, 4 Apr 2020 02:21:13 +0530 Subject: [PATCH 23/25] moved multiply and product methods from CUDA to operations --- adaboost/core/operations.hpp | 97 +++++---- adaboost/core/operations_impl.cpp | 223 ++++++++++++++------ adaboost/cuda/cuda_data_structures.hpp | 19 +- adaboost/cuda/cuda_data_structures_impl.hpp | 109 +--------- 4 files changed, 227 insertions(+), 221 deletions(-) diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index df73f94..92037e9 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -17,6 +17,18 @@ namespace adaboost template void fill(const data_type_vector value, const Vector& vec); + + /* + * Used for taking dot product of two vectors. + * + * @param vec1 First vector in dot product. + * @param vec2 Second vector in dot product. + * @param result For storing the result. + */ + template + void product(const Vector& vec1, + const Vector& vec2, + data_type_vector& result); /* * Used for filling the vector with a given value. @@ -35,6 +47,18 @@ namespace adaboost const VectorGPU& vec, unsigned block_size=0); + /* + * This function computes + * dot product of two vectors on + * GPU. + */ + template + void product_gpu(const VectorGPU& vec1, + const VectorGPU& vec2, + data_type_vector& result, + unsigned block_size=0); + + /* @overload * Used for filling the matrix with a given value. * @@ -45,6 +69,31 @@ namespace adaboost template void fill(const data_type_matrix value, const Matrix& mat); + + /* @overload + * Used for multiplyng two matrices. + * + * @param vec1 First matrix. + * @param vec2 Second matrix. + * @param result A matrix for storing the result. + */ + template + void multiply(const Matrix& mat1, + const Matrix& mat2, + Matrix& result); + + /* @overload + * Used for multiplying a vector + * and a matrix. + * + * @param vec The vector. + * @param mat The matrix. + * @param result A vector for storing the result. + */ + template + void multiply(const Vector& vec, + const Matrix& mat, + Vector& result); /* * Used for filling the matrix with a given value. @@ -62,6 +111,16 @@ namespace adaboost unsigned block_size_x=0, unsigned block_size_y=0); + /* + * This function is + * used for multiplyng two matrices on + * GPU. + */ + template + void multiply_gpu(const MatrixGPU& mat1, + const MatrixGPU& mat2, + MatrixGPU& result); + /* * This function computes the sum of * elements of the given vector and the @@ -108,43 +167,7 @@ namespace adaboost const Vector& vec, data_type_1& result); - /* - * @overload - * Used for taking dot product of two vectors. - * - * @param vec1 First vector in dot product. - * @param vec2 Second vector in dot product. - * @param result For storing the result. - */ - template - void product(const Vector& vec1, - const Vector& vec2, - data_type_vector& result); - - /* @overload - * Used for multiplyng two matrices. - * - * @param vec1 First matrix. - * @param vec2 Second matrix. - * @param result A matrix for storing the result. - */ - template - void multiply(const Matrix& mat1, - const Matrix& mat2, - Matrix& result); - - /* @overload - * Used for multiplying a vector - * and a matrix. - * - * @param vec The vector. - * @param mat The matrix. - * @param result A vector for storing the result. - */ - template - void multiply(const Vector& vec, - const Matrix& mat, - Vector& result); + } // namespace core } // namespace adaboost diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index c12e590..cd5a96f 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -19,7 +19,21 @@ namespace adaboost vec.get_data_pointer()data[i] = value; } } - + + template + void product(const Vector& vec1, + const Vector& vec2, + data_type_vector& result) + { + adaboost::utils::check(vec1.get_size() == vec2.get_size(), + "Size of vectors don't match."); + result = 0; + for(unsigned int i = 0; i < vec1.get_size(); i++) + { + result += (vec1.at(i)*vec2.at(i)); + } + } + template __global__ void fill_vector_kernel (data_type_vector* data, @@ -52,7 +66,71 @@ namespace adaboost } } - + template + __global__ + void product_kernel + (data_type_vector* v1, data_type_vector* v2, data_type_vector* v3, + unsigned size) + { + __shared__ data_type_vector cache[MAX_BLOCK_SIZE]; + data_type_vector temp = 0; + unsigned thread_i = threadIdx.x + blockDim.x*blockIdx.x; + unsigned cache_i = threadIdx.x; + while(thread_i < size) + { + temp += v1[thread_i]*v2[thread_i]; + thread_i = blockDim.x*gridDim.x; + } + cache[cache_i] = temp; + __syncthreads(); + + unsigned i = blockDim.x/2; + while(i != 0) + { + if(cache_i < i) + { + cache[cache_i] += cache[cache_i + i]; + } + __syncthreads(); + i /= 2; + } + + if(cache_i == 0) + v3[blockIdx.x] = cache[0]; + } + + template + void product_gpu(const VectorGPU& vec1, + const VectorGPU& vec2, + data_type_vector& result, + unsigned block_size) + { + if(block_size == 0) + { + return adaboost::core::product(vec1, vec2, result); + } + else + { + adaboost::utils::check(vec1.get_size() == vec2.get_size(), + "Size of vectors don't match."); + adaboost::utils::check(block_size > 0, + "Size of the block should be a positive multiple of 32."); + unsigned num_blocks = (vec1.get_size() + block_size - 1)/block_size; + VectorGPU temp_result(num_blocks); + product_kernel + <<< + num_blocks, + block_size + >>>(vec1.get_data_pointer(), vec2.get_data_pointer(), + temp_result.get_data_pointer(), vec1.get_size()); + temp_result.copy_to_host(); + result = 0; + for(unsigned i = 0; i < num_blocks; i++) + { + result += temp_result.at(i); + } + } + } template void fill(const data_type_matrix value, @@ -67,6 +145,46 @@ namespace adaboost } } + template + void multiply(const Vector& vec, + const Matrix& mat, + Vector& result) + { + adaboost::utils::check(vec.get_size() == mat.get_rows(), + "Orders mismatch in the inputs."); + for(unsigned int j = 0; j < mat.get_cols(); j++) + { + data_type_vector _result = 0; + for(unsigned int i = 0; i < mat.get_rows(); i++) + { + _result += (vec.at(i)*mat.at(i, j)); + } + result.set(j, _result); + } + } + + template + void multiply(const Matrix& mat1, + const Matrix& mat2, + Matrix& result) + { + adaboost::utils::check(mat1.get_cols() == mat2.get_rows(), + "Order of matrices don't match."); + unsigned int common_cols = mat1.get_cols(); + for(unsigned int i = 0; i < result.get_rows(); i++) + { + for(unsigned int j = 0; j < result.get_cols(); j++) + { + data_type_matrix _result = 0; + for(unsigned int k = 0; k < common_cols; k++) + { + _result += (mat1.at(i, k)*mat2.at(k, j)); + } + result.set(i, j, _result); + } + } + } + template __global__ void fill_matrix_kernel @@ -101,6 +219,47 @@ namespace adaboost } } + template + __global__ + void multiply_kernel( + data_type_matrix* mat1, + data_type_matrix* mat2, + data_type_matrix* result, + unsigned mat1_rows, + unsigned mat1_cols, + unsigned mat2_rows, + unsigned mat2_cols) + { + data_type_matrix cvalue = 0.0; + unsigned row = blockIdx.y*blockDim.y + threadIdx.y; + unsigned col = blockIdx.x*blockDim.x + threadIdx.x; + if(row > mat1_rows || col > mat2_cols) + return ; + for(unsigned e = 0; e < mat1_cols; e++) + cvalue += mat1[row*mat1_cols+e] * mat2[e*mat2_cols+col]; + result[row*mat2_cols+col] = cvalue; + } + + template + void multiply_gpu(const MatrixGPU& mat1, + const MatrixGPU& mat2, + MatrixGPU& result) + { + adaboost::utils::check(mat1.get_cols() == mat2.get_rows(), + "Order of matrices don't match."); + dim3 gridDim((mat2.get_cols() + BLOCK_SIZE - 1)/BLOCK_SIZE, + (mat1.get_rows() + BLOCK_SIZE - 1)/BLOCK_SIZE); + dim3 blockDim(BLOCK_SIZE, BLOCK_SIZE); + multiply_kernel + <<>> + (mat1.get_data_pointer(), + mat2.get_data_pointer(), + result.get_data_pointer(), + mat1.get_rows(), + mat1.get_cols(), + mat2.get_rows(), + mat2.get_cols()); + } template void Sum( @@ -138,64 +297,10 @@ namespace adaboost } } result = arg_max; - } - - template - void multiply(const Vector& vec, - const Matrix& mat, - Vector& result) - { - adaboost::utils::check(vec.get_size() == mat.get_rows(), - "Orders mismatch in the inputs."); - for(unsigned int j = 0; j < mat.get_cols(); j++) - { - data_type_vector _result = 0; - for(unsigned int i = 0; i < mat.get_rows(); i++) - { - _result += (vec.at(i)*mat.at(i, j)); - } - result.set(j, _result); - } - } - - template - void multiply(const Matrix& mat1, - const Matrix& mat2, - Matrix& result) - { - adaboost::utils::check(mat1.get_cols() == mat2.get_rows(), - "Order of matrices don't match."); - unsigned int common_cols = mat1.get_cols(); - for(unsigned int i = 0; i < result.get_rows(); i++) - { - for(unsigned int j = 0; j < result.get_cols(); j++) - { - data_type_matrix _result = 0; - for(unsigned int k = 0; k < common_cols; k++) - { - _result += (mat1.at(i, k)*mat2.at(k, j)); - } - result.set(i, j, _result); - } - } - } - - template - void product(const Vector& vec1, - const Vector& vec2, - data_type_vector& result) - { - adaboost::utils::check(vec1.get_size() == vec2.get_size(), - "Size of vectors don't match."); - result = 0; - for(unsigned int i = 0; i < vec1.get_size(); i++) - { - result += (vec1.at(i)*vec2.at(i)); - } - } - + } + - #include "instantiated_templates_operations.hpp" + #include "instantiated_templates_operations.hpp" } // namespace core } // namespace adaboost diff --git a/adaboost/cuda/cuda_data_structures.hpp b/adaboost/cuda/cuda_data_structures.hpp index cf2baa9..f893efd 100644 --- a/adaboost/cuda/cuda_data_structures.hpp +++ b/adaboost/cuda/cuda_data_structures.hpp @@ -91,18 +91,7 @@ namespace adaboost ~VectorGPU(); }; - /* - * This function computes - * dot product of two vectors on - * GPU. - */ - - template - void product_gpu(const VectorGPU& vec1, - const VectorGPU& vec2, - data_type_vector& result, - unsigned block_size=0); - /* + /* * This class represents GPU version of adaboost::core::Matrix. * * @tparam data_type_matrix Data type of the elements @@ -161,11 +150,7 @@ namespace adaboost ~MatrixGPU(); }; - template - void multiply_gpu(const MatrixGPU& mat1, - const MatrixGPU& mat2, - MatrixGPU& result); - + } // namespace core } // namespace cuda } // namespace adaboost diff --git a/adaboost/cuda/cuda_data_structures_impl.hpp b/adaboost/cuda/cuda_data_structures_impl.hpp index 6b3a651..5f9fc10 100644 --- a/adaboost/cuda/cuda_data_structures_impl.hpp +++ b/adaboost/cuda/cuda_data_structures_impl.hpp @@ -104,72 +104,6 @@ namespace adaboost adaboost::utils::cuda::cuda_free(this->data_gpu); } - template - __global__ - void product_kernel - (data_type_vector* v1, data_type_vector* v2, data_type_vector* v3, - unsigned size) - { - __shared__ data_type_vector cache[MAX_BLOCK_SIZE]; - data_type_vector temp = 0; - unsigned thread_i = threadIdx.x + blockDim.x*blockIdx.x; - unsigned cache_i = threadIdx.x; - while(thread_i < size) - { - temp += v1[thread_i]*v2[thread_i]; - thread_i = blockDim.x*gridDim.x; - } - cache[cache_i] = temp; - __syncthreads(); - - unsigned i = blockDim.x/2; - while(i != 0) - { - if(cache_i < i) - { - cache[cache_i] += cache[cache_i + i]; - } - __syncthreads(); - i /= 2; - } - - if(cache_i == 0) - v3[blockIdx.x] = cache[0]; - } - - template - void product_gpu(const VectorGPU& vec1, - const VectorGPU& vec2, - data_type_vector& result, - unsigned block_size) - { - if(block_size == 0) - { - return adaboost::core::product(vec1, vec2, result); - } - else - { - adaboost::utils::check(vec1.get_size() == vec2.get_size(), - "Size of vectors don't match."); - adaboost::utils::check(block_size > 0, - "Size of the block should be a positive multiple of 32."); - unsigned num_blocks = (vec1.get_size() + block_size - 1)/block_size; - VectorGPU temp_result(num_blocks); - product_kernel - <<< - num_blocks, - block_size - >>>(vec1.get_data_pointer(), vec2.get_data_pointer(), - temp_result.get_data_pointer(), vec1.get_size()); - temp_result.copy_to_host(); - result = 0; - for(unsigned i = 0; i < num_blocks; i++) - { - result += temp_result.at(i); - } - } - } - template data_type_matrix* MatrixGPU:: @@ -278,48 +212,7 @@ namespace adaboost adaboost::utils::cuda::cuda_free(this->data_gpu); } - template - __global__ - void multiply_kernel( - data_type_matrix* mat1, - data_type_matrix* mat2, - data_type_matrix* result, - unsigned mat1_rows, - unsigned mat1_cols, - unsigned mat2_rows, - unsigned mat2_cols) - { - data_type_matrix cvalue = 0.0; - unsigned row = blockIdx.y*blockDim.y + threadIdx.y; - unsigned col = blockIdx.x*blockDim.x + threadIdx.x; - if(row > mat1_rows || col > mat2_cols) - return ; - for(unsigned e = 0; e < mat1_cols; e++) - cvalue += mat1[row*mat1_cols+e] * mat2[e*mat2_cols+col]; - result[row*mat2_cols+col] = cvalue; - } - - template - void multiply_gpu(const MatrixGPU& mat1, - const MatrixGPU& mat2, - MatrixGPU& result) - { - adaboost::utils::check(mat1.get_cols() == mat2.get_rows(), - "Order of matrices don't match."); - dim3 gridDim((mat2.get_cols() + BLOCK_SIZE - 1)/BLOCK_SIZE, - (mat1.get_rows() + BLOCK_SIZE - 1)/BLOCK_SIZE); - dim3 blockDim(BLOCK_SIZE, BLOCK_SIZE); - multiply_kernel - <<>> - (mat1.get_data_pointer(), - mat2.get_data_pointer(), - result.get_data_pointer(), - mat1.get_rows(), - mat1.get_cols(), - mat2.get_rows(), - mat2.get_cols()); - } - + #include "instantiated_templates_cuda_data_structures.hpp" } // namespace core From b09423ff7e9cacd6540bb9bbfe319c6854c978cc Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Sat, 4 Apr 2020 02:35:33 +0530 Subject: [PATCH 24/25] Update operations.hpp --- adaboost/core/operations.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adaboost/core/operations.hpp b/adaboost/core/operations.hpp index 92037e9..f7db30d 100644 --- a/adaboost/core/operations.hpp +++ b/adaboost/core/operations.hpp @@ -30,7 +30,7 @@ namespace adaboost const Vector& vec2, data_type_vector& result); - /* + /*@overload * Used for filling the vector with a given value. * If block size is passed 0 then the values are * filled on the CPU otherwise they are filled on @@ -95,7 +95,7 @@ namespace adaboost const Matrix& mat, Vector& result); - /* + /*@overload * Used for filling the matrix with a given value. * If block size x and block size y is passed 0 and 0 then the values are * filled on the CPU otherwise they are filled on From 204e8ab5b08a9b30a6bfda21da8c649d57fd441c Mon Sep 17 00:00:00 2001 From: Monika Jha <55924540+bits2zbytes@users.noreply.github.com> Date: Sat, 4 Apr 2020 03:12:27 +0530 Subject: [PATCH 25/25] Minor modifications --- adaboost/core/operations_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adaboost/core/operations_impl.cpp b/adaboost/core/operations_impl.cpp index cd5a96f..fc52906 100644 --- a/adaboost/core/operations_impl.cpp +++ b/adaboost/core/operations_impl.cpp @@ -54,7 +54,7 @@ namespace adaboost const VectorGPU& vec){ if(block_size == 0) { - this->adaboost::core::Vector::fill(value); + adaboost::core::fill(value, vec); } else { @@ -204,7 +204,7 @@ namespace adaboost unsigned block_size_y=0){ if(block_size_x == 0 || block_size_y == 0) { - this->adaboost::core::Matrix::fill(value); + adaboost::core::fill(value, mat); } else {