Control: -1 patch

Hi Aaron

I cloned bug #815725 as a wishlist bug for 32-bit architectures, since upstream only want to support 64-bit. I was able to fix the use of x86 assembly on other 64-bit architectures and closed the original bug. New builds were successful on arm64, mips64el, alpha and sparc64. Trilinos also built on s390x in Ubuntu where they have a working libtbb for s390x.

I did some further experimentation and came up with a patch (attached) to build Kokkos (and thus a complete Trilinos as well) on 32-bit architectures. I have successfully built trilinos on i386 and armhf, and builds on amd64, arm64 and ppc64el remained successful. Ithen successfully built deal.II against the new Trilinos packages on all of the aforementioned architectures, although the deal.II tests eventually timed out on armhf.

If there are no objections, I will upload Trilinos including this patch within this week.

Regards
Graham

Description: Allow Kokkos to build on 32-bit and 64-bit architectures
 On 32-bit architectures, long ints are four bytes in size and
 long long ints are eight bytes in size.  On 64-bit architectures,
 both long ints and long long ints are eight bytes in size.
 This patch changes long to long long in some places (no change for
 64-bit architectures), and adds function declarations needed for
 building on 32-bit architectures.
Bug-Debian: https://bugs.debian.org/835406
Author: Graham Inggs <gin...@debian.org>
Last-Update: 2016-08-28
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp
@@ -136,6 +136,24 @@
                                        const unsigned long val )
 { return __sync_val_compare_and_swap(dest,compare,val); }
 
+KOKKOS_INLINE_FUNCTION
+unsigned long long atomic_compare_exchange( volatile unsigned long long * const dest ,
+                                       const unsigned long long compare ,
+                                       const unsigned long long val )
+{ return __sync_val_compare_and_swap(dest,compare,val); }
+
+KOKKOS_INLINE_FUNCTION
+double atomic_compare_exchange( volatile double * const dest ,
+                                       const double compare ,
+                                       const double val )
+{ return atomic_compare_exchange(dest,compare,val); }
+
+KOKKOS_INLINE_FUNCTION
+long long atomic_compare_exchange( volatile long long * const dest ,
+                                       const long long compare ,
+                                       const long long val )
+{ return __sync_val_compare_and_swap(dest,compare,val); }
+
 #endif
 
 template < typename T >
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp
@@ -172,6 +172,18 @@
 unsigned long int atomic_fetch_add( volatile unsigned long int * const dest , const unsigned long int val )
 { return __sync_fetch_and_add(dest,val); }
 
+KOKKOS_INLINE_FUNCTION
+double atomic_fetch_add( volatile double * const dest , const double val )
+{ return atomic_fetch_add(dest,val); }
+
+KOKKOS_INLINE_FUNCTION
+unsigned long long int atomic_fetch_add( volatile unsigned long long int * const dest , const unsigned long long int val )
+{ return __sync_fetch_and_add(dest,val); }
+
+KOKKOS_INLINE_FUNCTION
+long long int atomic_fetch_add( volatile long long int * const dest , const long long int val )
+{ return __sync_fetch_and_add(dest,val); }
+
 #endif
 
 template < typename T >
--- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp
+++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp
@@ -157,10 +157,10 @@
 template< typename T >
 KOKKOS_INLINE_FUNCTION
 T atomic_exchange( volatile T * const dest ,
-  typename Kokkos::Impl::enable_if< sizeof(T) == sizeof(int) || sizeof(T) == sizeof(long)
+  typename Kokkos::Impl::enable_if< sizeof(T) == sizeof(int) || sizeof(T) == sizeof(long long)
                                   , const T & >::type val )
 {
-  typedef typename Kokkos::Impl::if_c< sizeof(T) == sizeof(int) , int , long >::type type ;
+  typedef typename Kokkos::Impl::if_c< sizeof(T) == sizeof(int) , int , long long >::type type ;
 
   const type v = *((type*)&val); // Extract to be sure the value doesn't change
 
@@ -237,10 +237,10 @@
 template< typename T >
 KOKKOS_INLINE_FUNCTION
 void atomic_assign( volatile T * const dest ,
-  typename Kokkos::Impl::enable_if< sizeof(T) == sizeof(int) || sizeof(T) == sizeof(long)
+  typename Kokkos::Impl::enable_if< sizeof(T) == sizeof(int) || sizeof(T) == sizeof(long long)
                                   , const T & >::type val )
 {
-  typedef typename Kokkos::Impl::if_c< sizeof(T) == sizeof(int) , int , long >::type type ;
+  typedef typename Kokkos::Impl::if_c< sizeof(T) == sizeof(int) , int , long long >::type type ;
 
   const type v = *((type*)&val); // Extract to be sure the value doesn't change
 
-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers

Reply via email to