Commit fda03f94 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Adding cublas support.

parent 8782dd42
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlCublasWrapper.h  -  description
                             -------------------
    begin                : Apr 7, 2015
    copyright            : (C) 2015 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TNLCUBLASWARPER_H
#define	TNLCUBLASWARPER_H

template< typename Real1, 
          typename Real2,
          typename Index >
class tnlCublasWrapper
{
    public:
        static bool sdot( const Real1* v1, const Real2* v2, const Index size, Real1& result)
        {
            return false;
        }
};

#endif	/* TNLCUBLASWARPER_H */
+7 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define TNLVECTOROPERATIONSCUDA_IMPL_H_

#include <core/cuda/cuda-prefix-sum.h>
#include <core/cuda/tnlCublasWrapper.h>

template< typename Vector >
void tnlVectorOperations< tnlCuda >::addElement( Vector& v,
@@ -349,6 +350,12 @@ typename Vector1 :: RealType tnlVectorOperations< tnlCuda > :: getScalarProduct(
              cerr << "Vector names are " << v1. getName() << " and " << v2. getName() );

   Real result( 0 );
#ifdef HAVE_CUBLAS
   if( tnlCublasWrapper< typename Vector1::RealType,
                         typename Vector2::RealType,
                         typename Vector1::IndexType >::sdot( v1.getData(), v1.getData(), v1.getSize(), result ) )
       return result;
#endif   
   tnlParallelReductionScalarProduct< Real, Index > operation;
   reductionOnCudaDevice( operation,
                          v1. getSize(),
+1 −1
Original line number Diff line number Diff line
@HAVE_LIBBZ2@
@HAVE_CUBLAS@

@HAVE_CUSP@