Re: [ViennaCL-devel] How to do matrix concatenation and matrix column multiplication fast

2013-12-12 Thread Karl Rupp
Hi Albert,

  I thought that a good way to get good performance is to formulate all
 the calculations somehow vectorized but I'm not sure if I have chosen
 the best way because the code performs badly. The matrices are big,
 about 10k \times 10k in size.

This is correct, provided that the vectorization is not carried out via 
adding a lot of operations by zeros.


 My code is below. Maybe you can give me some suggestions about how to
 do that fast. Basically, in `mat_column_mult`, I want to multiply a
 certain column of a matrix. Currently, I multiply with 0, maybe that
 is a special case where I can do even faster. In
 `layerActivity_addBiasTerm`, I want to add a left scalar column to a
 matrix.

The issue in the code are the matrix-matrix multiplications, even though 
you only want to scale columns. For such cases you can use the new 
column() function to extract a column from a matrix and scale that. 
In-place operations are supposed to work, so you can directly write
   viennacl::column(A, 7) *= factor;
Have a look here:
https://github.com/viennacl/viennacl-dev/blob/master/tests/src/matrix_vector.cpp#L235
on how to use it. As with most functionality in ViennaCL, it's basically 
the same as in Boost.uBlas. For this to compile, however, you need to 
use the developer version from GitHub 
(https://github.com/viennacl/viennacl-dev) or wait a few more days until 
the 1.5.0 release is finally out. :-)

Best regards,
Karli


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel


Re: [ViennaCL-devel] How to do matrix concatenation and matrix column multiplication fast

2013-12-12 Thread Karl Rupp
Hi,

  Thanks for the hints! Right as you were writing, I have implemented
 now a solution via matrix_range which already performs really well. I
 guess there wouldn't be any difference in performance between
 viennacl::column and some matrix_range solution, right?

viennacl::column() might be faster for large matrices because of the way 
threads are assigned. I guess that most of your execution time is spent 
elsewhere, so it's probably not worth optimizing further...

Best regards,
Karli


 On Thu, Dec 12, 2013 at 2:49 PM, Karl Rupp r...@iue.tuwien.ac.at wrote:
 Hi Albert,


 I thought that a good way to get good performance is to formulate all

 the calculations somehow vectorized but I'm not sure if I have chosen
 the best way because the code performs badly. The matrices are big,
 about 10k \times 10k in size.


 This is correct, provided that the vectorization is not carried out via
 adding a lot of operations by zeros.



 My code is below. Maybe you can give me some suggestions about how to
 do that fast. Basically, in `mat_column_mult`, I want to multiply a
 certain column of a matrix. Currently, I multiply with 0, maybe that
 is a special case where I can do even faster. In
 `layerActivity_addBiasTerm`, I want to add a left scalar column to a
 matrix.


 The issue in the code are the matrix-matrix multiplications, even though you
 only want to scale columns. For such cases you can use the new column()
 function to extract a column from a matrix and scale that. In-place
 operations are supposed to work, so you can directly write
viennacl::column(A, 7) *= factor;
 Have a look here:
 https://github.com/viennacl/viennacl-dev/blob/master/tests/src/matrix_vector.cpp#L235
 on how to use it. As with most functionality in ViennaCL, it's basically the
 same as in Boost.uBlas. For this to compile, however, you need to use the
 developer version from GitHub (https://github.com/viennacl/viennacl-dev) or
 wait a few more days until the 1.5.0 release is finally out. :-)

 Best regards,
 Karli



--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel