Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64842 - in sandbox/odeint/branches/karsten: boost/numeric/odeint/algebra boost/numeric/odeint/algebra/detail boost/numeric/odeint/algebra/external boost/numeric/odeint/stepper libs/numeric/odeint/test libs/numeric/odeint/test/thrust
From: mario.mulansky_at_[hidden]
Date: 2010-08-16 08:18:52


Author: mariomulansky
Date: 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
New Revision: 64842
URL: http://svn.boost.org/trac/boost/changeset/64842

Log:
add some conditional compiler statements to get it working with nvcc again
on a first glance, nvcc seems not to be able to compile boost::type_traits so it doesn't work with boost::range or boost::ublas either
Added:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/ublas_resize.hpp (contents, props changed)
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/detail/macros.hpp | 9 +++++++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp | 2 +-
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp | 4 ++--
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_algebra.hpp | 9 ++++++++-
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp | 2 ++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp | 19 +++++--------------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adjust_size.hpp | 2 +-
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp | 4 ++--
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile | 10 +++++-----
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp | 1 +
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/thrust/Makefile | 2 +-
   11 files changed, 37 insertions(+), 27 deletions(-)

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/detail/macros.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/detail/macros.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/detail/macros.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -13,12 +13,21 @@
 #ifndef BOOST_BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
 #define BOOST_BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
 
+//type traits aren't working with nvcc
+#ifndef __CUDACC__
 #include <boost/type_traits.hpp>
 #include <boost/static_assert.hpp>
 
 #define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 ) \
         BOOST_STATIC_ASSERT(( boost::is_same< typename boost::remove_const< Type1 >::type , Type2 >::value ))
 
+#else
+//empty macro for nvcc
+#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 )
+
+#endif // __CUDACC__
+
+
 
 /*
 #define BOOST_ODEINT_CHECK_OPERATION_ARITY( Operation , Arity ) \

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_algebra.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -24,7 +24,7 @@
 struct thrust_algebra
 {
         template< class StateType1 , class StateType2 , class Operation >
- static void transform2( StateType1 &s1 , StateType2 &s2 , Operation op )
+ static void for_each2( StateType1 &s1 , StateType2 &s2 , Operation op )
         {
                 thrust::for_each( thrust::make_zip_iterator( thrust::make_tuple( boost::begin(s1) , boost::begin(s2) ) ) ,
                                                   thrust::make_zip_iterator( thrust::make_tuple( boost::end(s1) , boost::end(s2) ) ) ,

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/thrust_operations.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -24,11 +24,11 @@
 {
         typedef Time time_type;
 
- struct increment
+ struct increment1
         {
                 time_type m_dt;
 
- increment( time_type dt ) : m_dt( dt ) { }
+ increment1( time_type dt ) : m_dt( dt ) { }
 
                 template< class Tuple >
                 __host__ __device__

Added: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/ublas_resize.hpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/external/ublas_resize.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -0,0 +1,37 @@
+/*
+ boost header: BOOST_NUMERIC_ODEINT/ublas_resize.hpp
+
+ Copyright 2009 Karsten Ahnert
+ Copyright 2009 Mario Mulansky
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or
+ copy at http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+#ifndef BOOST_NUMERIC_ODEINT_UBLAS_RESIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_UBLAS_RESIZE_HPP_INCLUDED
+
+#include <boost/numeric/ublas/vector.hpp>
+
+#include <boost/type_traits/integral_constant.hpp> //for true_type and false_type
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+/*
+ * specialization for boost::numeric::ublas::vector
+ */
+template< class T >
+struct is_resizeable< boost::numeric::ublas::vector< T > >
+{
+ struct type : public boost::true_type { };
+ const static bool value = type::value;
+};
+
+} // odeint
+} // numeric
+} // boost
+
+#endif /* BOOST_NUMERIC_ODEINT_UBLAS_RESIZE_HPP_INCLUDED */

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_algebra.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -13,7 +13,10 @@
 #ifndef BOOST_BOOST_NUMERIC_ODEINT_STANDARD_ALGEBRA_HPP_INCLUDED
 #define BOOST_BOOST_NUMERIC_ODEINT_STANDARD_ALGEBRA_HPP_INCLUDED
 
+//boost range does not work with nvcc
+#ifndef __CUDACC__
 #include <boost/range.hpp>
+#endif
 
 #include <boost/numeric/odeint/algebra/detail/macros.hpp>
 #include <boost/numeric/odeint/algebra/detail/for_each.hpp>
@@ -26,7 +29,10 @@
 template< class Container >
 struct standard_algebra
 {
- typedef Container container_type;
+ // leave standard algebra empty when using nvcc cause we don't habe boost::range then
+ // for using thrust and compiling with nvcc thrust_algebra should be used
+#ifndef __CUDACC__
+ typedef Container container_type;
 
         template< class StateType1 , class StateType2 , class Operation >
         static void for_each2( StateType1 &s1 , StateType2 &s2 , Operation op )
@@ -143,6 +149,7 @@
                 return detail::reduce( boost::begin( s ) , boost::end( s ) , red , init );
         }
 
+#endif
 };
 
 } // odeint

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -13,6 +13,8 @@
 #ifndef BOOST_BOOST_NUMERIC_ODEINT_STANDARD_OPERATIONS_HPP_INCLUDED
 #define BOOST_BOOST_NUMERIC_ODEINT_STANDARD_OPERATIONS_HPP_INCLUDED
 
+#include <algorithm> // for std::max
+
 namespace boost {
 namespace numeric {
 namespace odeint {

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -10,13 +10,13 @@
  copy at http://www.boost.org/LICENSE_1_0.txt)
 */
 
-#ifndef BOOST_BOOST_NUMERIC_ODEINT_STANDARD_RESIZE_HPP_INCLUDED
-#define BOOST_BOOST_NUMERIC_ODEINT_STANDARD_RESIZE_HPP_INCLUDED
+#ifndef BOOST_NUMERIC_ODEINT_STANDARD_RESIZE_HPP_INCLUDED
+#define BOOST_NUMERIC_ODEINT_STANDARD_RESIZE_HPP_INCLUDED
 
 #include <vector>
 #include <list>
-/* ToDo: boost ublas dependency here? */
-#include <boost/numeric/ublas/vector.hpp>
+
+#include <boost/type_traits/integral_constant.hpp> //for true_type and false_type
 
 namespace boost {
 namespace numeric {
@@ -55,15 +55,6 @@
         const static bool value = type::value;
 };
 
-/*
- * specialization for boost::numeric::ublas::vector
- */
-template< class T >
-struct is_resizeable< boost::numeric::ublas::vector< T > >
-{
- struct type : public boost::true_type { };
- const static bool value = type::value;
-};
 
 
 template< class Container >
@@ -108,4 +99,4 @@
 } // boost
 
 
-#endif //BOOST_BOOST_NUMERIC_ODEINT_STANDARD_RESIZE_HPP_INCLUDED
+#endif //BOOST_NUMERIC_ODEINT_STANDARD_RESIZE_HPP_INCLUDED

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adjust_size.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adjust_size.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adjust_size.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -16,7 +16,7 @@
 #include <boost/numeric/odeint/algebra/standard_resize.hpp>
 
 #include <boost/ptr_container/ptr_array.hpp>
-#include <boost/utility.hpp>
+//#include <boost/utility.hpp>
 
 namespace boost {
 namespace numeric {

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_stepper_base.hpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -14,8 +14,8 @@
 #define BOOST_BOOST_NUMERIC_ODEINT_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
 
 
-#include <boost/mem_fn.hpp>
-#include <boost/bind.hpp>
+//#include <boost/mem_fn.hpp>
+//#include <boost/bind.hpp>
 
 #include <boost/numeric/odeint/stepper/adjust_size.hpp>
 #include <boost/numeric/odeint/algebra/standard_resize.hpp>

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -40,11 +40,11 @@
               :
               : <link>static
       ]
-# [ run check_implicit_euler.cpp
-# :
-# :
-# : <link>static
-# ]
+ [ run check_implicit_euler.cpp
+ :
+ :
+ : <link>static
+ ]
     ;
 
 

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_implicit_euler.cpp 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -16,6 +16,7 @@
 
 #include <boost/numeric/odeint.hpp>
 #include <boost/numeric/odeint/stepper/implicit_euler.hpp>
+#include <boost/numeric/odeint/algebra/external/ublas_resize.hpp>
 
 #include <boost/numeric/ublas/vector.hpp>
 #include <boost/numeric/ublas/matrix.hpp>

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/thrust/Makefile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/thrust/Makefile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/thrust/Makefile 2010-08-16 08:18:47 EDT (Mon, 16 Aug 2010)
@@ -6,7 +6,7 @@
 
 INCLUDES += -I$(BOOST_ROOT) -I$(THRUST_ROOT) -I$(CUDA_ROOT)/include -I../../../../..
 
-NVCCFLAGS = -O3 $(INCLUDES) -arch sm_13
+NVCCFLAGS = -O3 $(INCLUDES) --compiler-bindir=/usr/bin/g++-4.3
 
 LDLIBS = -lcudart
 LDFLAGS = -L$(CUDA_ROOT)/lib64


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk