LAMA
/home/brandes/workspace/LAMA/src/lama/cuda/CUDAUtils.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_CUDA_UTILS_HPP_
00034 #define LAMA_CUDA_UTILS_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // others
00040 #include <lama/LAMATypes.hpp>
00041 
00042 #include <lama/exception/LAMAAssert.hpp>
00043 
00044 // logging
00045 #include <logging/logging.hpp>
00046 
00047 namespace lama
00048 {
00049 
00052 class LAMA_DLL_IMPORTEXPORT CUDAUtils
00053 {
00054 public:
00055 
00056     template<typename ValueType> 
00057     static ValueType sum( const ValueType array[], const IndexType n );
00058 
00059     template<typename ValueType> 
00060     static void setVal( ValueType array[], const IndexType n, const ValueType val );
00061 
00062     template<typename ValueType> 
00063     static void setOrder( ValueType array[], const IndexType n );
00064 
00065     template<typename ValueType>
00066     static ValueType getValue( const ValueType* array, const IndexType i );
00067 
00070     template<typename ValueType, typename OtherValueType>
00071     static void scale ( ValueType mValues[],
00072                         const IndexType n,
00073                         const OtherValueType value );
00074 
00077     template<typename ValueType>
00078     static ValueType maxval( const ValueType array[], const IndexType n );
00079 
00082     template<typename ValueType>
00083     static ValueType absMaxVal( const ValueType array[], const IndexType n );
00084 
00087     template<typename ValueType>
00088     static ValueType absMaxDiffVal( const ValueType array1[], const ValueType array2[], const IndexType n );
00089 
00090     template<typename ValueType1, typename ValueType2>
00091     static void set( ValueType1 out[], const ValueType2 in[], const IndexType n );
00092 
00095     template<typename ValueType1, typename ValueType2>
00096     static void setGather( ValueType1 out[], 
00097                            const ValueType2 in[],
00098                            const IndexType indexes[], 
00099                            const IndexType n );
00100 
00103     template<typename ValueType1, typename ValueType2>
00104     static void setScatter( ValueType1 out[], 
00105                             const IndexType indexes[], 
00106                             const ValueType2 in[],
00107                             const IndexType n );
00108 
00111     template<typename ValueType>
00112     static void invert( ValueType array[], const IndexType n );
00113 
00119     static void setInterface( struct UtilsInterface& Utils );
00120 
00121 private:
00122 
00123     LAMA_LOG_DECL_STATIC_LOGGER( logger );
00124 };
00125 
00126 }  // namespace lama
00127 
00128 #endif //  LAMA_CUDA_UTILS_HPP_