-
Notifications
You must be signed in to change notification settings - Fork 94
Kmeans|| #650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
trivialfis
wants to merge
49
commits into
master
Choose a base branch
from
kmeansll
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Kmeans|| #650
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
626bad5
Fix building.
trivialfis a7cf462
Enable building tests with cmake and make swig optional.
trivialfis c39c1bb
Enable specifying CUDA compute capability.
trivialfis e28cd4b
[WIP, KMeans||] skeleton for the algorithm.
trivialfis 1cdb79b
Basic for KmMatrix and KMeans.
trivialfis 42e0341
[KmMatrix] Split up proxy, add tests, and fixes.
trivialfis 79529c6
More tests and fixes for KmMatrix.
trivialfis 3b19006
Fix KmMatrix initialization with size.
trivialfis b58d868
Add helper tools for GPU.
trivialfis 6f771b8
cuBlas wrapper file. Only two functions are added.
trivialfis c901a7f
Factor out config code, cublas_handle, add MatrixDim.
trivialfis 1db8282
Rename class member variables for CudaKmMatrix.
trivialfis 27b399f
Add stack for KmMatrix, fix impl ownership bug.
trivialfis 70d0a10
Add license.
trivialfis 8f65ea5
Construct kmeans|| based on KmMatrix.
trivialfis b7e7446
Fix prob for kmeans||.
trivialfis d507259
Fix K-Means|| along with added documents.
trivialfis 7a79169
Create Generatorbase and refactor code.
trivialfis 8c21e8e
Rename shared memory structs, add license.
trivialfis 458e54e
Fix handles_ memory leak.
trivialfis d3b18df
Add argmin op. Fix min op for redundant memory access.
trivialfis 9d5a094
Add centroids weighting.
trivialfis 27a5ec1
Add simple re-clustering.
trivialfis 09635e0
Factor out basic arith ops, add tests for them.
trivialfis 62694bf
Pass all tests for arith.
trivialfis ec61974
Add tests for distance_pairs.
trivialfis c5d8bfe
Pass pairwise distance test.
trivialfis 940d20e
Add test for GreedyRecluster.
trivialfis 2e47f71
Fix zero distance prob, and re-cluster with large centroids.
trivialfis b45825a
Extract Arith operation definitions to cuda file.
trivialfis c579d26
Improve printing matrix.
trivialfis ca412a4
Finish test for kmeans||.
trivialfis fcfeaf3
Remove warning message.
trivialfis ad18cbb
Remove Eigen require.
trivialfis d358c82
Fix compiler warnings.
trivialfis 1b2b346
Add rows functions for KmMatrix.
trivialfis b1b2d51
Add SizeError.
trivialfis 93ae39b
Add int generator, reshape for KmMatrix.
trivialfis c95c9ba
Add random kmeans init class.
trivialfis 07c6c3e
Revert format change for kmeans_h2o4gpu.cu.
trivialfis adb6ffa
Revert warning flag
trivialfis 450051e
Inject new kmeans|| into kmeans algorithm.
trivialfis 6c8ff4e
Re-structure.
trivialfis 9afa105
Add config for USE_CUDA.
trivialfis bf9e479
Fix doc for KmeansLlInit.
trivialfis 10d8ac6
Remove SelfMinOp.
trivialfis 7efaf03
Use cub function for calculating min.
trivialfis 7468a0b
Use thrust to generate random numbers.
trivialfis f297074
Rename Generator to RandomGenerator.
trivialfis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/utils.h.in ${CMAKE_CURRENT_SOURCE_DIR}/utils.h) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*! | ||
* Copyright 2017-2018 H2O.ai, Inc. | ||
* License Apache License Version 2.0 (see LICENSE for details) | ||
*/ | ||
#pragma once | ||
#include <vector> | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
|
||
#include "cblas/cblas.h" | ||
|
||
#define USE_CUDA() @HG_USE_CUDA@ | ||
|
||
template<typename T> | ||
void self_dot(std::vector<T> array_in, int n, int dim, | ||
std::vector<T>& dots); | ||
|
||
void compute_distances(std::vector<double> data_in, | ||
std::vector<double> centroids_in, | ||
std::vector<double> &pairwise_distances, | ||
int n, int dim, int k); | ||
|
||
void compute_distances(std::vector<float> data_in, | ||
std::vector<float> centroids_in, | ||
std::vector<float> &pairwise_distances, | ||
int n, int dim, int k); | ||
|
||
// Matrix host dev | ||
#define HG_HOSTDEV __host__ __device__ | ||
#define HG_DEV __device__ | ||
#define HG_DEVINLINE __device__ __forceinline__ | ||
#define HG_HOSTDEVINLINE __host__ __device__ __forceinline__ | ||
|
||
#define h2o4gpu_error(x) error(x, __FILE__, __LINE__); | ||
|
||
inline void error(const char* e, const char* file, int line) | ||
{ | ||
std::stringstream ss; | ||
ss << e << " - " << file << "(" << line << ")"; | ||
//throw error_text; | ||
std::cerr << ss.str() << std::endl; | ||
exit(-1); | ||
} | ||
|
||
#define h2o4gpu_check(condition, msg) check(condition, msg, __FILE__, __LINE__); | ||
|
||
inline void check(bool val, const char* e, const char* file, int line) | ||
{ | ||
if (!val) | ||
{ | ||
error(e, file, line); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a strange file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the original utils.h from h2o4gpu with some functions moved from gpu code.
For the *.h.in, it's for cmake configuration, specifically USE_CUDA flag. I know compiling without CUDA is not supported. But anyway I tried to remain the possibility. If that a burden, I can remove it in no time.