Kokkos Node API and Local Linear Algebra Kernels Version of the Day
CrsMatrix_FirstTouchTBB.cpp
00001 // ************************************************************************
00002 // 
00003 //          Kokkos: A Fast Kernel Package
00004 //              Copyright (2004) Sandia Corporation
00005 // 
00006 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00007 // license for use of this work by or on behalf of the U.S. Government.
00008 // 
00009 // This library is free software; you can redistribute it and/or modify
00010 // it under the terms of the GNU Lesser General Public License as
00011 // published by the Free Software Foundation; either version 2.1 of the
00012 // License, or (at your option) any later version.
00013 //  
00014 // This library is distributed in the hope that it will be useful, but
00015 // WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 //  
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // USA
00022 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00023 // 
00024 // ************************************************************************
00025 //@HEADER
00026 
00027 #include <Teuchos_UnitTestHarness.hpp>
00028 #include <Teuchos_TimeMonitor.hpp>
00029 #include <Teuchos_Time.hpp>
00030 #include <Teuchos_TypeNameTraits.hpp>
00031 #include <Teuchos_ScalarTraits.hpp>
00032 
00033 #include "Kokkos_ConfigDefs.hpp"
00034 #include "Kokkos_DefaultArithmetic.hpp"
00035 #include "Kokkos_DefaultKernels.hpp"
00036 #include "Kokkos_CrsGraph.hpp"
00037 #include "Kokkos_CrsMatrix.hpp"
00038 #include "Kokkos_Version.hpp"
00039 
00040 #include "Kokkos_TBBNode.hpp"
00041 
00042 namespace {
00043 
00044   using Kokkos::MultiVector;
00045   using Kokkos::CrsMatrixHostCompute;
00046   using Kokkos::CrsGraphHostCompute;
00047   using Kokkos::FirstTouchHostCrsMatrix;
00048   using Kokkos::FirstTouchHostCrsGraph;
00049   using Kokkos::DefaultArithmetic;
00050   using Kokkos::SerialNode;
00051   using Kokkos::DefaultKernels;
00052   using Teuchos::ArrayRCP;
00053   using Teuchos::RCP;
00054   using Teuchos::rcp;
00055   using Teuchos::null;
00056   using std::endl;
00057 
00058 #include "CrsMatrix_CrsTimingTests.hpp"
00059 
00060   using Kokkos::TBBNode;
00061   RCP<TBBNode> tbbnode;
00062 
00063   template <>
00064   RCP<TBBNode> getNode<TBBNode>() {
00065     if (tbbnode == null) {
00066       Teuchos::ParameterList pl;
00067       pl.set<int>("Num Threads",Test::numThreads);
00068       tbbnode = rcp(new TBBNode(pl));
00069     }
00070     return tbbnode;
00071   }
00072 
00073   //
00074   // Test
00075   // 
00076 
00077   typedef TBBNode                                             Node;
00078   // mfh 23 Feb 2011:
00079   // You don't need "typename" here, since none of the three 
00080   // parameters of DefaultKernels are template parameters.
00081   //typedef typename DefaultKernels<void,int,Node>::SparseOps   DSM;
00082   typedef DefaultKernels<void,int,Node>::SparseOps            DSM;
00083   typedef CrsMatrixHostCompute<double,int,Node,DSM>           StandardMat;
00084   typedef CrsGraphHostCompute<int,Node,DSM>                   StandardGraph;
00085   typedef FirstTouchHostCrsMatrix<double,int,Node,DSM>        FirstTouchMat;
00086   typedef FirstTouchHostCrsGraph<int,Node,DSM>                FirstTouchGraph;
00087 
00088   TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( CrsTiming, PowerTriDiag, StandardGraph,   StandardMat   )
00089   TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( CrsTiming, PowerTriDiag, FirstTouchGraph, FirstTouchMat )
00090 
00091 }
00092 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends