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
Linalg Refactor - CPU dot #3230
Linalg Refactor - CPU dot #3230
Conversation
Cool!
@lambday should also comment |
struct CPU_Vector : public BaseVector<T> | ||
{ | ||
//<SGVector<T>>* CPUptr; | ||
SGVector<T> vec; |
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.
can we just hold a reference to the SGVector instead instead? We won't be passing this CPUVector around via any API (apart from linalg API which is internal), so an extra refcount is not really needed I think.
Alright this looks okay! Needs some more polishing. Apart from what @karlnapf already mentioned,
|
@vigsterkr @lambday There're many ways to put But on a second thought I don't think my current implementation is interchangeable.. |
@OXPHOS please put one class per file. So there will be
When you split things like that, it would be easier to refactor things with opaque ptrs. |
@lambday please check. thx! |
#include <shogun/lib/config.h> | ||
#include <shogun/lib/SGVector.h> | ||
|
||
#ifndef _BASEVECTOR_H__ |
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.
get rid of the leading _
. those are reserved for system headers. We should just use BASEVECTOR_H__
@lambday dunno why it's failing some tests..also this doesn't seem to be thread safe? |
*/ | ||
T compute(GPU_Vector<T> a, GPU_Vector<T> b) | ||
{ | ||
return viennacl::linalg::inner_prod(*(a.GPUptr), *(b.GPUptr)); |
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.
What is this GPUptr? It's not declared or defined in GPU_Vector class.
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.
Shouldn't it be working with the VCLMemoryArray shared ptr thing that it has?
|
||
CPUVector(const CPUVector<T> &vector); | ||
|
||
bool onGPU() { return false; } |
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.
inline bool onGPU() const
{
return false;
}
|
Hi @OXPHOS
|
@lambday both done. |
@@ -37,6 +38,7 @@ namespace shogun | |||
Version* sg_version=NULL; | |||
CMath* sg_math=NULL; | |||
CRandom* sg_rand=NULL; | |||
std::unique_ptr<SGLinalg> sg_linalg(nullptr); |
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.
can you please try using shogun's Unique here? if that works then we won't need c++11 guard around all these
* | ||
* @param linalg linalg object to use | ||
*/ | ||
void set_global_linlg(SGLinalg* linalg); |
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.
Is it defined somewhere? I see definition of get_global_linalg() in the cpp but not this one.
Also, maybe this is not needed. Just remove this for now :)
@OXPHOS really nice job with this :) Let me merge this for now. Travis fails seem unrelated, Plus this is a feature branch. Check my minor comments. Maybe you can send a patch for those one later. |
@lambday @vigsterkr @karlnapf