<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">For linear sparse system, we have been using Eigen (using OPENBLAS, CHOLMOD) in the ITK context, here:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span><a href="https://github.com/MiguelAlgaba/itkEigenSolverTraits" class="">https://github.com/MiguelAlgaba/itkEigenSolverTraits</a></div><div class=""><br class=""></div><div class="">Best</div><div class="">Arnaud</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 12 Mar 2015, at 15:41, Matt McCormick <<a href="mailto:matt.mccormick@kitware.com" class="">matt.mccormick@kitware.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Hi,<br class=""><br class="">From the discussion so far, it appears the following serious of steps<br class="">could be taken to move forward on performance:<br class=""><br class="">1) Replace vnl_vector and vnl_matrix with vnl_vector_fixed and<br class="">vnl_matrix_fixed when possible.<br class=""><br class="">2) Add Jian Cheng's BLAS and LAPACK backends for vnl_vector and vnl_matrix.<br class=""><br class="">3) Add support for armadillo or eigen.<br class=""><br class="">1) and 2) will be relatively easy to make, and will hopefully have an<br class="">immediate impact on performance.  3) will take make work to happen,<br class="">and it will take longer to impact the toolkit.  We will need to have<br class="">cross-platform builds of the libraries in the repository.  Also, many<br class="">ITK classes encapsulate their use of VNL very poorly, so it will not<br class="">be as simple as swapping out or improving their backends.<br class=""><br class="">2 cents,<br class="">Matt<br class=""><br class="">On Thu, Mar 12, 2015 at 10:20 AM, Bradley Lowekamp<br class=""><<a href="mailto:blowekamp@mail.nih.gov" class="">blowekamp@mail.nih.gov</a>> wrote:<br class=""><blockquote type="cite" class="">Chuck,<br class=""><br class="">Thank you for giving us that important conclusion, under a quite difficult<br class="">situations.<br class=""><br class="">I wonder if there is any distinction in the usage of vnl_matrix vs<br class="">vnl_matrix_fixed. I would expect that operations done for pixel transforms<br class="">should have there dimension know at run-time and should be able to use the<br class="">vnl_matrix_fixed.<br class=""><br class="">I also have considered methods to transform a whole array of points at a<br class="">time. I wonder if for 3x3*3*256 sized operations ( scan-line size ) if there<br class="">would be benefit with the library based operations.<br class=""><br class="">Brad<br class=""><br class=""><br class="">On Mar 12, 2015, at 10:02 AM, Chuck Atkins <<a href="mailto:chuck.atkins@kitware.com" class="">chuck.atkins@kitware.com</a>> wrote:<br class=""><br class="">I worked with Julie Langou, maintainer of LAPACK, on this project a few<br class="">years ago.  The funding situation ended up very strange and messy and we<br class="">basically had to cram 3 months worth of effort into 3 weeks, so needless to<br class="">say, we were not able to really achieve our goals.  However, we spent a fair<br class="">amount of time profiling ITK and analyzing it's hot spots from vnl to<br class="">determine where to best spend the small ammount of time we had.  The results<br class="">were not as straight forward as we expected.  It turns out that most of the<br class="">use for vnl_matrix and vnl_vector was actually for an enourmous number of<br class="">operations on very small sized vectors and matricies (dimensions of 2, 3, or<br class="">4), often for coordinate and geometry calculations or for small per-pixel<br class="">operations that were not easily vectorized in the implementation at the<br class="">time.  In these cases, the overhead of calling out to a BLAS or LAPACK<br class="">library was much too expensive and the existing use of VNL was far more<br class="">optimal.  This falls apart, however when trying to use vnl for more complex<br class="">algorithms since the larger matrix operations will be where the benefit can<br class="">be seen.  So just re-implementing the vnl vector and matrix classes and<br class="">operators with underlying BLAS and LAPACK routines turned out to not be the<br class="">best solution for ITK as a whole.<br class=""><br class="">- Chuck<br class=""><br class="">On Thu, Mar 12, 2015 at 8:32 AM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov" class="">blowekamp@mail.nih.gov</a>><br class="">wrote:<br class=""><blockquote type="cite" class=""><br class="">Hello,<br class=""><br class="">If I was writing my own ITK classes, and needed a fast matrix library I<br class="">would likely pursue an additional dependency on an efficient numeric library<br class="">for that project, such as eigen.<br class=""><br class="">However for the broad appeal of ITK I would think a flexible back end<br class="">would be best. As I think there are a variety of BLAS and LAPACK libraries<br class="">available ( commercial, open source, vender free ). It would be nice to pick<br class="">one what has been optimized for the current architecture. I would think it<br class="">would be most flexible to use this interface in the back end of a chosen<br class="">numeric interface ( currently VNL ). Unfortunately, I don't have as much<br class="">experience with these libraries as I'd like.<br class=""><br class="">Brad<br class=""><br class="">On Mar 12, 2015, at 5:15 AM, <a href="mailto:m.staring@lumc.nl" class="">m.staring@lumc.nl</a> wrote:<br class=""><br class=""><blockquote type="cite" class="">Hi,<br class=""><br class="">I think the eigen library is a mature and very fast library for these<br class="">kind of things:<br class=""><a href="http://eigen.tuxfamily.org/index.php?title=Main_Page" class="">http://eigen.tuxfamily.org/index.php?title=Main_Page</a><br class=""><br class="">You may want to check it out, to see if it offers what you need.<br class=""><br class="">It would be great to be able to use these within the itk.<br class=""><br class="">2c<br class="">Marius<br class=""><br class="">-----Original Message-----<br class="">From: Insight-developers [mailto:insight-developers-bounces@itk.org] On<br class="">Behalf Of Jian Cheng<br class="">Sent: Wednesday, March 11, 2015 23:17<br class="">To: Matt McCormick<br class="">Cc: Chuck Atkins; ITK<br class="">Subject: Re: [ITK-dev] efficiency of vnl_matrix<br class=""><br class="">Hi Matt,<br class=""><br class="">Thanks for your help, and also for the ITK workshop in UNC last time.<br class=""><br class="">It is very unfortunate. The efficiency of these numerical math operators<br class="">are very important for many applications.<br class=""><br class="">I recently released an ITK based toolbox, called dmritool, for diffusion<br class="">MRI data processing.<br class="">It has some files to add some supports of blas, lapack, mkl to<br class="">vnl_matrix and vnl_vector.<br class=""><br class="">http://diffusionmritool.github.io/dmritool_doxygen/utlBlas_8h_source.html<br class=""><br class="">http://diffusionmritool.github.io/dmritool_doxygen/utlVNLBlas_8h_source.html<br class=""><br class="">Those functions are not internally for vnl_matrix class. They are<br class="">operators for the data pointer stored in vnl_matrix object.<br class="">Thus, later I made a N-dimensional array library which internally<br class="">includes those functions, and also supports expression template to avoid<br class="">temporary copies.<br class=""><br class="">http://diffusionmritool.github.io/dmritool_doxygen/utlMatrix_8h_source.html<br class=""><br class="">http://diffusionmritool.github.io/dmritool_doxygen/utlVector_8h_source.html<br class=""><br class="">The efficiency comparison between vnl_vector/vnl_matrix and the<br class="">vector/matrix using openblas, lapack, or mkl can be found by running those<br class="">two tests<br class="">https://github.com/DiffusionMRITool/dmritool/blob/master/Modules/HelperFunctions/test/utlVNLBlasGTest.cxx<br class=""><br class="">https://github.com/DiffusionMRITool/dmritool/blob/master/Modules/HelperFunctions/test/utlVNLLapackGTest.cxx<br class=""><br class="">Maybe some codes can be used as patches in somewhere in ITK. I am not<br class="">sure. Maybe we need more discussion on it.<br class="">With your help and discussion, I will be very glad to make my first<br class="">patch to ITK.<br class="">Thanks.<br class=""><br class="">best,<br class="">Jian Cheng<br class=""><br class=""><br class="">On 03/11/2015 04:39 PM, Matt McCormick wrote:<br class=""><blockquote type="cite" class="">Hi Jian,<br class=""><br class="">Yes, it would be wonderful to improve the efficiency of these basic<br class="">numerical operations.<br class=""><br class="">Funding for the Refactor Numerical Libraries has currently ended, and<br class="">the effort is currently frozen.  However, you are more than welcome to<br class="">pick it up and we can help you get it into ITK.  More information on<br class="">the patch submission process can be found here [1] and in the ITK<br class="">Software Guide.<br class=""><br class="">Thanks,<br class="">Matt<br class=""><br class="">[1]<br class="">https://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySo<br class="">ftwareProcess/SubmitAPatchToGerrit/index.html<br class=""><br class="">On Wed, Mar 11, 2015 at 4:07 PM, Jian Cheng <jian.cheng.1983@gmail.com><br class="">wrote:<br class=""><blockquote type="cite" class="">Hi,<br class=""><br class="">My task using ITK has intensive matrix-matrix product, pseudo-inverse,<br class="">etc.<br class="">Thus the performance is actually mainly determined by the matrix<br class="">library I used.<br class="">Firstly I use vnl_matrix and vnl_vector in ITK. Then I found it is<br class="">very inefficient because vnl matrix lib does not use blas and lapack.<br class="">After I wrote my own matrix class which uses openblas and lapack, I<br class="">got a hug gain of performance.<br class=""><br class="">I found there is a proposal to improve the efficiency of numerical<br class="">libraries in ITK.<br class="">http://www.itk.org/Wiki/ITK/Release_4/Refactor_Numerical_Libraries<br class="">I am not sure how is the progress of the proposal.<br class="">I wonder when the vnl matrix lib can internally support blas and<br class="">lapack, or mkl, so that we can just use it without lose of the<br class="">efficiency.<br class="">Thanks.<br class=""><br class="">best,<br class="">Jian Cheng<br class="">_______________________________________________<br class="">Powered by www.kitware.com<br class=""><br class="">Visit other Kitware open-source projects at<br class="">http://www.kitware.com/opensource/opensource.html<br class=""><br class="">Kitware offers ITK Training Courses, for more information visit:<br class="">http://kitware.com/products/protraining.php<br class=""><br class="">Please keep messages on-topic and check the ITK FAQ at:<br class="">http://www.itk.org/Wiki/ITK_FAQ<br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class="">http://public.kitware.com/mailman/listinfo/insight-developers<br class=""></blockquote></blockquote><br class="">_______________________________________________<br class="">Powered by www.kitware.com<br class=""><br class="">Visit other Kitware open-source projects at<br class="">http://www.kitware.com/opensource/opensource.html<br class=""><br class="">Kitware offers ITK Training Courses, for more information visit:<br class="">http://kitware.com/products/protraining.php<br class=""><br class="">Please keep messages on-topic and check the ITK FAQ at:<br class="">http://www.itk.org/Wiki/ITK_FAQ<br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class="">http://public.kitware.com/mailman/listinfo/insight-developers<br class="">_______________________________________________<br class="">Powered by www.kitware.com<br class=""><br class="">Visit other Kitware open-source projects at<br class="">http://www.kitware.com/opensource/opensource.html<br class=""><br class="">Kitware offers ITK Training Courses, for more information visit:<br class="">http://kitware.com/products/protraining.php<br class=""><br class="">Please keep messages on-topic and check the ITK FAQ at:<br class="">http://www.itk.org/Wiki/ITK_FAQ<br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class="">http://public.kitware.com/mailman/listinfo/insight-developers<br class=""></blockquote><br class=""></blockquote><br class=""><br class=""></blockquote>_______________________________________________<br class="">Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a><br class=""><br class="">Visit other Kitware open-source projects at<br class=""><a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a><br class=""><br class="">Kitware offers ITK Training Courses, for more information visit:<br class="">http://kitware.com/products/protraining.php<br class=""><br class="">Please keep messages on-topic and check the ITK FAQ at:<br class="">http://www.itk.org/Wiki/ITK_FAQ<br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class="">http://public.kitware.com/mailman/listinfo/insight-developers<br class=""></div></blockquote></div><br class=""></div></body></html>