[Insight-users] Error in vnl_sse template specializations (and fix)

Luis Ibanez luis.ibanez at kitware.com
Sat May 21 15:25:14 EDT 2011


Hi Shashwath

1) How recent is your checkout of ITK ?

2) Did you purposely enabled any SSE options,
     when configuring with CMake ?

3) Here are the SSE related flag in my working
    build of ITK on Linux:

CMakeCache.txt:VNL_CONFIG_ENABLE_SSE2:BOOL=OFF
CMakeCache.txt:VNL_CONFIG_ENABLE_SSE2_ROUNDING:BOOL=ON
CMakeCache.txt://Have include HAVE_ASSERT_H
CMakeCache.txt:HAVE_ASSERT_H:INTERNAL=1
CMakeCache.txt://Test ITK_COMPILER_DOES_NOT_NEED_MSSE2_FLAG
CMakeCache.txt:ITK_COMPILER_DOES_NOT_NEED_MSSE2_FLAG:INTERNAL=1
CMakeCache.txt://Test ITK_COMPILER_SUPPORTS_SSE2_32
CMakeCache.txt:ITK_COMPILER_SUPPORTS_SSE2_32:INTERNAL=1
CMakeCache.txt://Test ITK_COMPILER_SUPPORTS_SSE2_64
CMakeCache.txt:ITK_COMPILER_SUPPORTS_SSE2_64:INTERNAL=1
CMakeCache.txt:VCL_CXX_HAS_HEADER_CASSERT:INTERNAL=1
CMakeCache.txt://ADVANCED property for variable: VNL_CONFIG_ENABLE_SSE2
CMakeCache.txt:VNL_CONFIG_ENABLE_SSE2-ADVANCED:INTERNAL=1
CMakeCache.txt://ADVANCED property for variable: VNL_CONFIG_ENABLE_SSE2_ROUNDING
CMakeCache.txt:VNL_CONFIG_ENABLE_SSE2_ROUNDING-ADVANCED:INTERNAL=1
CMakeCache.txt:VXL_HAS_SSE2_HARDWARE_SUPPORT:INTERNAL=1
CMakeCache.txt:VXL_HAS_SSE2_HARDWARE_SUPPORT_COMPILED:INTERNAL=TRUE



      Luis


--------------------------------------
On Tue, May 17, 2011 at 4:28 AM, Shashwath T.R. <trshash at gmail.com> wrote:
> Hi all,
>
> While compiling ITK master, I ran into this error:
>
> 1>D:\itk\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl/vnl_c_vector.txx(261) :
> error C2039: 'arg_max' : is not a member of 'vnl_sse<double>'
> 1>        D:\itk\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl/vnl_sse.h(261)
> : see declaration of 'vnl_sse<double>'
> 1>
> D:\itk\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl/vnl_c_vector.txx(259) :
> while compiling class template member function 'unsigned int
> vnl_c_vector<T>::arg_max(const T *,unsigned int)'
> 1>        with
> 1>        [
> 1>            T=double
> 1>        ]
> 1>
> ..\..\..\..\..\..\..\..\ITK\Modules\ThirdParty\VNL\src\vxl\core\vnl\Templates\vnl_c_vector+double-.cxx(3)
> : see reference to class template instantiation 'vnl_c_vector<T>' being
> compiled
> 1>        with
> 1>        [
> 1>            T=double
> 1>        ]
>
> Apparently, vnl_sse<float> and vnl_sse<double> are missing the methods
> arg_min and arg_max. Adding them proved to be very simple - I simply copied
> over the generic implementation and specialized it. I'm attaching my patch
> below.
>
> Could someone take a look and see if this is OK?
>
> Regards,
> Shash
>
> diff --git a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h
> b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h
> index 5af0f7c..94138a5 100644
> -- a/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h
> ++ b/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_sse.h
> @@ -543,6 +543,27 @@ class vnl_sse<double>
>     _mm_store_sd(&ret,min);
>     return ret;
>   }
>  static VNL_SSE_FORCE_INLINE unsigned arg_max(const double* v, unsigned n)
>  {
>    if (n==0) return unsigned(-1); // the maximum of an empty set is
> undefined
>    double tmp = *v;
>    unsigned idx = 0;
>    for (unsigned i=1; i<n; ++i)
>      if (*++v > tmp)
>        tmp = *v, idx = i;
>    return idx;
>  }
>
>  static VNL_SSE_FORCE_INLINE unsigned arg_min(const double* v, unsigned n)
>  {
>    if (n==0) return unsigned(-1); // the minimum of an empty set is
> undefined
>    double tmp = *v;
>    unsigned idx = 0;
>    for (unsigned i=1; i<n; ++i)
>      if (*++v < tmp)
>        tmp = *v, idx = i;
>    return idx;
>  }
> };
>
> //: SSE2 implementation for single precision floating point (32 bit)
> @@ -880,6 +901,27 @@ class vnl_sse<float>
>
>     return ret;
>   }
> static VNL_SSE_FORCE_INLINE unsigned arg_max(const float* v, unsigned n)
>  {
>    if (n==0) return unsigned(-1); // the maximum of an empty set is
> undefined
>    float tmp = *v;
>    unsigned idx = 0;
>    for (unsigned i=1; i<n; ++i)
>      if (*++v > tmp)
>        tmp = *v, idx = i;
>    return idx;
>  }
>
>  static VNL_SSE_FORCE_INLINE unsigned arg_min(const float* v, unsigned n)
>  {
>    if (n==0) return unsigned(-1); // the minimum of an empty set is
> undefined
>    float tmp = *v;
>    unsigned idx = 0;
>    for (unsigned i=1; i<n; ++i)
>      if (*++v < tmp)
>        tmp = *v, idx = i;
>    return idx;
>  }
> };
>
> #endif // VNL_CONFIG_ENABLE_SSE2
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list