Conversation
Added #ifdef HAS_CUDA for gpu codes.
CHECK_EQ(inputs.size(), 1) << "sigmoid forward #inputs wrong"; | ||
CHECK_EQ(outputs.size(), 1) << "sigmoid forward #outputs wrong"; | ||
|
||
float * input_data = inputs[0].data(); |
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.
Better be float* data
.
Thanks for contributing to the feature for building on CPU only. We currently don't have support for convolution operators on CPU, but that, of course, is something we want in the future. Although performance on CPU only machines might be poor, but we can still offer our easy-to-use interface. As to contributing C++ code, please comply by Google C++ Style Guide standard for easy maintenance and readability, especially the formatting part. I have put some comment on the files for your reference. I fully acknowledge the pain to follow someone else's rules. But we will benefit from a uniform coding convention at last. For the unit tests, I think it's better not to put macros in them to cater to CPU or GPU instances. It would be better to create unit tests for CPU and GPU operators, and use macros to stop the GPU tests from compiling if the machine does not have CUDA. Thanks for your effort! |
@@ -9,7 +9,9 @@ TEST(LeftConst, LeftConst) { | |||
int m = 8; | |||
int k = 100; | |||
NArray a = NArray::Randn({m, k}, 0.0, 1.0); | |||
#ifdef HAS_CUDA |
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.
Could we do something like in unittest_elewise.cpp
to create separate tests, and disable GPU ones using the macro HAS_CUDA
?
Thank you for the suggestion. I will fix the coding style and unittest issue. I plan to support convolution operators on CPU by CPU BLAS functions. |
@hotpxl , |
Should we have a "OpenBLAS" implementation, instead of reusing the "basic"? On Mon, Dec 22, 2014 at 2:33 AM, Zhang Xianyi notifications@github.com
HONG Chuntao |
If you don't want basic depending other library, including OpenBLAS. I can 2014-12-22 10:03 GMT+08:00 hjk41 notifications@github.com:
|
Let's use hand-written functions for "basic" and create an "OpenBLAS" implementation. |
Thanks! |
Now, the minerva can build on CPU only.
I added SigmoidForward, ReluForward, and TanhForward CPU basic implementation.
For apps, the minst_mlp works fine.
To-do: